protected override void UpdateLiveLines() { var lines = new List <LineDTO>(); var converter = new BetFairLineConverter(); try { var cookieCollection = CachedArray.GetData(); var token = BetFairHelper.GetAuthField(cookieCollection, AuthField.Token); var appKey = BetFairHelper.GetAuthField(cookieCollection, AuthField.Developer); try { lines = converter.Convert($"{token}|{appKey}", Name).ToList(); } catch (Exception e) { Log.Info("BF Parse event exception " + e.InnerException); } LastUpdatedDiff = DateTime.Now - LastUpdated; ConsoleExt.ConsoleWrite(Name, ProxyList.Count, lines.Count, new DateTime(LastUpdatedDiff.Ticks).ToString("mm:ss")); ActualLines = lines.ToArray(); } catch (Exception e) { Log.Info("ERROR BF " + e.Message + e.StackTrace); Console.WriteLine("ERROR BF " + e.Message + e.StackTrace); } }
public LineDTO[] Convert(string response, string bookmaker) { var token = response.Split('|')[0]; var appKey = response.Split('|')[1]; var lines = new List <LineDTO>(); var aping = new SportsAPING(appKey, token); var marketProjection = new List <MarketProjection> { MarketProjection.EVENT, MarketProjection.EVENT_TYPE, MarketProjection.RUNNER_DESCRIPTION, }; var marketFilter = new MarketFilter { EventTypeIds = new[] { "1", //Footbal "7524" //Ice hockey //"7522", //"468328", //"998917" }, InPlayOnly = true, //TextQuery = "OVER_UNDER_*", MarketBettingTypes = new List <MarketBettingType> { MarketBettingType.ODDS, MarketBettingType.ASIAN_HANDICAP_DOUBLE_LINE } }; var resultList = aping.ListMarketCatalogue(marketFilter, marketProjection, null, 999); if (resultList == null || !resultList.Any()) { return(lines.ToArray()); } var listMarketCatalogue = resultList.ToList(); marketFilter.TextQuery = null; marketFilter.MarketTypeCodes = aping.ListMarketTypes(marketFilter) .Select(x => x.MarketType) .Where(x => Matches.Any(a => a == x)) .ToList(); listMarketCatalogue.AddRange(aping.ListMarketCatalogue(marketFilter, marketProjection, null, 999)); var marketCataloguesGroups = listMarketCatalogue .Where(x => x.Event.Name.Contains(" v ") || x.Event.Name.Contains(" @ ")) .GroupBy(x => new { EventTypeName = x.EventType.Name, EventName = x.Event.Name }); lines.AddRange(BetFairHelper.Convert(marketCataloguesGroups.SelectMany(m => m).ToList(), aping, bookmaker)); return(lines.ToArray()); }