public static void RunPerformTests(Dictionary <string, string> dict) { IExchangeAPI[] apis = ExchangeAPI.GetExchangeAPIDictionary().Values.ToArray(); foreach (IExchangeAPI api in apis) { // test all public API for each exchange try { string symbol = GetSymbol(api); IReadOnlyCollection <string> symbols = api.GetSymbols(); Assert(symbols != null && symbols.Count != 0 && symbols.Contains(symbol, StringComparer.OrdinalIgnoreCase)); ExchangeTrade[] trades = api.GetHistoricalTrades(symbol).ToArray(); Assert(trades.Length != 0 && trades[0].Price > 0m && trades[0].Amount > 0m); var book = api.GetOrderBook(symbol); Assert(book.Asks.Count != 0 && book.Bids.Count != 0 && book.Asks[0].Amount > 0m && book.Asks[0].Price > 0m && book.Bids[0].Amount > 0m && book.Bids[0].Price > 0m); trades = api.GetRecentTrades(symbol).ToArray(); Assert(trades.Length != 0 && trades[0].Price > 0m && trades[0].Amount > 0m); var ticker = api.GetTicker(symbol); Assert(ticker != null && ticker.Ask > 0m && ticker.Bid > 0m && ticker.Last > 0m && ticker.Volume != null && ticker.Volume.PriceAmount > 0m && ticker.Volume.QuantityAmount > 0m); } catch (Exception ex) { Console.WriteLine("Request failed, api: {0}, error: {1}", api, ex.Message); } } }
public static void RunPerformTests(Dictionary <string, string> dict) { TestEncryption(); IExchangeAPI[] apis = ExchangeAPI.GetExchangeAPIDictionary().Values.ToArray(); foreach (IExchangeAPI api in apis) { // test all public API for each exchange try { string symbol = GetSymbol(api); IReadOnlyCollection <string> symbols = api.GetSymbols().ToArray(); Assert(symbols != null && symbols.Count != 0 && symbols.Contains(symbol, StringComparer.OrdinalIgnoreCase)); ExchangeTrade[] trades = api.GetHistoricalTrades(symbol).ToArray(); Assert(trades.Length != 0 && trades[0].Price > 0m && trades[0].Amount > 0m); var book = api.GetOrderBook(symbol); Assert(book.Asks.Count != 0 && book.Bids.Count != 0 && book.Asks[0].Amount > 0m && book.Asks[0].Price > 0m && book.Bids[0].Amount > 0m && book.Bids[0].Price > 0m); trades = api.GetRecentTrades(symbol).ToArray(); Assert(trades.Length != 0 && trades[0].Price > 0m && trades[0].Amount > 0m); var ticker = api.GetTicker(symbol); Assert(ticker != null && ticker.Ask > 0m && ticker.Bid > 0m && ticker.Last > 0m && ticker.Volume != null && ticker.Volume.PriceAmount > 0m && ticker.Volume.QuantityAmount > 0m); try { var candles = api.GetCandles(symbol, 86400, DateTime.UtcNow.Subtract(TimeSpan.FromDays(7.0)), null).ToArray(); Assert(candles.Length != 0 && candles[0].ClosePrice > 0m && candles[0].HighPrice > 0m && candles[0].LowPrice > 0m && candles[0].OpenPrice > 0m && candles[0].HighPrice >= candles[0].LowPrice && candles[0].HighPrice >= candles[0].ClosePrice && candles[0].HighPrice >= candles[0].OpenPrice && !string.IsNullOrWhiteSpace(candles[0].Name) && candles[0].ExchangeName == api.Name && candles[0].PeriodSeconds == 86400 && candles[0].VolumePrice > 0.0 && candles[0].VolumeQuantity > 0.0 && candles[0].WeightedAverage >= 0m); } catch (NotSupportedException) { } catch (NotImplementedException) { } } catch (Exception ex) { Console.WriteLine("Request failed, api: {0}, error: {1}", api, ex.Message); } } }