public async Task PreviewBotsCreation(int numberOfBots, BotSettingViewModel settings, CancellationToken cancellationToken) { var existingBots = await GetAllBots(); var blacklistedPairs = await RetrieveBlacklistedPairs(); int created = 0; _logger.LogInformation($"Retrieving pairs from {_exchange.Name}..."); var prices = await _exchange.GetAllPairsByQuoteCurrency(settings.QuoteCurrency); _logger.LogInformation($"{prices.Count} Pairs for {settings.QuoteCurrency.ToUpper()} found"); foreach (var pair in prices.OrderByDescending(x => x.TotalTradedQuoteAssetVolume)) { if (cancellationToken.IsCancellationRequested) { _logger.LogInformation($"Operation cancelled!"); break; } var symbol = TransformPairTo3CommasSymbolString(pair.QuoteCurrency, pair.BaseCurrency); if (SymbolShouldBeSkipped(symbol, settings.SkipExistingPairs, settings.SkipBaseStablecoin, settings.Strategy, pair, existingBots, settings.SkipBlacklistedPairs, blacklistedPairs)) { continue; } var marketData = await _xCommasClient.GetCurrencyRateAsync(symbol); if (!marketData.IsSuccess) { if (!marketData.Error.StartsWith("Unknown pair")) { _logger.LogInformation($"Skipped Pair {symbol}. Reason: '{marketData.Error}'"); } continue; } var botName = NameHelper.GenerateBotName(settings.Botname, symbol, settings.Strategy); _logger.LogInformation($"Bot to be created: '{botName}'"); if (settings.BuyBaseCurrency && settings.BaseCurrencyToBuy > 0) { _logger.LogInformation($"Market Buy Order to be placed: {settings.BaseCurrencyToBuy} {pair.QuoteCurrency}"); } created++; if (created == numberOfBots) { break; } } _logger.LogInformation($"{created} bots to be created"); }