Example #1
0
 private void ProcessUpdate(OrderBookUpdate upd)
 {
     if (_previousUpdateEventTime < upd.EventTime)
     {
         foreach (var updAsk in upd.Asks)
         {
             if (updAsk.Value == 0)
             {
                 AskBook.Remove(updAsk.Key);
             }
             else
             {
                 AskBook[updAsk.Key] = updAsk.Value;
             }
         }
         foreach (var updBid in upd.Bids)
         {
             if (updBid.Value == 0)
             {
                 BidBook.Remove(updBid.Key);
             }
             else
             {
                 BidBook[updBid.Key] = updBid.Value;
             }
         }
         _previousUpdateEventTime = upd.EventTime;
         var handler = OnOrderbookUpdated;;
         if (handler != null)
         {
             var arg = new OrderBookUpdatedArgs {
                 UpdateTime = upd.EventTime
             };
             handler(this, arg);
         }
     }
     else
     {
         SetState(RealtimeOrderBookState.OutOfSync);
         throw new WebsocketStreamOutOfSyncException(string.Format("Websocket stream out of sync for {0}", Symbol));
     }
 }
Example #2
0
 public ActionResult RequestBook([Bind(Include = "ID,FirstName,TitleName")] AskBook Askbook)
 {
     return(View(Askbook));
 }