Example #1
0
        static void Main(string[] args)
        {
            var ob = new OrderBook();

            //ob.Create(new Order(10, 10.0m, Side.Bid));
            //ob.Create(new Order(10, 11.0m, Side.Bid));
            //ob.Create(new Order(10, 11.0m, Side.Bid));
            //ob.Create(new Order(10, 12.0m, Side.Bid));
            //ob.Create(new Order(10, 13.0m, Side.Bid));
            //ob.Create(new Order(10, 14.0m, Side.Bid));
            ob.Create(new Order(10, 10, 15.0m, Side.Bid));
            //ob.Create(new Order(10, 10.0m, Side.Ask));
            //ob.Create(new Order(10, 11.0m, Side.Ask));
            //ob.Create(new Order(10, 11.0m, Side.Ask));
            //ob.Create(new Order(10, 12.0m, Side.Ask));
            //ob.Create(new Order(10, 13.0m, Side.Ask));
            //ob.Create(new Order(10, 14.0m, Side.Ask));
            ob.Create(new Order(10, 10, 15.5m, Side.Ask));
            Console.WriteLine(ob);
            Console.ReadLine();

            ob.Create(new Order(10, 10, 12.0m, Side.Bid));
            Console.WriteLine(ob);
            Console.ReadLine();
        }
Example #2
0
        public void CreateTwoMatchingOrders()
        {
            // Arrange
            var market = new Market(new List <int> {
                10, 11
            });

            // Act
            var       orderAsk = new Order(10, 10, 10, Side.Ask);
            var       orderBid = new Order(10, 10, 10, Side.Bid);
            OrderBook ob       = market.GetOrderBook(10);

            ob.Create(orderAsk);
            ob.Create(orderBid);

            // Assert
            Assert.Empty(ob.BidOrders);
            Assert.Empty(ob.AskOrders);
        }
Example #3
0
        public void CreateSingleOrder()
        {
            // Arrange
            var market = new Market(new List <int> {
                10, 11
            });

            // Act
            var       order = new Order(10, 10, 10, Side.Ask);
            OrderBook ob    = market.GetOrderBook(10);

            ob.Create(order);

            // Assert
            Assert.Empty(ob.BidOrders);
            Assert.Single(ob.AskOrders);
        }