public void FromOrderBook_1_Test() { const string source = "FakeExchange"; var timestamp = DateTime.UtcNow; var inverted = _btcusd.Invert(); var btcUsdOrderBook = new OrderBook(source, _btcusd, new List <LimitOrder> // bids { new LimitOrder(1 / 8825m, 9), new LimitOrder(1 / 8823m, 5) }, new List <LimitOrder> // asks { new LimitOrder(1 / 9000m, 10), new LimitOrder(1 / 8999.95m, 7), new LimitOrder(1 / 8900.12345677m, 3) }, timestamp); var synthOrderBook = SynthOrderBook.FromOrderBook(btcUsdOrderBook, inverted); Assert.Equal(source, synthOrderBook.Source); Assert.Equal(inverted, synthOrderBook.AssetPair); Assert.Equal("BTCUSD", synthOrderBook.ConversionPath); Assert.Equal(3, synthOrderBook.Bids.Count()); Assert.Equal(2, synthOrderBook.Asks.Count()); Assert.Equal(9000m, synthOrderBook.BestBid.Price, 8); Assert.Equal(8825m, synthOrderBook.Asks.Max(x => x.Price), 8); Assert.Equal(8900.12345677m, synthOrderBook.Bids.Min(x => x.Price), 8); Assert.Equal(8823m, synthOrderBook.BestAsk.Price, 8); Assert.Equal(0.00111111m, synthOrderBook.BestBid.Volume, 8); Assert.Equal(0.00101983m, synthOrderBook.Asks.Max(x => x.Volume), 8); Assert.Equal(0.00033707m, synthOrderBook.Bids.Min(x => x.Volume), 8); Assert.Equal(0.00056670m, synthOrderBook.BestAsk.Volume, 8); Assert.Equal(timestamp, synthOrderBook.Timestamp); Assert.Equal(1, synthOrderBook.OriginalOrderBooks.Count); }
public void AssetPairInvertTest() { var inverted = _btcusd.Invert(); Assert.Equal(_btc.Id, inverted.Quote.Id); Assert.Equal(_usd.Id, inverted.Base.Id); }
public void OrderBooks_PrepareForEnumeration_0_1_0_Test() { var orderBooks = GetOrderBooks(_btceur, _eurchf.Invert(), _chfusd); var result = SynthOrderBook.PrepareForEnumeration(orderBooks, _btcusd); AssertChained3(result); }
public void AssetPairReverseTest() { var reversed = assetPair.Invert(); Assert.Equal(@base, reversed.Quote); Assert.Equal(quote, reversed.Base); Assert.Equal(assetPair.Accuracy, reversed.InvertedAccuracy); Assert.Equal(assetPair.InvertedAccuracy, reversed.Accuracy); }