public void Update(Ticker ticker, IncrementalUpdateInfo info)
 {
     for (int i = 0; i < info.BidsUpdates.Count; i++)
     {
         string[] item = info.BidsUpdates[i];
         ticker.OrderBook.ApplyIncrementalUpdate(OrderBookEntryType.Bid, item[1], item[2]);
     }
     for (int i = 0; i < info.AsksUpdates.Count; i++)
     {
         string[] item = info.AsksUpdates[i];
         ticker.OrderBook.ApplyIncrementalUpdate(OrderBookEntryType.Ask, item[1], item[2]);
     }
     for (int i = 0; i < info.TradeUpdates.Count; i++)
     {
         string[]      item  = info.TradeUpdates[i];
         TradeInfoItem trade = new TradeInfoItem(null, ticker)
         {
             Type         = item[1][0] == 'S' ? TradeType.Sell : TradeType.Buy,
             RateString   = item[2],
             AmountString = item[3],
             Time         = new DateTime(Convert.ToInt64(item[4])).ToLocalTime()
         };
         ticker.AddTradeHistoryItem(trade);//.InsertTradeHistoryItem(trade);
         CandleStickChartHelper.UpdateVolumes(ticker.CandleStickData, trade, ticker.CandleStickPeriodMin);
     }
     ticker.OnApplyIncrementalUpdate();
 }
Ejemplo n.º 2
0
 public void Update(Ticker ticker, IncrementalUpdateInfo info)
 {
     foreach (string[] item in info.Updates)
     {
         if (item[0][0] == 'o')
         {
             ticker.OrderBook.ApplyIncrementalUpdate(
                 item[1][0] == '1' ? OrderBookEntryType.Bid : OrderBookEntryType.Ask,
                 item[2],
                 item[3]);
         }
         else if (item[0][0] == 't')
         {
             TradeInfoItem trade = new TradeInfoItem(null, ticker)
             {
                 Type         = item[2][0] == '0' ? TradeType.Sell : TradeType.Buy,
                 RateString   = item[3],
                 AmountString = item[4],
                 Time         = new DateTime(Convert.ToInt64(item[5]))
             };
             ticker.TradeHistory.Insert(0, trade);
             CandleStickChartHelper.UpdateVolumes(ticker.CandleStickData, trade, ticker.CandleStickPeriodMin);
         }
     }
     ticker.OnApplyIncrementalUpdate();
 }
Ejemplo n.º 3
0
 public void Update(Ticker ticker, IncrementalUpdateInfo info)
 {
     for (int i = 0; i < info.Updates.Count; i++)
     {
         string[] item = info.Updates[i];
         if (item[0][0] == 'o')
         {
             ticker.OrderBook.ApplyIncrementalUpdate(item[1][0] == '1' ? OrderBookEntryType.Bid : OrderBookEntryType.Ask, item[2], item[3]);
         }
         else if (item[0][0] == 't')
         {
             TradeInfoItem trade = new TradeInfoItem(null, ticker)
             {
                 Type = item[2][0] == '0' ? TradeType.Sell : TradeType.Buy, RateString = item[3], AmountString = item[4], Time = ticker.Exchange.FromUnixTimestamp(Convert.ToInt64(item[5]))
             };
             if (trade.Time.Year == 1)
             {
                 throw new InvalidOperationException();
             }
             ticker.TradeHistory.Insert(0, trade);
             CandleStickChartHelper.UpdateVolumes(ticker.CandleStickData, trade, ticker.CandleStickPeriodMin);
         }
     }
     ticker.OnApplyIncrementalUpdate();
 }
        public void Update(Ticker ticker, IncrementalUpdateInfo info)
        {
            List <OrderBookEntry> bids = ticker.OrderBook.Bids;

            OrderBook orderBook = ticker.OrderBook;

            foreach (string[] item in info.BidsUpdates)
            {
                orderBook.ApplyIncrementalUpdate(OrderBookEntryType.Bid, item[0], item[1]);
            }
            foreach (string[] item in info.AsksUpdates)
            {
                orderBook.ApplyIncrementalUpdate(OrderBookEntryType.Ask, item[0], item[1]);
            }

            ticker.OnApplyIncrementalUpdate();
        }
Ejemplo n.º 5
0
        public void Update(Ticker ticker, IncrementalUpdateInfo info)
        {
            List <OrderBookEntry> bids = ticker.OrderBook.Bids;

            OrderBook orderBook = ticker.OrderBook;

            for (int i = 0; i < info.BidsUpdates.Count; i++)
            {
                string[] item = info.BidsUpdates[i];
                orderBook.ApplyIncrementalUpdate(OrderBookEntryType.Bid, item[0], item[1]);
            }
            for (int i = 0; i < info.AsksUpdates.Count; i++)
            {
                string[] item = info.AsksUpdates[i];
                orderBook.ApplyIncrementalUpdate(OrderBookEntryType.Ask, item[0], item[1]);
            }
            ticker.OnApplyIncrementalUpdate();
        }
Ejemplo n.º 6
0
 void IIncrementalUpdateDataProvider.Update(Ticker ticker, IncrementalUpdateInfo info)
 {
     throw new NotImplementedException();
 }
 public void Update(Ticker ticker, IncrementalUpdateInfo info)
 {
     throw new NotImplementedException();
 }