Ejemplo n.º 1
0
 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();
     }
 }
Ejemplo n.º 2
0
 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);
 }
Ejemplo n.º 3
0
        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);
            }
        }