public override async Task SendMarketUpdates(string market) { if (IsInTestMode) { if (Candles == null || Candles[0].Interval != TickInterval.OneMinute) { await GetCandlesAsync(market, TickInterval.OneMinute); } //Candles = Candles.Take(5000).ToList(); foreach (var candle in Candles) { try { var ticker = new Ticker { Id = Candles.IndexOf(candle), Market = market, Bid = candle.Low, Ask = candle.High, Timestamp = candle.Timestamp }; TickerUpdated.OnNext(ticker); } catch (Exception e) { Console.WriteLine(e); } } TickerUpdated.OnCompleted(); } }
public override Task SendMarketUpdates(string market) { if (IsInTestMode) { if (Candles == null) { Candles = new List <Candle>(); } Candles = Candles.Take(5000).ToList(); foreach (var candle in Candles) { try { var ticker = new Ticker { Id = Candles.IndexOf(candle), Market = market, Bid = candle.Low, Ask = candle.High, Timestamp = candle.Timestamp }; TickerUpdated.OnNext(ticker); } catch (Exception e) { Console.WriteLine(e); } } TickerUpdated.OnCompleted(); } return(Task.CompletedTask); }