Exemplo n.º 1
0
 private static void ValidateSymbols(IExchangeAPI api, string[] symbols)
 {
     string[] apiSymbols = api.GetSymbolsAsync().Sync().ToArray();
     foreach (string symbol in symbols)
     {
         if (!apiSymbols.Contains(symbol))
         {
             throw new ArgumentException(string.Format("Symbol {0} does not exist in API {1}, valid symbols: {2}", symbol, api.Name, string.Join(",", apiSymbols.OrderBy(s => s))));
         }
     }
 }
Exemplo n.º 2
0
        public async Task <ActionResult> ExchangePairsExchangeSymbols(string exchange)
        {
            JArray       symbolArray   = new JArray();
            IExchangeAPI api           = ExchangeAPI.GetExchangeAPI(exchange.ToLower());
            var          exchangeCoins = await api.GetSymbolsAsync();

            foreach (var coin in exchangeCoins)
            {
                symbolArray.Add(coin);
            }
            return(new JsonResult(symbolArray));
        }
Exemplo n.º 3
0
        private async Task <IEnumerable <string> > GetSymbols(IExchangeAPI api)
        {
            try
            {
                var symbols = await api.GetSymbolsAsync();

                return(symbols);
            }
            catch (Exception ex)
            {
                //Console.WriteLine("***[{0} {1}] ERROR: {2}***", exchange, global_symbol, ""); //ex.Message);
                return(null);
            }
        }
Exemplo n.º 4
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="api">Exchange API</param>
 /// <param name="symbol">The symbol to trade by default, can be null</param>
 public ExchangeInfo(IExchangeAPI api, string symbol = null)
 {
     API       = api;
     Symbols   = api.GetSymbolsAsync().Sync().ToArray();
     TradeInfo = new ExchangeTradeInfo(this, symbol);
 }