diff --git a/Core/MarketAnalyzer/Binance.cs b/Core/MarketAnalyzer/Binance.cs index 519c3c6..bb7337a 100644 --- a/Core/MarketAnalyzer/Binance.cs +++ b/Core/MarketAnalyzer/Binance.cs @@ -167,6 +167,7 @@ namespace Core.MarketAnalyzer log.DoLogInfo("Binance - Checking first seen dates for " + markets.Count + " markets. This may take a while..."); int marketsChecked = 0; + foreach (string key in markets.Keys) { // Save market info diff --git a/Core/MarketAnalyzer/Bittrex.cs b/Core/MarketAnalyzer/Bittrex.cs index f747947..5343ac8 100644 --- a/Core/MarketAnalyzer/Bittrex.cs +++ b/Core/MarketAnalyzer/Bittrex.cs @@ -8,6 +8,8 @@ using Core.Helper; using Core.Main.DataObjects.PTMagicData; using Newtonsoft.Json; using Core.ProfitTrailer; +using System.Threading; +using System.Threading.Tasks; namespace Core.MarketAnalyzer { @@ -232,7 +234,10 @@ namespace Core.MarketAnalyzer // Get Ticks for all markets log.DoLogDebug("Bittrex - Getting ticks for '" + markets.Count + "' markets"); Dictionary> marketTicks = new Dictionary>(); - foreach (string key in markets.Keys) + + Parallel.ForEach( markets.Keys, + new ParallelOptions { MaxDegreeOfParallelism = 5 }, + (key) => { marketTicks.Add(key, Bittrex.GetMarketTicks(key, systemConfiguration, log)); @@ -240,7 +245,7 @@ namespace Core.MarketAnalyzer { log.DoLogInfo("Bittrex - No worries, I am still alive... " + marketTicks.Count + "/" + markets.Count + " markets done..."); } - } + }); log.DoLogInfo("Bittrex - Ticks completed."); diff --git a/Core/MarketAnalyzer/Poloniex.cs b/Core/MarketAnalyzer/Poloniex.cs index 69ea1f8..b3ebedb 100644 --- a/Core/MarketAnalyzer/Poloniex.cs +++ b/Core/MarketAnalyzer/Poloniex.cs @@ -8,6 +8,8 @@ using Core.Helper; using Core.Main.DataObjects.PTMagicData; using Newtonsoft.Json; using Core.ProfitTrailer; +using System.Threading; +using System.Threading.Tasks; namespace Core.MarketAnalyzer { @@ -266,7 +268,10 @@ namespace Core.MarketAnalyzer // Get Ticks for all markets log.DoLogDebug("Poloniex - Getting ticks for '" + markets.Count + "' markets"); Dictionary> marketTicks = new Dictionary>(); - foreach (string key in markets.Keys) + + Parallel.ForEach( markets.Keys, + new ParallelOptions { MaxDegreeOfParallelism = 5 }, + (key) => { marketTicks.Add(key, Poloniex.GetMarketTicks(key, systemConfiguration, log)); @@ -274,7 +279,7 @@ namespace Core.MarketAnalyzer { log.DoLogInfo("Poloniex - No worries, I am still alive... " + marketTicks.Count + "/" + markets.Count + " markets done..."); } - } + }); log.DoLogInfo("Poloniex - Ticks completed.");