Fixed issue where trend data got stuck
This commit is contained in:
parent
0f2cb35fc7
commit
4ba1725d6a
|
@ -337,55 +337,52 @@ namespace Core.MarketAnalyzer
|
|||
|
||||
Market recentMarket = recentMarkets[recentMarketPair.Key];
|
||||
|
||||
if (trendMarkets.ContainsKey(recentMarketPair.Key))
|
||||
List<string> ignoredMarkets = SystemHelper.ConvertTokenStringToList(marketTrend.IgnoredMarkets, ",");
|
||||
if (ignoredMarkets.Contains(recentMarketPair.Value.Symbol))
|
||||
{
|
||||
List<string> ignoredMarkets = SystemHelper.ConvertTokenStringToList(marketTrend.IgnoredMarkets, ",");
|
||||
if (ignoredMarkets.Contains(recentMarketPair.Value.Symbol))
|
||||
log.DoLogDebug(platform + " - Market trend '" + marketTrend.Name + "' for '" + recentMarketPair.Key + "' is ignored in this trend.");
|
||||
continue;
|
||||
}
|
||||
|
||||
List<string> allowedMarkets = SystemHelper.ConvertTokenStringToList(marketTrend.AllowedMarkets, ",");
|
||||
if (allowedMarkets.Count > 0 && !allowedMarkets.Contains(recentMarketPair.Value.Symbol))
|
||||
{
|
||||
log.DoLogDebug(platform + " - Market trend '" + marketTrend.Name + "' for '" + recentMarketPair.Key + "' is not allowed in this trend.");
|
||||
continue;
|
||||
}
|
||||
|
||||
Market trendMarket = trendMarkets[recentMarketPair.Key];
|
||||
|
||||
if (trendMarket != null)
|
||||
{
|
||||
double recentMarketPrice = recentMarket.Price;
|
||||
double trendMarketPrice = trendMarket.Price;
|
||||
|
||||
if (!platform.Equals("CoinMarketCap", StringComparison.InvariantCulture) && marketTrend.TrendCurrency.Equals("Fiat", StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
log.DoLogDebug(platform + " - Market trend '" + marketTrend.Name + "' for '" + recentMarketPair.Key + "' is ignored in this trend.");
|
||||
continue;
|
||||
}
|
||||
|
||||
List<string> allowedMarkets = SystemHelper.ConvertTokenStringToList(marketTrend.AllowedMarkets, ",");
|
||||
if (allowedMarkets.Count > 0 && !allowedMarkets.Contains(recentMarketPair.Value.Symbol))
|
||||
{
|
||||
log.DoLogDebug(platform + " - Market trend '" + marketTrend.Name + "' for '" + recentMarketPair.Key + "' is not allowed in this trend.");
|
||||
continue;
|
||||
}
|
||||
|
||||
Market trendMarket = trendMarkets[recentMarketPair.Key];
|
||||
|
||||
if (trendMarket != null)
|
||||
{
|
||||
double recentMarketPrice = recentMarket.Price;
|
||||
double trendMarketPrice = trendMarket.Price;
|
||||
|
||||
if (!platform.Equals("CoinMarketCap", StringComparison.InvariantCulture) && marketTrend.TrendCurrency.Equals("Fiat", StringComparison.InvariantCultureIgnoreCase))
|
||||
if (recentMarket.MainCurrencyPriceUSD > 0 && trendMarket.MainCurrencyPriceUSD > 0)
|
||||
{
|
||||
if (recentMarket.MainCurrencyPriceUSD > 0 && trendMarket.MainCurrencyPriceUSD > 0)
|
||||
{
|
||||
recentMarketPrice = recentMarketPrice * recentMarket.MainCurrencyPriceUSD;
|
||||
trendMarketPrice = trendMarketPrice * trendMarket.MainCurrencyPriceUSD;
|
||||
}
|
||||
recentMarketPrice = recentMarketPrice * recentMarket.MainCurrencyPriceUSD;
|
||||
trendMarketPrice = trendMarketPrice * trendMarket.MainCurrencyPriceUSD;
|
||||
}
|
||||
|
||||
double trendMarketChange = (recentMarketPrice - trendMarketPrice) / trendMarketPrice * 100;
|
||||
|
||||
MarketTrendChange mtc = new MarketTrendChange();
|
||||
mtc.MarketTrendName = marketTrend.Name;
|
||||
mtc.TrendMinutes = marketTrend.TrendMinutes;
|
||||
mtc.TrendChange = trendMarketChange;
|
||||
mtc.Market = recentMarket.Name;
|
||||
mtc.LastPrice = recentMarket.Price;
|
||||
mtc.Volume24h = recentMarket.Volume24h;
|
||||
mtc.TrendDateTime = DateTime.UtcNow;
|
||||
|
||||
result.Add(mtc);
|
||||
|
||||
log.DoLogDebug(platform + " - Market trend '" + marketTrend.Name + "' for '" + recentMarketPair.Key + "' (Vol. " + recentMarket.Volume24h.ToString("#,#0.00") + ") is " + trendMarketChange.ToString("#,#0.00") + "% in " + SystemHelper.GetProperDurationTime(marketTrend.TrendMinutes * 60).ToLower() + ".");
|
||||
|
||||
marketCount++;
|
||||
}
|
||||
|
||||
double trendMarketChange = (recentMarketPrice - trendMarketPrice) / trendMarketPrice * 100;
|
||||
|
||||
MarketTrendChange mtc = new MarketTrendChange();
|
||||
mtc.MarketTrendName = marketTrend.Name;
|
||||
mtc.TrendMinutes = marketTrend.TrendMinutes;
|
||||
mtc.TrendChange = trendMarketChange;
|
||||
mtc.Market = recentMarket.Name;
|
||||
mtc.LastPrice = recentMarket.Price;
|
||||
mtc.Volume24h = recentMarket.Volume24h;
|
||||
mtc.TrendDateTime = DateTime.UtcNow;
|
||||
|
||||
result.Add(mtc);
|
||||
|
||||
log.DoLogDebug(platform + " - Market trend '" + marketTrend.Name + "' for '" + recentMarketPair.Key + "' (Vol. " + recentMarket.Volume24h.ToString("#,#0.00") + ") is " + trendMarketChange.ToString("#,#0.00") + "% in " + SystemHelper.GetProperDurationTime(marketTrend.TrendMinutes * 60).ToLower() + ".");
|
||||
|
||||
marketCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue