public void OrderBookContext_constructor_test() { int depth = 10; OrderBookContext obContext = new OrderBookContext(depth); Assert.AreEqual(10, obContext.Depth); Assert.AreEqual(0, obContext.GetOfferPrice("RTS-12.13_FT", 0)); Assert.AreEqual(0, obContext.GetBidPrice("RTS-12.13_FT", 0)); }
public void OrderBookContext_update_test() { OrderBookContext obContext = new OrderBookContext(10); obContext.Update(0, "RTS-12.13_FT", 140000, 100, 140010, 50); Assert.AreEqual(140010, obContext.GetOfferPrice("RTS-12.13_FT", 0)); Assert.AreEqual(140000, obContext.GetBidPrice("RTS-12.13_FT", 0)); Assert.AreEqual(50, obContext.GetOfferVolume("RTS-12.13_FT", 0)); Assert.AreEqual(100, obContext.GetBidVolume("RTS-12.13_FT", 0)); }
public static double GetBestBidPrice(this OrderBookContext context, string symbol, double priceStep) { double offer = context.GetOfferPrice(symbol, 0); double bid = context.GetBidPrice(symbol, 0); if (offer - bid > priceStep) { return(bid + priceStep); } return(bid); }
public void UpdateQuotesOnBidAsk_handle_add_records_for_registered_symbol() { BidAsk bidAskOne = new BidAsk { Id = SerialIntegerFactory.Make(), Symbol = "RTS-9.13_FT", DateTime = BrokerDateTime.Make(DateTime.Now), Row = 0, NRows = 10, Ask = 150010, AskSize = 300, Bid = 150000, BidSize = 100 }; this.tradingData.Get <ObservableCollection <BidAsk> >().Add(bidAskOne); double resultBidPrice = storage.GetBidPrice(bidAskOne.Symbol, 0); double resultBidVolume = storage.GetBidVolume(bidAskOne.Symbol, 0); double resultOfferPrice = storage.GetOfferPrice(bidAskOne.Symbol, 0); double resultOfferVolume = storage.GetOfferVolume(bidAskOne.Symbol, 0); Assert.AreEqual(bidAskOne.Bid, resultBidPrice); Assert.AreEqual(bidAskOne.BidSize, resultBidVolume); Assert.AreEqual(bidAskOne.Ask, resultOfferPrice); Assert.AreEqual(bidAskOne.AskSize, resultOfferVolume); }