From 10eac6586afebc9ba0b54fe02ac53bf40941a540 Mon Sep 17 00:00:00 2001
From: HojouFotytu <36724681+HojouFotytu@users.noreply.github.com>
Date: Tue, 30 Mar 2021 14:30:17 +0900
Subject: [PATCH 1/6] TrendThreshold Display
---
Monitor/Pages/MarketAnalyzer.cshtml | 37 +++++++++++++++--------------
1 file changed, 19 insertions(+), 18 deletions(-)
diff --git a/Monitor/Pages/MarketAnalyzer.cshtml b/Monitor/Pages/MarketAnalyzer.cshtml
index 37a7ff2..15bd1d1 100644
--- a/Monitor/Pages/MarketAnalyzer.cshtml
+++ b/Monitor/Pages/MarketAnalyzer.cshtml
@@ -183,14 +183,15 @@ else
@Core.Helper.SystemHelper.SplitCamelCase(marketTrend.Name) |
@marketCountString |
- @Core.Helper.SystemHelper.GetProperDurationTime(marketTrend.TrendMinutes * 60, false) | @if (marketTrend.TrendThreshold == 0)
- {
- -- |
- }
- else
- {
- @marketTrend.TrendThreshold |
- }
+ @Core.Helper.SystemHelper.GetProperDurationTime(marketTrend.TrendMinutes * 60, false) |
+ @if (marketTrend.TrendThreshold == 0)
+ {
+ -- |
+ }
+ else
+ {
+ @marketTrend.TrendThreshold |
+ }
@trendChangeOutput% |
}
@@ -275,18 +276,18 @@ else
@mps.LatestPrice.ToString("#,#0.00000000", new System.Globalization.CultureInfo("en-US")) @Model.Summary.MainMarket |
@Math.Round(mps.Latest24hVolume, 0).ToString("#,#0", new System.Globalization.CultureInfo("en-US")) @Model.Summary.MainMarket |
@foreach (Core.Main.DataObjects.PTMagicData.MarketTrend marketTrend in marketTrends) {
- if (mps.MarketTrendChanges.ContainsKey(marketTrend.Name)) {
+ if (mps.MarketTrendChanges.ContainsKey(marketTrend.Name))
+ {
marketTrendsDisplayed++;
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) )
- {
- @trendChangeOutput% |
- }
- else
- {
- @trendChangeOutput% |
- }
-
+ if (marketTrend.TrendThreshold != 0 && Math.Abs(mps.MarketTrendChanges[marketTrend.Name]) > marketTrend.TrendThreshold)
+ {
+ @trendChangeOutput% |
+ }
+ else
+ {
+ @trendChangeOutput% |
+ }
}
}
@for (int i = 0; i < marketTrends.Count - marketTrendsDisplayed; i++) {
From 7ae2e5efddf6e3f6906da7839a08c79ca630b0f4 Mon Sep 17 00:00:00 2001
From: HojouFotytu <36724681+HojouFotytu@users.noreply.github.com>
Date: Tue, 30 Mar 2021 15:15:25 +0900
Subject: [PATCH 2/6] Binance API throttle
---
Core/MarketAnalyzer/Binance.cs | 6 +++---
Core/MarketAnalyzer/BinanceFutures.cs | 4 ++--
PTMagic/Program.cs | 2 +-
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/Core/MarketAnalyzer/Binance.cs b/Core/MarketAnalyzer/Binance.cs
index 8eae0a7..b2e6c68 100644
--- a/Core/MarketAnalyzer/Binance.cs
+++ b/Core/MarketAnalyzer/Binance.cs
@@ -364,12 +364,12 @@ namespace Core.MarketAnalyzer
ConcurrentDictionary> marketTicks = new ConcurrentDictionary>();
int ParallelThrottle = 4;
- if (systemConfiguration.AnalyzerSettings.MarketAnalyzer.StoreDataMaxHours > 200)
+ if (systemConfiguration.AnalyzerSettings.MarketAnalyzer.StoreDataMaxHours > 50)
{
ParallelThrottle = 2;
log.DoLogInfo("----------------------------------------------------------------------------");
- log.DoLogInfo("StoreDataMaxHours is greater than 200. Historical data requests will be");
- log.DoLogInfo("throttled to avoid exceeding exchange data request limits. This initial ");
+ log.DoLogInfo("StoreDataMaxHours is greater than 50. Historical data requests will be");
+ 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("----------------------------------------------------------------------------");
}
diff --git a/Core/MarketAnalyzer/BinanceFutures.cs b/Core/MarketAnalyzer/BinanceFutures.cs
index 1ba75a6..52b99e2 100644
--- a/Core/MarketAnalyzer/BinanceFutures.cs
+++ b/Core/MarketAnalyzer/BinanceFutures.cs
@@ -361,11 +361,11 @@ namespace Core.MarketAnalyzer
ConcurrentDictionary> marketTicks = new ConcurrentDictionary>();
int ParallelThrottle = 4;
- if (systemConfiguration.AnalyzerSettings.MarketAnalyzer.StoreDataMaxHours > 200)
+ if (systemConfiguration.AnalyzerSettings.MarketAnalyzer.StoreDataMaxHours > 50)
{
ParallelThrottle = 2;
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("run could take more than 30 minutes. Please go outside for a walk...");
log.DoLogInfo("----------------------------------------------------------------------------");
diff --git a/PTMagic/Program.cs b/PTMagic/Program.cs
index 6139695..fbebbf2 100644
--- a/PTMagic/Program.cs
+++ b/PTMagic/Program.cs
@@ -6,7 +6,7 @@ using Core.Helper;
using Microsoft.Extensions.DependencyInjection;
-[assembly: AssemblyVersion("2.5.8")]
+[assembly: AssemblyVersion("2.5.9")]
[assembly: AssemblyProduct("PT Magic")]
namespace PTMagic
From ab294a3a3c41ee126ab5a9b58b27f02001cf046e Mon Sep 17 00:00:00 2001
From: HojouFotytu <36724681+HojouFotytu@users.noreply.github.com>
Date: Tue, 30 Mar 2021 15:34:05 +0900
Subject: [PATCH 3/6] CMC API key message
---
Core/Main/PTMagic.cs | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/Core/Main/PTMagic.cs b/Core/Main/PTMagic.cs
index 6dcf6e1..d79e993 100644
--- a/Core/Main/PTMagic.cs
+++ b/Core/Main/PTMagic.cs
@@ -716,7 +716,7 @@ namespace Core.Main
}
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
@@ -726,7 +726,7 @@ namespace Core.Main
}
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)
@@ -1234,7 +1234,7 @@ namespace Core.Main
}
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))
From 15fc61a2426b0de4f09424763ec0eeb2a7790c0d Mon Sep 17 00:00:00 2001
From: HojouFotytu <36724681+HojouFotytu@users.noreply.github.com>
Date: Tue, 30 Mar 2021 23:29:49 +0900
Subject: [PATCH 4/6] ignored/allowed precise match
---
Core/Main/PTMagic.cs | 46 +++++++++++++++++++++++++++++++++++++++-----
1 file changed, 41 insertions(+), 5 deletions(-)
diff --git a/Core/Main/PTMagic.cs b/Core/Main/PTMagic.cs
index d79e993..3c5e3a8 100644
--- a/Core/Main/PTMagic.cs
+++ b/Core/Main/PTMagic.cs
@@ -1525,12 +1525,22 @@ namespace Core.Main
int marketPairProcess = 1;
Dictionary> matchedMarketTriggers = new Dictionary>();
+ string mainMarket = this.LastRuntimeSummary.MainMarket;
// Loop through markets
foreach (string marketPair in this.MarketList)
{
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;
// Loop through single market settings
@@ -1539,16 +1549,42 @@ namespace Core.Main
List matchedSingleMarketTriggers = new List();
// Check ignore markets
- List 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 ignoredMarkets = SystemHelper.ConvertTokenStringToList(ignored, ",");
+ if (ignoredMarkets.Contains(market))
{
this.Log.DoLogDebug("'" + marketPair + "' - Is ignored in '" + marketSetting.SettingName + "'.");
continue;
}
// Check allowed markets
- List 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.IgnoredMarkets.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 allowedMarkets = SystemHelper.ConvertTokenStringToList(allowed, ",");
+ if (allowedMarkets.Count > 0 && !allowedMarkets.Contains(market))
{
this.Log.DoLogDebug("'" + marketPair + "' - Is not allowed in '" + marketSetting.SettingName + "'.");
continue;
From 1693b00cf48dada0b3f039cc331fb505593ad329 Mon Sep 17 00:00:00 2001
From: HojouFotytu <36724681+HojouFotytu@users.noreply.github.com>
Date: Tue, 30 Mar 2021 23:39:27 +0900
Subject: [PATCH 5/6] Market trends ignore/allowed
---
Core/MarketAnalyzer/BaseAnalyzer.cs | 43 ++++++++++++++++++++++++++---
1 file changed, 39 insertions(+), 4 deletions(-)
diff --git a/Core/MarketAnalyzer/BaseAnalyzer.cs b/Core/MarketAnalyzer/BaseAnalyzer.cs
index 00d784b..4f0ff6d 100644
--- a/Core/MarketAnalyzer/BaseAnalyzer.cs
+++ b/Core/MarketAnalyzer/BaseAnalyzer.cs
@@ -308,16 +308,51 @@ namespace Core.MarketAnalyzer
}
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))
{
- List ignoredMarkets = SystemHelper.ConvertTokenStringToList(marketTrend.IgnoredMarkets, ",");
- if (ignoredMarkets.Any(im => recentMarketPair.Value.Symbol.StartsWith(im, StringComparison.InvariantCultureIgnoreCase)))
+ // Strip main markets from lists, if exists
+ string ignored = marketTrend.IgnoredMarkets.ToUpper();
+ ignored = ignored.Replace(mainMarket, "");
+ switch (exchange)
+ {
+ case "bittrex":
+ ignored = ignored.Replace("-", "");
+ break;
+ case "poloniex":
+ ignored = ignored.Replace("_", "");
+ break;
+ }
+ List ignoredMarkets = SystemHelper.ConvertTokenStringToList(ignored, ",");
+ if (ignoredMarkets.Contains(market))
{
log.DoLogDebug(platform + " - Market trend '" + marketTrend.Name + "' for '" + recentMarketPair.Key + "' is ignored in this trend.");
continue;
}
- List allowedMarkets = SystemHelper.ConvertTokenStringToList(marketTrend.AllowedMarkets, ",");
- if (allowedMarkets.Count > 0 && !allowedMarkets.Any(am => recentMarketPair.Value.Symbol.StartsWith(am, StringComparison.InvariantCultureIgnoreCase)))
+ // Strip main markets from lists, if exists
+ string allowed = marketTrend.AllowedMarkets.ToUpper();
+ allowed = allowed.Replace(mainMarket, "");
+ switch (exchange)
+ {
+ case "bittrex":
+ allowed = allowed.Replace("-", "");
+ break;
+ case "poloniex":
+ allowed = allowed.Replace("_", "");
+ break;
+ }
+ List 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.");
continue;
From f3568fa7bf838ddda62444a916ee4e910802f4e1 Mon Sep 17 00:00:00 2001
From: HojouFotytu <36724681+HojouFotytu@users.noreply.github.com>
Date: Wed, 31 Mar 2021 00:02:06 +0900
Subject: [PATCH 6/6] typo
---
Core/Main/PTMagic.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Core/Main/PTMagic.cs b/Core/Main/PTMagic.cs
index 3c5e3a8..9600417 100644
--- a/Core/Main/PTMagic.cs
+++ b/Core/Main/PTMagic.cs
@@ -1572,7 +1572,7 @@ namespace Core.Main
// Check allowed markets
// Strip main markets from list, if exists
- string allowed = marketSetting.IgnoredMarkets.ToUpper();
+ string allowed = marketSetting.AllowedMarkets.ToUpper();
allowed = allowed.Replace(mainMarket, "");
switch (this.PTMagicConfiguration.GeneralSettings.Application.Exchange.ToLower())
{