public static async Task Main(string[] args) { var builder = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true); var configuration = builder.Build(); var sw = new Stopwatch(); sw.Start(); using (var mservice = new MongoRepository <Token>()) { var tokens = mservice.GetAllAsync().Result; foreach (var token in tokens) { if (string.IsNullOrEmpty(token.CmcName)) { continue; } Console.WriteLine($"Getting the current price for token {token.Symbol}."); try { Pricing.PriceService.GetPriceLastAsync(token.CmcName, token.Symbol).Wait(); } catch (Exception ex) { Console.WriteLine($"Error while getting the current price for token {token.Symbol}. {ex.Message}"); } } Console.WriteLine($"Getting current the current price for the main currency."); try { Pricing.PriceService.GetPriceLastAsync(configuration["AppSettings:MainCurrencyName"].ToLower(), configuration["AppSettings:MainCurrencySymbol"]).Wait(); } catch (Exception ex) { Console.WriteLine($"Error while getting the current price for the main currency. {ex.Message}"); } } try { var synchronizationService = new SynchronizationService(); await synchronizationService.GetNewBlockSyncRequests(); await ProcessPendingBlockSyncRequests(); await synchronizationService.SyncPendingTransactionReceipts(); } catch (Exception ex) { Console.WriteLine(ex.Message); } finally { sw.Stop(); } Console.WriteLine($"Finished in {sw.ElapsedMilliseconds} ms."); }