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);
 }