Exemplo n.º 1
0
 public static void Raise(BBO bbo)
 {
     if (BBOChanged != null)
     {
         BBOChanged(bbo);
     }
 }
 /// <summary>
 /// publish depth (to be used after reloading from snapshot)
 /// </summary>
 public void PublishDepth()
 {
     //publish depth
     if (DepthChanged != null)
     {
         DepthChanged(_depth);
     }
     //publish bbo
     if (BboChanged != null)
     {
         BBO bbo = new BBO(_currencyPair, _depth.BidLevels.First(), _depth.AskLevels.First());
         BboChanged(bbo);
     }
 }
        /// <summary>
        /// OnOrderBookChanged
        /// </summary>
        /// <param name="orderBook"></param>
        public void OnOrderBookChanged(LimitOrderBook orderBook)
        {
            if (_depth.Changed())
            {
                if (DepthChanged != null)
                {
                    DepthChanged(_depth);
                }
                if (BboChanged != null)
                {
                    int lastChange = _depth.LastPublishedChangeId;

                    if (_depth.BidLevels.First().ChangedSince(lastChange) || _depth.AskLevels.First().ChangedSince(lastChange))
                    {
                        BBO bbo = new BBO(_currencyPair, _depth.BidLevels.First(), _depth.AskLevels.First());
                        BboChanged(bbo);
                    }
                }
                _depth.Published();
            }
        }
Exemplo n.º 4
0
 /// <summary>
 /// Onn BBO changed event
 /// </summary>
 /// <param name="bbo"> </param>
 public void OnBBOChange(BBO bbo)
 {
     OutputDisruptor.Publish(bbo);
     Log.Debug("Best bid and offer received for currency pair: " + bbo.CurrencyPair);
 }