From ace96a632bf6c561a24cf5a0c87fdb24d37c6d5e Mon Sep 17 00:00:00 2001 From: HojouFotytu <36724681+HojouFotytu@users.noreply.github.com> Date: Thu, 25 Mar 2021 22:34:53 +0900 Subject: [PATCH 1/4] Ignored/Allowed in SMS --- Core/Main/PTMagic.cs | 4 ++-- Core/MarketAnalyzer/BinanceFutures.cs | 5 +---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/Core/Main/PTMagic.cs b/Core/Main/PTMagic.cs index c585351..4caa49a 100644 --- a/Core/Main/PTMagic.cs +++ b/Core/Main/PTMagic.cs @@ -1518,7 +1518,7 @@ namespace Core.Main // Check ignore markets List ignoredMarkets = SystemHelper.ConvertTokenStringToList(marketSetting.IgnoredMarkets, ","); - if (ignoredMarkets.Contains(marketPair)) + if (ignoredMarkets.Any(marketPair.Contains)) { this.Log.DoLogDebug("'" + marketPair + "' - Is ignored in '" + marketSetting.SettingName + "'."); continue; @@ -1526,7 +1526,7 @@ namespace Core.Main // Check allowed markets List allowedMarkets = SystemHelper.ConvertTokenStringToList(marketSetting.AllowedMarkets, ","); - if (allowedMarkets.Count > 0 && !allowedMarkets.Contains(marketPair)) + if (allowedMarkets.Count > 0 && !allowedMarkets.Any(marketPair.Contains)) { this.Log.DoLogDebug("'" + marketPair + "' - Is not allowed in '" + marketSetting.SettingName + "'."); continue; diff --git a/Core/MarketAnalyzer/BinanceFutures.cs b/Core/MarketAnalyzer/BinanceFutures.cs index de1f962..1ba75a6 100644 --- a/Core/MarketAnalyzer/BinanceFutures.cs +++ b/Core/MarketAnalyzer/BinanceFutures.cs @@ -74,9 +74,7 @@ namespace Core.MarketAnalyzer //New variables for filtering out bad markets float marketLastPrice = currencyTicker["lastPrice"].ToObject(); float marketVolume = currencyTicker["volume"].ToObject(); - if (marketName.EndsWith(mainMarket, StringComparison.InvariantCultureIgnoreCase)) - { - if (marketLastPrice > 0 && marketVolume > 0) + if (marketLastPrice > 0 && marketVolume > 0) { // Set last values in case any error occurs @@ -100,7 +98,6 @@ namespace Core.MarketAnalyzer //Let the user know that the problem market was ignored. log.DoLogInfo("BinanceFutures - Ignoring bad market data for " + marketName); } - } } BinanceFutures.CheckFirstSeenDates(markets, ref marketInfos, systemConfiguration, log); From 46ce12bd48653b31a07f57e298f48b92c14f6110 Mon Sep 17 00:00:00 2001 From: HojouFotytu <36724681+HojouFotytu@users.noreply.github.com> Date: Mon, 29 Mar 2021 01:46:33 +0900 Subject: [PATCH 2/4] Ignored/Allowed changes --- Core/Main/PTMagic.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Core/Main/PTMagic.cs b/Core/Main/PTMagic.cs index 4caa49a..233a625 100644 --- a/Core/Main/PTMagic.cs +++ b/Core/Main/PTMagic.cs @@ -1526,7 +1526,7 @@ namespace Core.Main // Check allowed markets List allowedMarkets = SystemHelper.ConvertTokenStringToList(marketSetting.AllowedMarkets, ","); - if (allowedMarkets.Count > 0 && !allowedMarkets.Any(marketPair.Contains)) + if (allowedMarkets.Count > 0 && !allowedMarkets.Any(am => marketPair.StartsWith(am, StringComparison.InvariantCultureIgnoreCase))) { this.Log.DoLogDebug("'" + marketPair + "' - Is not allowed in '" + marketSetting.SettingName + "'."); continue; @@ -1534,7 +1534,7 @@ namespace Core.Main // Check ignore global settings List ignoredGlobalSettings = SystemHelper.ConvertTokenStringToList(marketSetting.IgnoredGlobalSettings, ","); - if (ignoredGlobalSettings.Contains(this.ActiveSettingName)) + if (ignoredMarkets.Any(im => marketPair.StartsWith(im, StringComparison.InvariantCultureIgnoreCase))) { this.Log.DoLogDebug("'" + marketPair + "' - '" + this.ActiveSettingName + "' - Is ignored in '" + marketSetting.SettingName + "'."); continue; From 01aa86c076d3208b8846c9d6aba952c124710ae7 Mon Sep 17 00:00:00 2001 From: HojouFotytu <36724681+HojouFotytu@users.noreply.github.com> Date: Mon, 29 Mar 2021 02:31:25 +0900 Subject: [PATCH 3/4] BinanceFutures Quarterly Ignore --- Core/Main/PTMagic.cs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/Core/Main/PTMagic.cs b/Core/Main/PTMagic.cs index 233a625..27b8baf 100644 --- a/Core/Main/PTMagic.cs +++ b/Core/Main/PTMagic.cs @@ -903,6 +903,30 @@ namespace Core.Main // Check for single market trend triggers this.ApplySingleMarketSettings(); + // Ignore quarterly futures + if (this.PTMagicConfiguration.GeneralSettings.Application.Exchange.Equals("BinanceFutures", StringComparison.InvariantCultureIgnoreCase)) + { + var quarterlyFuturesLines = new Dictionary(); + + // Find all quarterly futures pairs + var results = this.MarketList.FindAll(m => m.Contains("_", StringComparison.InvariantCultureIgnoreCase)); + + // Create the settings lines to disable trading + if (results.Count > 0) + { + this.PairsLines.AddRange(new string[] { + "", + "# BinanceFutures Quarterly Contracts - Ignore list:", + "###################################################" + }); + + foreach (var marketPair in results) + { + this.PairsLines.Add(String.Format("{0}_trading_enabled = false", marketPair)); + } + } + } + // Save new properties to Profit Trailer this.SaveProfitTrailerProperties(); From 458b51898db50b85bf1f6a052a2892b77de39799 Mon Sep 17 00:00:00 2001 From: HojouFotytu <36724681+HojouFotytu@users.noreply.github.com> Date: Mon, 29 Mar 2021 03:03:23 +0900 Subject: [PATCH 4/4] Remove unnecessary line --- Core/Main/PTMagic.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/Core/Main/PTMagic.cs b/Core/Main/PTMagic.cs index 27b8baf..fbd5395 100644 --- a/Core/Main/PTMagic.cs +++ b/Core/Main/PTMagic.cs @@ -906,8 +906,6 @@ namespace Core.Main // Ignore quarterly futures if (this.PTMagicConfiguration.GeneralSettings.Application.Exchange.Equals("BinanceFutures", StringComparison.InvariantCultureIgnoreCase)) { - var quarterlyFuturesLines = new Dictionary(); - // Find all quarterly futures pairs var results = this.MarketList.FindAll(m => m.Contains("_", StringComparison.InvariantCultureIgnoreCase));