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); }
protected void OnMarketsUpdate(List <BittrexStreamMarketSummary> markets) { var tickers = markets.Select(m => new Ticker { Last = m.Last.GetValueOrDefault(), Ask = m.Ask, Bid = m.Bid, Market = m.MarketName, BaseVolume = m.BaseVolume.GetValueOrDefault() }); foreach (var ticker in tickers) { TickerUpdated.OnNext(ticker); } }