public async Task <IEnumerable <Symbol> > GetSymbolsAsync(CancellationToken cancellationToken) { using var kucoinClient = new KucoinClient(); var result = await kucoinClient.GetSymbolsAsync().ConfigureAwait(false); var symbols = result.Data.Select(s => new Symbol { Name = $"{s.BaseCurrency}{s.QuoteCurrency}", Exchange = Exchange.Kucoin, NameDelimiter = NameDelimiter, ExchangeSymbol = s.Symbol, NotionalMinimumValue = s.QuoteMinSize, BaseAsset = new Asset { Symbol = s.BaseCurrency }, QuoteAsset = new Asset { Symbol = s.QuoteCurrency }, Price = new InclusiveRange { Increment = s.PriceIncrement, Maximum = s.QuoteMaxSize, Minimum = s.PriceIncrement }, Quantity = new InclusiveRange { Increment = s.BaseIncrement, Maximum = s.BaseMaxSize, Minimum = s.BaseIncrement }, SymbolStatistics = new SymbolStats { Symbol = s.Symbol }, OrderTypes = new[] { OrderType.Limit, OrderType.Market, OrderType.StopLoss, OrderType.StopLossLimit, OrderType.TakeProfit, OrderType.TakeProfitLimit } }).ToList(); var currencies = await kucoinClient.GetCurrenciesAsync().ConfigureAwait(false);
public async Task <IEnumerable <Symbol> > GetSymbolsAsync(CancellationToken cancellationToken) { using (var kucoinClient = new KucoinClient()) { var result = await kucoinClient.GetSymbolsAsync().ConfigureAwait(false); var symbols = result.Data.Select(s => new Symbol { Name = $"{s.BaseCurrency}{s.QuoteCurrency}", Exchange = Exchange.Kucoin, NameDelimiter = "-", ExchangeSymbol = s.Symbol, NotionalMinimumValue = s.QuoteMinSize, BaseAsset = new Asset { Symbol = s.BaseCurrency }, QuoteAsset = new Asset { Symbol = s.QuoteCurrency }, Price = new InclusiveRange { Increment = s.PriceIncrement, Maximum = s.QuoteMaxSize, Minimum = s.PriceIncrement }, Quantity = new InclusiveRange { Increment = s.BaseIncrement, Maximum = s.BaseMaxSize, Minimum = s.BaseIncrement }, SymbolStatistics = new SymbolStats { Symbol = s.Symbol }, OrderTypes = new[] { OrderType.Limit, OrderType.Market, OrderType.StopLoss, OrderType.StopLossLimit, OrderType.TakeProfit, OrderType.TakeProfitLimit } }).ToList(); var currencies = await kucoinClient.GetCurrenciesAsync().ConfigureAwait(false); Asset f(Asset a, KucoinCurrency c) { a.Precision = c.Precision; return(a); }; (from s in symbols join c in currencies.Data on s.BaseAsset.Symbol equals c.Currency select f(s.BaseAsset, c)).ToList(); (from s in symbols join c in currencies.Data on s.QuoteAsset.Symbol equals c.Currency select f(s.QuoteAsset, c)).ToList(); return(symbols); } }