Set() public method

public Set ( double bestBid, double bestAsk, int bestBidQuantity, int bestAskQuantity ) : bool
bestBid double
bestAsk double
bestBidQuantity int
bestAskQuantity int
return bool
        public void ShouldNotTriggerSellSideOnHigherBidAndAskPrice()
        {
            bool triggered = false;

            var trigger = new BestPriceTrigger("abc", 40, WayEnum.Sell);
            trigger.SetTriggerAction(() => triggered = true);

            var bb = new OrderBookBestBidAsk("abc");
            bb.Set(50, 51, 1, 1);

            var triggerResult = trigger.TryExecute(bb);

            Assert.IsFalse(triggerResult);
            Assert.IsFalse(triggered);
        }
        public void ShouldNotTriggerBuySideOnLowerBidPrice()
        {
            bool triggered = false;

            var trigger = new BestPriceTrigger("abc", 10.4d, WayEnum.Buy);
            trigger.SetTriggerAction(() => triggered = true);

            var bb = new OrderBookBestBidAsk("abc");
            bb.Set(9.4d, null, 1, 1);

            var triggerResult = trigger.TryExecute(bb);

            Assert.IsFalse(triggerResult);
            Assert.IsFalse(triggered);
        }
        public void ShouldRemoveTriggerWhenTriggerIsExecuted()
        {
            var orderBookBestBidAsk = new OrderBookBestBidAsk("ABC");
            var book = new OrderBook("ABC", limitOrderMatchingAlgorithmMock, marketOrderMatchingAlgorithmMock, orderBookBestBidAsk);

            var trigger = new BestPriceTrigger("ABC", 10, WayEnum.Buy);
            var stopOrder = new StopLimitOrder("abc", 10, 90, 90, WayEnum.Buy, 2, trigger);

            trigger.SetTriggerAction(() =>
            {
                stopOrder.Delete();
            });

            book.AddStopLimitOrder(stopOrder);

            Assert.AreEqual(trigger, book.BuySideStopLimitOrders[0].Trigger);

            orderBookBestBidAsk.Set(11,12, 100, 100);
            trigger.TryExecute(orderBookBestBidAsk);

            Assert.AreEqual(0, book.BuySideStopLimitOrders.Count);
        }
        public void ShouldTriggerBuySideOnEqualBidHigherAskPrice()
        {
            bool triggered = false;

            var trigger = new BestPriceTrigger("abc", 50d, WayEnum.Buy);
            trigger.SetTriggerAction(() => triggered = true);

            var bb = new OrderBookBestBidAsk("abc");
            bb.Set(50, 51, 1, 1);

            var triggerResult = trigger.TryExecute(bb);

            Assert.IsTrue(triggerResult);
            Assert.IsTrue(triggered);
        }