public void Setup()
 {
     m_Instrument = 1;
     m_OrderBook = new OrderBook(m_Instrument);
     var orderBooks = new Dictionary<int, OrderBook>();
     orderBooks[m_Instrument] = m_OrderBook;
     m_Market = new Market(orderBooks);
 }
        public void Init()
        {
            m_Instrument = new Instrument("MSFT");
            m_BuyOrders = new BuyOrders(m_Instrument);
            m_SellOrders = new SellOrders(m_Instrument);
            m_Trades = new Trades(m_Instrument);

            m_OrderBook = new OrderBook(m_Instrument, m_BuyOrders, m_SellOrders, m_Trades);

            m_Orders = new List<Order>
            {
                new EquityOrder(m_Instrument, Order.OrderTypes.GoodUntilCancelled, Order.BuyOrSell.Buy, 100, 100),
                new EquityOrder(m_Instrument, Order.OrderTypes.GoodUntilDate, Order.BuyOrSell.Sell, 110, 100)
            };
        }
        public void OrderBooksPrioritiserTest()
        {
            var orderBooks = new List<OrderBook>();

            for (int i = 0; i < 10; ++i)
            {
                var book = new OrderBook(i);
                for (int j = 0; j < i; ++j)
                {
                    Statistic stat = book.Statistics[Statistics.Stat.NumOrders];
                    ++stat;
                }
                orderBooks.Add(book);
            }

            Market.PrioritiseOrderBooks(orderBooks,
                                        (x, y) => -1 * x.Statistics[Statistics.Stat.NumOrders].Value.CompareTo(
                                            y.Statistics[Statistics.Stat.NumOrders].Value));

            for (int i = 1; i < orderBooks.Count; ++i)
            {
                Assert.That(orderBooks[i].Statistics[Statistics.Stat.NumOrders].Value, Is.LessThanOrEqualTo(orderBooks[i - 1].Statistics[Statistics.Stat.NumOrders].Value));
            }
        }
 public void Init()
 {
     m_Instrument = 1;
     m_OrderBook = new OrderBook(m_Instrument);
 }