Merge pull request from HojouFotytu/develop

Bug Fixes
This commit is contained in:
HojouFotytu 2021-04-02 11:18:07 +09:00 committed by GitHub
commit b479b0bc30
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 108 additions and 36 deletions

View File

@ -716,7 +716,7 @@ namespace Core.Main
} }
else else
{ {
this.Log.DoLogInfo("No CoinMarketCap API KEY specified! You can't use CoinMarketCap in your settings.analyzer.json"); this.Log.DoLogInfo("No CoinMarketCap API KEY specified! That's ok, but you can't use CoinMarketCap in your settings.analyzer.json");
} }
// Check for CurrencyConverterApi Key // Check for CurrencyConverterApi Key
@ -726,7 +726,7 @@ namespace Core.Main
} }
else else
{ {
this.Log.DoLogInfo("No FreeCurrencyConverterApi KEY specified, you can only use USD; apply for a key at: https://freecurrencyrates.com/en"); this.Log.DoLogInfo("No FreeCurrencyConverterApi KEY specified. That's ok! But you can only use USD; apply for a key at: https://freecurrencyrates.com/en");
} }
} }
catch (System.NullReferenceException) catch (System.NullReferenceException)
@ -1234,7 +1234,7 @@ namespace Core.Main
} }
else else
{ {
this.Log.DoLogInfo("No CMC API-Key specified. No CMC Data will be pulled"); this.Log.DoLogInfo("No CMC API-Key specified. That's OK, but no CMC Data can be pulled.");
} }
if (this.PTMagicConfiguration.GeneralSettings.Application.Exchange.Equals("Bittrex", StringComparison.InvariantCultureIgnoreCase)) if (this.PTMagicConfiguration.GeneralSettings.Application.Exchange.Equals("Bittrex", StringComparison.InvariantCultureIgnoreCase))
@ -1525,12 +1525,22 @@ namespace Core.Main
int marketPairProcess = 1; int marketPairProcess = 1;
Dictionary<string, List<string>> matchedMarketTriggers = new Dictionary<string, List<string>>(); Dictionary<string, List<string>> matchedMarketTriggers = new Dictionary<string, List<string>>();
string mainMarket = this.LastRuntimeSummary.MainMarket;
// Loop through markets // Loop through markets
foreach (string marketPair in this.MarketList) foreach (string marketPair in this.MarketList)
{ {
this.Log.DoLogDebug("'" + marketPair + "' - Checking triggers (" + marketPairProcess.ToString() + "/" + this.MarketList.Count.ToString() + ")..."); this.Log.DoLogDebug("'" + marketPair + "' - Checking triggers (" + marketPairProcess.ToString() + "/" + this.MarketList.Count.ToString() + ")...");
string market = marketPair.Replace(mainMarket, "");
switch (this.PTMagicConfiguration.GeneralSettings.Application.Exchange.ToLower())
{
case "bittrex":
market = market.Replace("-", "");
break;
case "poloniex":
market = market.Replace("-", "");
break;
}
bool stopTriggers = false; bool stopTriggers = false;
// Loop through single market settings // Loop through single market settings
@ -1539,16 +1549,42 @@ namespace Core.Main
List<string> matchedSingleMarketTriggers = new List<string>(); List<string> matchedSingleMarketTriggers = new List<string>();
// Check ignore markets // Check ignore markets
List<string> ignoredMarkets = SystemHelper.ConvertTokenStringToList(marketSetting.IgnoredMarkets, ",");
if (ignoredMarkets.Any(im => marketPair.StartsWith(im, StringComparison.InvariantCultureIgnoreCase))) // Strip main markets from list, if exists
string ignored = marketSetting.IgnoredMarkets.ToUpper();
ignored = ignored.Replace(mainMarket, "");
switch (this.PTMagicConfiguration.GeneralSettings.Application.Exchange.ToLower())
{
case "bittrex":
ignored = ignored.Replace("-", "");
break;
case "poloniex":
ignored = ignored.Replace("_", "");
break;
}
List<string> ignoredMarkets = SystemHelper.ConvertTokenStringToList(ignored, ",");
if (ignoredMarkets.Contains(market))
{ {
this.Log.DoLogDebug("'" + marketPair + "' - Is ignored in '" + marketSetting.SettingName + "'."); this.Log.DoLogDebug("'" + marketPair + "' - Is ignored in '" + marketSetting.SettingName + "'.");
continue; continue;
} }
// Check allowed markets // Check allowed markets
List<string> allowedMarkets = SystemHelper.ConvertTokenStringToList(marketSetting.AllowedMarkets, ",");
if (allowedMarkets.Count > 0 && !allowedMarkets.Any(am => marketPair.StartsWith(am, StringComparison.InvariantCultureIgnoreCase))) // Strip main markets from list, if exists
string allowed = marketSetting.AllowedMarkets.ToUpper();
allowed = allowed.Replace(mainMarket, "");
switch (this.PTMagicConfiguration.GeneralSettings.Application.Exchange.ToLower())
{
case "bittrex":
allowed = allowed.Replace("-", "");
break;
case "poloniex":
allowed = allowed.Replace("_", "");
break;
}
List<string> allowedMarkets = SystemHelper.ConvertTokenStringToList(allowed, ",");
if (allowedMarkets.Count > 0 && !allowedMarkets.Contains(market))
{ {
this.Log.DoLogDebug("'" + marketPair + "' - Is not allowed in '" + marketSetting.SettingName + "'."); this.Log.DoLogDebug("'" + marketPair + "' - Is not allowed in '" + marketSetting.SettingName + "'.");
continue; continue;

View File

@ -308,16 +308,51 @@ namespace Core.MarketAnalyzer
} }
Market recentMarket; Market recentMarket;
string market = recentMarketPair.Value.Symbol.Replace(mainMarket, "");
string exchange = systemConfiguration.GeneralSettings.Application.Exchange.ToLower();
switch (exchange)
{
case "bittrex":
market = market.Replace("-", "");
break;
case "poloniex":
market = market.Replace("-", "");
break;
}
if (recentMarkets.TryGetValue(recentMarketPair.Key, out recentMarket)) if (recentMarkets.TryGetValue(recentMarketPair.Key, out recentMarket))
{ {
List<string> ignoredMarkets = SystemHelper.ConvertTokenStringToList(marketTrend.IgnoredMarkets, ","); // Strip main markets from lists, if exists
if (ignoredMarkets.Any(im => recentMarketPair.Value.Symbol.StartsWith(im, StringComparison.InvariantCultureIgnoreCase))) string ignored = marketTrend.IgnoredMarkets.ToUpper();
ignored = ignored.Replace(mainMarket, "");
switch (exchange)
{
case "bittrex":
ignored = ignored.Replace("-", "");
break;
case "poloniex":
ignored = ignored.Replace("_", "");
break;
}
List<string> ignoredMarkets = SystemHelper.ConvertTokenStringToList(ignored, ",");
if (ignoredMarkets.Contains(market))
{ {
log.DoLogDebug(platform + " - Market trend '" + marketTrend.Name + "' for '" + recentMarketPair.Key + "' is ignored in this trend."); log.DoLogDebug(platform + " - Market trend '" + marketTrend.Name + "' for '" + recentMarketPair.Key + "' is ignored in this trend.");
continue; continue;
} }
List<string> allowedMarkets = SystemHelper.ConvertTokenStringToList(marketTrend.AllowedMarkets, ","); // Strip main markets from lists, if exists
if (allowedMarkets.Count > 0 && !allowedMarkets.Any(am => recentMarketPair.Value.Symbol.StartsWith(am, StringComparison.InvariantCultureIgnoreCase))) string allowed = marketTrend.AllowedMarkets.ToUpper();
allowed = allowed.Replace(mainMarket, "");
switch (exchange)
{
case "bittrex":
allowed = allowed.Replace("-", "");
break;
case "poloniex":
allowed = allowed.Replace("_", "");
break;
}
List<string> allowedMarkets = SystemHelper.ConvertTokenStringToList(allowed, ",");
if (allowedMarkets.Count > 0 && !allowedMarkets.Contains(market))
{ {
log.DoLogDebug(platform + " - Market trend '" + marketTrend.Name + "' for '" + recentMarketPair.Key + "' is not allowed in this trend."); log.DoLogDebug(platform + " - Market trend '" + marketTrend.Name + "' for '" + recentMarketPair.Key + "' is not allowed in this trend.");
continue; continue;

View File

@ -364,12 +364,12 @@ namespace Core.MarketAnalyzer
ConcurrentDictionary<string, List<MarketTick>> marketTicks = new ConcurrentDictionary<string, List<MarketTick>>(); ConcurrentDictionary<string, List<MarketTick>> marketTicks = new ConcurrentDictionary<string, List<MarketTick>>();
int ParallelThrottle = 4; int ParallelThrottle = 4;
if (systemConfiguration.AnalyzerSettings.MarketAnalyzer.StoreDataMaxHours > 200) if (systemConfiguration.AnalyzerSettings.MarketAnalyzer.StoreDataMaxHours > 50)
{ {
ParallelThrottle = 2; ParallelThrottle = 2;
log.DoLogInfo("----------------------------------------------------------------------------"); log.DoLogInfo("----------------------------------------------------------------------------");
log.DoLogInfo("StoreDataMaxHours is greater than 200. Historical data requests will be"); log.DoLogInfo("StoreDataMaxHours is greater than 50. Historical data requests will be");
log.DoLogInfo("throttled to avoid exceeding exchange data request limits. This initial "); log.DoLogInfo("throttled to avoid exceeding exchange request limits. This initial ");
log.DoLogInfo("run could take more than 30 minutes. Please go outside for a walk..."); log.DoLogInfo("run could take more than 30 minutes. Please go outside for a walk...");
log.DoLogInfo("----------------------------------------------------------------------------"); log.DoLogInfo("----------------------------------------------------------------------------");
} }

View File

@ -361,11 +361,11 @@ namespace Core.MarketAnalyzer
ConcurrentDictionary<string, List<MarketTick>> marketTicks = new ConcurrentDictionary<string, List<MarketTick>>(); ConcurrentDictionary<string, List<MarketTick>> marketTicks = new ConcurrentDictionary<string, List<MarketTick>>();
int ParallelThrottle = 4; int ParallelThrottle = 4;
if (systemConfiguration.AnalyzerSettings.MarketAnalyzer.StoreDataMaxHours > 200) if (systemConfiguration.AnalyzerSettings.MarketAnalyzer.StoreDataMaxHours > 50)
{ {
ParallelThrottle = 2; ParallelThrottle = 2;
log.DoLogInfo("----------------------------------------------------------------------------"); log.DoLogInfo("----------------------------------------------------------------------------");
log.DoLogInfo("StoreDataMaxHours is greater than 200. Historical data requests will be"); log.DoLogInfo("StoreDataMaxHours is greater than 50. Historical data requests will be");
log.DoLogInfo("throttled to avoid exceeding exchange data request limits. This initial "); log.DoLogInfo("throttled to avoid exceeding exchange data request limits. This initial ");
log.DoLogInfo("run could take more than 30 minutes. Please go outside for a walk..."); log.DoLogInfo("run could take more than 30 minutes. Please go outside for a walk...");
log.DoLogInfo("----------------------------------------------------------------------------"); log.DoLogInfo("----------------------------------------------------------------------------");

View File

@ -183,7 +183,8 @@ else
<tr> <tr>
<td>@Core.Helper.SystemHelper.SplitCamelCase(marketTrend.Name)</td> <td>@Core.Helper.SystemHelper.SplitCamelCase(marketTrend.Name)</td>
<td class="text-right">@marketCountString</td> <td class="text-right">@marketCountString</td>
<td class="text-right">@Core.Helper.SystemHelper.GetProperDurationTime(marketTrend.TrendMinutes * 60, false)</td> @if (marketTrend.TrendThreshold == 0) <td class="text-right">@Core.Helper.SystemHelper.GetProperDurationTime(marketTrend.TrendMinutes * 60, false)</td>
@if (marketTrend.TrendThreshold == 0)
{ {
<td class="text-right">--</td> <td class="text-right">--</td>
} }
@ -275,10 +276,11 @@ else
<td class="text-right">@mps.LatestPrice.ToString("#,#0.00000000", new System.Globalization.CultureInfo("en-US")) @Model.Summary.MainMarket</td> <td class="text-right">@mps.LatestPrice.ToString("#,#0.00000000", new System.Globalization.CultureInfo("en-US")) @Model.Summary.MainMarket</td>
<td class="text-right">@Math.Round(mps.Latest24hVolume, 0).ToString("#,#0", new System.Globalization.CultureInfo("en-US")) @Model.Summary.MainMarket</td> <td class="text-right">@Math.Round(mps.Latest24hVolume, 0).ToString("#,#0", new System.Globalization.CultureInfo("en-US")) @Model.Summary.MainMarket</td>
@foreach (Core.Main.DataObjects.PTMagicData.MarketTrend marketTrend in marketTrends) { @foreach (Core.Main.DataObjects.PTMagicData.MarketTrend marketTrend in marketTrends) {
if (mps.MarketTrendChanges.ContainsKey(marketTrend.Name)) { if (mps.MarketTrendChanges.ContainsKey(marketTrend.Name))
{
marketTrendsDisplayed++; marketTrendsDisplayed++;
string trendChangeOutput = mps.MarketTrendChanges[marketTrend.Name].ToString("#,#0.00", new System.Globalization.CultureInfo("en-US")); string trendChangeOutput = mps.MarketTrendChanges[marketTrend.Name].ToString("#,#0.00", new System.Globalization.CultureInfo("en-US"));
if ((mps.MarketTrendChanges[marketTrend.Name] > marketTrend.TrendThreshold) || (mps.MarketTrendChanges[marketTrend.Name] > marketTrend.TrendThreshold) ) if (marketTrend.TrendThreshold != 0 && Math.Abs(mps.MarketTrendChanges[marketTrend.Name]) > marketTrend.TrendThreshold)
{ {
<td class="text-right text-autocolor-saw"><i class="fa fa-ban text-muted" data-toggle="tooltip" data-placement="top" title="This coin has been excluded from the Market Trend Averages for this timeframe due to your Threshold setting."></i>&nbsp; @trendChangeOutput%</td> <td class="text-right text-autocolor-saw"><i class="fa fa-ban text-muted" data-toggle="tooltip" data-placement="top" title="This coin has been excluded from the Market Trend Averages for this timeframe due to your Threshold setting."></i>&nbsp; @trendChangeOutput%</td>
} }
@ -286,7 +288,6 @@ else
{ {
<td class="text-right text-autocolor-saw">@trendChangeOutput%</td> <td class="text-right text-autocolor-saw">@trendChangeOutput%</td>
} }
} }
} }
@for (int i = 0; i < marketTrends.Count - marketTrendsDisplayed; i++) { @for (int i = 0; i < marketTrends.Count - marketTrendsDisplayed; i++) {

View File

@ -6,7 +6,7 @@ using Core.Helper;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
[assembly: AssemblyVersion("2.5.8")] [assembly: AssemblyVersion("2.5.9")]
[assembly: AssemblyProduct("PT Magic")] [assembly: AssemblyProduct("PT Magic")]
namespace PTMagic namespace PTMagic