public void Setup() { m_Instrument = new Instrument("MSFT"); m_OrderBook = new OrderBook(m_Instrument); var orderBooks = new Dictionary<Instrument, OrderBook>(); orderBooks[m_Instrument] = m_OrderBook; m_Market = new Market(orderBooks); }
public Trade(Instrument instrument, UInt64 quantity, Decimal price) : this() { if (instrument == null) throw new ArgumentNullException("instrument"); if(quantity <= 0) throw new ArgumentException("a trade cannot be created with a quantity cannot less than or equal to 0", "quantity"); if (price <= 0) throw new ArgumentException("a trade cannot be created with a price cannot less than or equal to 0", "price"); Instrument = instrument; Quantity = quantity; Price = price; }
protected Order(Instrument instrument, OrderTypes orderType, BuyOrSell buySell, Decimal price, UInt64 quantity) : this() { if (instrument == null) throw new ArgumentNullException("instrument"); if (quantity <= 0) throw new ArgumentException("order cannot be created with quantity less than or equal to 0", "quantity"); if (price <= 0) throw new ArgumentException("price cannot be less than or equal to 0", "price"); Instrument = instrument; OrderType = orderType; BuySell = buySell; Price = price; Quantity = quantity; }
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); }
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 Init() { m_Instrument = new Instrument("MSFT"); m_SellOrders = new SellOrders(m_Instrument); for (int i = 0, j = 10; i < 10; ++i, ++j) { Thread.Sleep(2); m_SellOrders.Insert(new EquityOrder(m_Instrument, Order.OrderTypes.GoodUntilCancelled, Order.BuyOrSell.Sell, 5, (ulong)j)); } for (int i = 0, j = 10; i < 10; ++i, ++j) { m_SellOrders.Insert(new EquityOrder(m_Instrument, Order.OrderTypes.GoodUntilCancelled, Order.BuyOrSell.Sell, 5, (ulong)j)); } }
public OrderBook(Instrument 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(); }
public void Init() { m_Instrument = new Instrument("MSFT"); m_Trades = new Trades(m_Instrument); }
public void Init() { m_Instrument = new Instrument("GOOG"); m_BuyOrder = new EquityOrder(m_Instrument, Order.OrderTypes.GoodUntilCancelled, Order.BuyOrSell.Buy, 100M, 100ul); m_SellOrder = new EquityOrder(m_Instrument, Order.OrderTypes.GoodUntilCancelled, Order.BuyOrSell.Sell, 90, 100ul); m_SellOrders = new SellOrders(m_Instrument); m_BuyOrders = new BuyOrders(m_Instrument); m_SellOrders.Insert(m_SellOrder); m_BuyOrders.Insert(m_BuyOrder); m_Trades = new Trades(m_Instrument); m_TradeProcessor = m_Trades.TradeProcessingStrategy as Trades.InMemoryTradeProcessor; }
public Trades(Instrument instrument) : this(instrument, new InMemoryTradeProcessor()) { }
public Trades(Instrument instrument, TradeProcessor tradeProcessingStrategy) { Instrument = instrument; TradeProcessingStrategy = tradeProcessingStrategy; }
public OrderBook(Instrument instrument, BuyOrders buyOrders, SellOrders sellOrders, Trades trades) : this(instrument, buyOrders, sellOrders, trades, new SynchronousOrderProcessor(buyOrders, sellOrders, trades)) { }
public OrderBook(Instrument instrument) : this(instrument, new BuyOrders(instrument), new SellOrders(instrument), new Trades(instrument)) { }