Exemplo n.º 1
0
        public OrderBook(int instrument, BuyOrders buyOrders, SellOrders sellOrders, Trades trades,
                         OrderProcessor orderProcessingStrategy)
        {
            if (instrument == null)
            {
                throw new ArgumentNullException("instrument");
            }
            if (buyOrders == null)
            {
                throw new ArgumentNullException("buyOrders");
            }
            if (sellOrders == null)
            {
                throw new ArgumentNullException("sellOrders");
            }
            if (trades == null)
            {
                throw new ArgumentNullException("trades");
            }
            if (orderProcessingStrategy == null)
            {
                throw new ArgumentNullException("orderProcessingStrategy");
            }
            if (!(instrument == buyOrders.Instrument && instrument == sellOrders.Instrument))
            {
                throw new ArgumentException("instrument does not match buyOrders and sellOrders instrument");
            }

            Instrument = instrument;
            BuyOrders  = buyOrders;
            SellOrders = sellOrders;
            Trades     = trades;
            OrderProcessingStrategy = orderProcessingStrategy;
            Statistics = new Statistics();
        }
Exemplo n.º 2
0
        public override uint CreateInstrument(uint iid, string symbol)
        {
            instruments[iid]  = new ZInstrument(iid, symbol);
            _instruments[iid] = new OME.Instrument(symbol);

            var instrument = _instruments[iid];

            _buyOrderBook[iid]  = new OME.BuyOrders(instrument);
            _sellOrderBook[iid] = new OME.SellOrders(instrument);
            _trades[iid]        = new OME.Trades(instrument);
            //_tradeProcessor = _trades.TradeProcessingStrategy as Trades.InMemoryTradeProcessor;

            return(iid);
        }
Exemplo n.º 3
0
 public OrderBook(int instrument, BuyOrders buyOrders, SellOrders sellOrders, Trades trades)
     : this(
         instrument, buyOrders, sellOrders, trades, new SynchronousOrderProcessor(buyOrders, sellOrders, trades))
 {
 }