/// <summary> /// Get OrderBook /// </summary> /// <param name="symbol">Symbol of orderbook</param> /// <returns>OrderBook object</returns> public Entities.OrderBook GetOrderBook(string symbol) { Entities.OrderBook orderBook = null; int i = 0; if (_thisExchange == Exchange.BINANCE) { orderBook = _bianceRepo.GetOrderBook(symbol).Result; while (orderBook == null && i < 3) { orderBook = _bianceRepo.GetOrderBook(symbol).Result; i++; } } else if (_thisExchange == Exchange.GDAX) { var gdaxBook = _gdaxRepo.GetOrderBook(symbol).Result; while (gdaxBook == null && i < 3) { gdaxBook = _gdaxRepo.GetOrderBook(symbol).Result; i++; } if (gdaxBook != null) { orderBook = GDAXOrderBookToOrderBook(gdaxBook); } } else if (_thisExchange == Exchange.KUCOIN) { var kuBook = _kuRepo.GetOrderBook(symbol).Result; while (kuBook == null && i < 3) { kuBook = _kuRepo.GetOrderBook(symbol).Result; i++; } if (kuBook != null) { orderBook = KuCoinOrderBookToOrderBook(kuBook); } } return(orderBook); }
public void GetOrderBookTest() { var symbol = "ETH-BTC"; var orderBook = _repo.GetOrderBook(symbol).Result; Assert.True(orderBook != null); Assert.True(orderBook.buys.Length > 0); Assert.True(orderBook.sells.Length > 0); }