/// <summary> /// Append bbo info to ticker info /// </summary> /// <param name="bboRepresentation"></param> public void UpdateBboInTickerInfo(BBORepresentation bboRepresentation) { AskPrice = bboRepresentation.BestAskPrice; AskVolume = bboRepresentation.BestAskVolume; BidPrice = bboRepresentation.BestBidPrice; BidVolume = bboRepresentation.BestBidVolume; }
private void VerifyBboWhenOrdersPublishedAfterReplayForScenario1(BBORepresentation representation) { Assert.AreEqual(representation.BestAskOrderCount, 2); Assert.AreEqual(representation.BestAskPrice, 407); Assert.AreEqual(representation.BestAskVolume, 202); Assert.AreEqual(representation.BestBidOrderCount, 2); Assert.AreEqual(representation.BestBidPrice, 406); Assert.AreEqual(representation.BestBidVolume, 201); Assert.AreEqual(representation.CurrencyPair, "XBTUSD"); }
private void VerifyBboAfterReplay(BBORepresentation beforeReplay, BBORepresentation afterReplay) { Assert.AreEqual(beforeReplay.BestAskOrderCount, afterReplay.BestAskOrderCount); Assert.AreEqual(beforeReplay.BestAskPrice, afterReplay.BestAskPrice); Assert.AreEqual(beforeReplay.BestAskVolume, afterReplay.BestAskVolume); Assert.AreEqual(beforeReplay.BestBidOrderCount, afterReplay.BestBidOrderCount); Assert.AreEqual(beforeReplay.BestBidPrice, afterReplay.BestBidPrice); Assert.AreEqual(beforeReplay.BestBidVolume, afterReplay.BestBidVolume); Assert.AreEqual(beforeReplay.CurrencyPair, afterReplay.CurrencyPair); }
/// <summary> /// Method that wil append get ticker info and append bbo to it /// </summary> /// <param name="currenyPair"></param> /// <returns></returns> public TickerInfoReadModel GetTickerInfo(string currenyPair) { TickerInfoReadModel model = _tickerInfoRepository.GetTickerInfoByCurrencyPair(currenyPair); BBORepresentation bboRepresentation = _bboMemoryImage.BBORepresentationList.Contains(currenyPair); if (bboRepresentation != null) { model.UpdateBboInTickerInfo(bboRepresentation); } return(model); }
public void GetBboTest_ChecksIfTheBboIsRetreivedSuccessfully_ReturnsBboForCurrencypairIfPresent() { BBOMemoryImage bboMemoryImage = new BBOMemoryImage(); MarketDataQueryService queryService = new MarketDataQueryService(null, null, bboMemoryImage, null, null); DepthLevel bestBid = new DepthLevel(new Price(491)); bestBid.IncreaseVolume(new Volume(100)); DepthLevel bestAsk = new DepthLevel(new Price(492)); bestAsk.IncreaseVolume(new Volume(200)); bboMemoryImage.OnBBOArrived("BTCUSD", bestBid, bestAsk); BBORepresentation bboRepresentation = queryService.GetBBO("BTCUSD"); Assert.IsNotNull(bboRepresentation); Assert.AreEqual(bestBid.Price.Value, bboRepresentation.BestBidPrice); Assert.AreEqual(bestBid.AggregatedVolume.Value, bboRepresentation.BestBidVolume); Assert.AreEqual(bestBid.OrderCount, bboRepresentation.BestBidOrderCount); Assert.AreEqual(bestAsk.Price.Value, bboRepresentation.BestAskPrice); Assert.AreEqual(bestAsk.AggregatedVolume.Value, bboRepresentation.BestAskVolume); Assert.AreEqual(bestAsk.OrderCount, bboRepresentation.BestAskOrderCount); }