Exemplo n.º 1
0
 private void ProcessDelete(MarketDepthMessage message)
 {
     if (message.BidSide)
     {
         observer.OnBidRemove(message.Position);
         return;
     }
     
     observer.OnAskRemove(message.Position);
 }
Exemplo n.º 2
0
        private void ProcessUpdate(MarketDepthMessage message)
        {
            var update = new MarketDepthUpdate {Price = message.Price, Quantity = message.Size};
            if (message.BidSide)
            {
                observer.OnBidUpdate(message.Position, update);
                return;
            }

            observer.OnAskUpdate(message.Position, update);
        }
        public void EnsureThatOnAskUpdateWillBeCalledOnUpdateOnAskSide()
        {
            var update = new MarketDepthMessage
            {
                BidSide = false,
                Operation = MarketDepthOperation.Insert,
                Position = 1
            };

            dispatcher.OnMarketDepth(update);

            observerMock.Verify(observer => observer.OnAskUpdate(update.Position, It.IsAny<MarketDepthUpdate>()));
        }
Exemplo n.º 4
0
        public void OnMarketDepth(MarketDepthMessage message)
        {
            switch (message.Operation)
            {
                case MarketDepthOperation.Insert:
                case MarketDepthOperation.Update:
                    ProcessUpdate(message);
                    return;

                case MarketDepthOperation.Delete:
                    ProcessDelete(message);
                    return;
            }

            var errorMessage = string.Format("This kind of operation not supported: {0}", (int)message.Operation);
            throw new ArgumentOutOfRangeException("message", errorMessage);
        }
        public void EnsureThatOnAskRemoveWillBeCalledOnDeleteOnAskSide()
        {
            var update = new MarketDepthMessage
            {
                BidSide = false,
                Operation = MarketDepthOperation.Delete,
                Position = 1
            };

            dispatcher.OnMarketDepth(update);

            observerMock.Verify(observer => observer.OnAskRemove(update.Position));
        }
        public void EnsureThatExceptionWillBeTrownOnInvalidUpdateType()
        {
            var update = new MarketDepthMessage
            {
                BidSide = false,
                Operation = (MarketDepthOperation)12,
                Position = 1
            };

            dispatcher.OnMarketDepth(update);
        }
Exemplo n.º 7
0
 private void OnMarketDepth(MarketDepthMessage message)
 {
     this.marketDepthUpdatesDispatcher.OnMarketDepth(message);
 }