Merge pull request #223 from djbadders/develop

Fixed KeyNotFoundException when building trends
This commit is contained in:
HojouFotytu 2020-11-19 10:39:01 +09:00 committed by GitHub
commit 6ec178c3a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 29 additions and 14 deletions

View File

@ -335,8 +335,10 @@ namespace Core.MarketAnalyzer
}
}
Market recentMarket = recentMarkets[recentMarketPair.Key];
Market recentMarket;
if (recentMarkets.TryGetValue(recentMarketPair.Key, out recentMarket))
{
List<string> ignoredMarkets = SystemHelper.ConvertTokenStringToList(marketTrend.IgnoredMarkets, ",");
if (ignoredMarkets.Contains(recentMarketPair.Value.Symbol))
{
@ -350,10 +352,17 @@ namespace Core.MarketAnalyzer
log.DoLogDebug(platform + " - Market trend '" + marketTrend.Name + "' for '" + recentMarketPair.Key + "' is not allowed in this trend.");
continue;
}
}
else
{
// No recent market data
log.DoLogDebug(platform + " - Market trend '" + marketTrend.Name + "' for '" + recentMarketPair.Key + "' has no recent market trend data.");
continue;
}
Market trendMarket = trendMarkets[recentMarketPair.Key];
Market trendMarket;
if (trendMarket != null)
if (trendMarkets.TryGetValue(recentMarketPair.Key, out trendMarket))
{
double recentMarketPrice = recentMarket.Price;
double trendMarketPrice = trendMarket.Price;
@ -384,6 +393,12 @@ namespace Core.MarketAnalyzer
marketCount++;
}
else
{
// No data market trend data
log.DoLogDebug(platform + " - Market trend '" + marketTrend.Name + "' for '" + recentMarketPair.Key + "' has no market trend data.");
continue;
}
}
}