Esempio n. 1
0
        private static string GetCoeffKind(GetCoeffKindParams getCoeffKindParams, out decimal?сoeffParam)
        {
            сoeffParam = null;
            var marketCatalogue = getCoeffKindParams.MarketCatalogue;

            var runnerDescription = marketCatalogue.Runners.FirstOrDefault(x => x.SelectionId == getCoeffKindParams.Runner.SelectionId && x.Handicap == getCoeffKindParams.Runner.Handicap);

            if (runnerDescription == null)
            {
                return(null);
            }

            try
            {
                if (marketCatalogue.MarketName.EqualsIgnoreCase("draw no bet"))
                {
                    return(getCoeffKindParams.Mapping.ContainsKey(runnerDescription.RunnerName) ?
                           "W" + getCoeffKindParams.Mapping[runnerDescription.RunnerName] : null);
                }
                if (marketCatalogue.MarketName.EqualsIgnoreCase("Match Odds") ||
                    marketCatalogue.MarketName.EqualsIgnoreCase("Moneyline") ||
                    marketCatalogue.MarketName.EqualsIgnoreCase("Double Chance") ||
                    marketCatalogue.MarketName.EqualsIgnoreCase("Regular Time Match Odds"))
                {
                    return(getCoeffKindParams.Mapping.ContainsKey(runnerDescription.RunnerName) ?
                           getCoeffKindParams.Mapping[runnerDescription.RunnerName] : null);
                }

                if (marketCatalogue.MarketName.EqualsIgnoreCase("Goal Lines"))
                {
                    сoeffParam = runnerDescription.Handicap.ToNullDecimal();
                    return($"TOTAL{runnerDescription.RunnerName.ToUpper()}");
                }

                if (marketCatalogue.MarketName.EqualsIgnoreCase("asian handicap"))
                {
                    сoeffParam = runnerDescription.Handicap.ToNullDecimal();

                    return(getCoeffKindParams.Mapping.ContainsKey(runnerDescription.RunnerName) ? $"HANDICAP{getCoeffKindParams.Mapping[runnerDescription.RunnerName]}" : null);
                }
                if (marketCatalogue.MarketName.StartsWithIgnoreCase("over") || marketCatalogue.MarketName.StartsWithIgnoreCase("under") || marketCatalogue.MarketName.StartsWithIgnoreCase("First Half Goals"))
                {
                    var match = Regex.Match(runnerDescription.RunnerName, @"(?<type>over|under) (?<value>[+|-]?[\d.]+)\s?");

                    if (match.Success)
                    {
                        сoeffParam = match.Groups["value"].Value.ToNullDecimal().Value;
                        return($"TOTAL{match.Groups["type"].Value.ToUpper()}");
                    }
                }
            }
            catch (System.Exception e)
            {
                Log.Info("BF Parse CoeffKindException " + JsonConvert.SerializeObject(e));
            }

            return(null);/* runnerDescription.RunnerName + marketCatalogue.MarketName;*/
        }
Esempio n. 2
0
        private static string GetCoeffType(GetCoeffKindParams getCoeffKindParams)
        {
            var result = string.Empty;

            if (getCoeffKindParams.MarketCatalogue.MarketName.ContainsIgnoreCase("first half"))
            {
                result += "1st half";
            }

            return(result);
        }