From 7010e5bf7a06e71b6393993f3e9332cd35a9c934 Mon Sep 17 00:00:00 2001 From: HojouFotytu <36724681+HojouFotytu@users.noreply.github.com> Date: Fri, 16 Apr 2021 12:26:31 +0900 Subject: [PATCH 1/3] fix missing quotes in default analyzer --- .../settings.analyzer.json | 90 +++++++++---------- .../DevSettings/settings.analyzer.json | 50 +++++------ 2 files changed, 70 insertions(+), 70 deletions(-) diff --git a/PTMagic/_defaults/_default_settings_PT_2.x/settings.analyzer.json b/PTMagic/_defaults/_default_settings_PT_2.x/settings.analyzer.json index db5f9c9..d1b0744 100644 --- a/PTMagic/_defaults/_default_settings_PT_2.x/settings.analyzer.json +++ b/PTMagic/_defaults/_default_settings_PT_2.x/settings.analyzer.json @@ -11,20 +11,20 @@ "AnalyzerSettings": { "MarketAnalyzer": { "StoreDataMaxHours": 48, // Number of hours to store market data - "IntervalMinutes": 2, // Interval in minutes for PTMagic to check market trends and triggers + "IntervalMinutes": 2, // Interval in minutes for PTMagic to check market trends and triggers "ExcludeMainCurrency": true, // Excludes the main currency (for example BTC) from market trend analysis "MarketTrends": [ { "Name": "1h", // UNIQUE market trend name (to be referenced by your triggers below) "Platform": "Exchange", // Platform to grab prices from (Allowed values are: CoinMarketCap, Exchange) - "MaxMarkets": 50, // Number of markets/pairs to analyze sorted by 24h volume + "MaxMarkets": 50, // Number of markets/pairs to analyze sorted by 24h volume "TrendMinutes": 60, // Number of minutes to build a trend (1440 = 24h, 720 = 12h, 60 = 1h) "TrendCurrency": "Market", // Trend Currency to build the trend against. If set to "Fiat", the trend will - // take the USD value of your main currency into account to build the trend. + // take the USD value of your main currency into account to build the trend. // "Market" will build a trend against your base currency, such as BTC or USDT. "TrendThreshold": 15, // Any coin that is above 15% or below -15% for this timeframe will not be used when calculating the market average. - "DisplayGraph": false, // Use this trend in the graph on the PTM Monitor dashboard and market analyzer - "DisplayOnMarketAnalyzerList": false // Disply this trend for all coins on the PTM Monitor market analyzer + "DisplayGraph": false, // Use this trend in the graph on the PTM Monitor dashboard and market analyzer + "DisplayOnMarketAnalyzerList": false // Disply this trend for all coins on the PTM Monitor market analyzer }, { "Name": "6h", @@ -33,8 +33,8 @@ "TrendMinutes": 360, "TrendCurrency": "Market", "TrendThreshold": 30, - "DisplayGraph": true, - "DisplayOnMarketAnalyzerList": true + "DisplayGraph": true, + "DisplayOnMarketAnalyzerList": true }, { "Name": "12h", @@ -43,8 +43,8 @@ "TrendMinutes": 720, "TrendCurrency": "Market", "TrendThreshold": 50, - "DisplayGraph": true, - "DisplayOnMarketAnalyzerList": true + "DisplayGraph": true, + "DisplayOnMarketAnalyzerList": true }, { "Name": "24h", @@ -53,17 +53,17 @@ "TrendMinutes": 1440, "TrendCurrency": "Market", "TrendThreshold": 75, - "DisplayGraph": true, - "DisplayOnMarketAnalyzerList": true + "DisplayGraph": true, + "DisplayOnMarketAnalyzerList": true } ] }, // ================================ GLOBAL SETTINGS ================================ // "GlobalSettings": [ // Global settings for Profit Trailer properties - // - // =================================================================================== - // ----------------------------- + // + // =================================================================================== + // ----------------------------- { "SettingName": "EndOfTheWorld", // ANY UNIQUE name of your setting "TriggerConnection": "AND", // Define if triggers will be connected by AND or OR @@ -84,14 +84,14 @@ "PairsProperties": { // Properties for PAIRS.PROPERTIES // Any valid setting from https://wiki.profittrailer.com/en/config can be used here. // You can use a specific value, or apply a discrete OFFSET or OFFSETPERCENT to the value in your default PAIRS setting. - "DEFAULT_sell_only_mode_enabled": true, + "DEFAULT_sell_only_mode_enabled": "true", "DEFAULT_trailing_profit_OFFSETPERCENT": -50 }, "DCAProperties": { // Properties for DCA.PROPERTIES "DEFAULT_DCA_trailing_profit_OFFSETPERCENT": -75 } }, - // ----------------------------- + // ----------------------------- { "SettingName": "TankingDown", "TriggerConnection": "AND", @@ -123,10 +123,10 @@ "DEFAULT_DCA_trailing_buy_OFFSETPERCENT": 25, "DEFAULT_DCA_trailing_profit_OFFSETPERCENT": -50 }, - "IndicatorsProperties": { + "IndicatorsProperties": { } }, - // ----------------------------- + // ----------------------------- { "SettingName": "BearSighted", "TriggerConnection": "AND", @@ -156,7 +156,7 @@ "DEFAULT_DCA_trailing_buy_OFFSETPERCENT": 10, "DEFAULT_DCA_trailing_profit_OFFSETPERCENT": -10, }, - "IndicatorsProperties": { + "IndicatorsProperties": { } }, // ----------------------------- @@ -182,17 +182,17 @@ "max_trading_pairs_OFFSET": 1, //"DEFAULT_initial_cost_OFFSETPERCENT": 10, //"DEFAULT_initial_cost_percentage_OFFSETPERCENT": 10, - "DEFAULT_trailing_buy_OFFSETPERCENT": -10, + "DEFAULT_trailing_buy_OFFSETPERCENT": -10, "DEFAULT_A_sell_value_OFFSETPERCENT": 10 }, "DCAProperties": { "DEFAULT_DCA_trailing_buy_OFFSETPERCENT": -10, "DEFAULT_DCA_trailing_profit_OFFSETPERCENT": 10, }, - "IndicatorsProperties": { + "IndicatorsProperties": { } }, - // ----------------------------- + // ----------------------------- { "SettingName": "ToTheMoon", "TriggerConnection": "AND", @@ -214,14 +214,14 @@ "max_trading_pairs_OFFSET": 2, //"DEFAULT_initial_cost_OFFSETPERCENT": 20, //"DEFAULT_initial_cost_percentage_OFFSETPERCENT": 20, - "DEFAULT_trailing_buy_OFFSETPERCENT": -10, + "DEFAULT_trailing_buy_OFFSETPERCENT": -10, "DEFAULT_A_sell_value_OFFSETPERCENT": 20 }, "DCAProperties": { "DEFAULT_DCA_trailing_buy_OFFSETPERCENT": -20, "DEFAULT_DCA_trailing_profit_OFFSETPERCENT": 20, }, - "IndicatorsProperties": { + "IndicatorsProperties": { } }, // ----------------------------- @@ -241,9 +241,9 @@ // ================================ COIN-SPECIFIC SETTINGS ================================ // "SingleMarketSettings": [ // Single market/pair settings for Profit Trailer properties - // Any setting from https://wiki.profittrailer.com/doku.php?id=pairs.properties - // marked as CS (coin-specific) can be used here. - // Only coins that meet the triggered conditions will have the settings applied. + // Any setting from https://wiki.profittrailer.com/en/config + // marked as CS (coin-specific) can be used here. + // Only coins that meet the triggered conditions will have the settings applied. { "SettingName": "BlacklistCoins", "StopProcessWhenTriggered": true, @@ -253,12 +253,12 @@ } ], "PairsProperties": { - "DEFAULT_trading_enabled": false, - "DEFAULT_sell_only_mode_enabled": true, - "DEFAULT_DCA_enabled": false + "DEFAULT_trading_enabled": "false", + "DEFAULT_sell_only_mode_enabled": "true", + "DEFAULT_DCA_enabled": "false" } }, - // ----------------------------- + // ----------------------------- { "SettingName": "PumpNDumpProtection", "TriggerConnection": "OR", @@ -266,8 +266,8 @@ { "MarketTrendName": "1h", "MarketTrendRelation": "Relative", // The relation of the single market trend. Relative = Single market - // trend compared relative to the market trend - // Absolute = Single market trend viewed on its own + // trend compared relative to the market trend + // Absolute = Single market trend viewed on its own "MinChange": 8 }, { @@ -281,18 +281,18 @@ "MinChange": 12 } ], - "OffTriggers": [ - { - "HoursSinceTriggered": 3 // Any coin that triggers this setting, will remain under this setting - // for 3 hours, since the last time it triggered. + "OffTriggers": [ + { + "HoursSinceTriggered": 3 // Any coin that triggers this setting, will remain under this setting + // for 3 hours, since the last time it triggered. } ], "PairsProperties": { - "DEFAULT_sell_only_mode_enabled": true, - "DEFAULT_DCA_enabled": false + "DEFAULT_sell_only_mode_enabled": "true", + "DEFAULT_DCA_enabled": "false" } }, - // ----------------------------- + // ----------------------------- { "SettingName": "FreefallBlock", "TriggerConnection": "OR", @@ -303,14 +303,14 @@ "MaxChange": -5 } ], - "OffTriggers": [ - { + "OffTriggers": [ + { "HoursSinceTriggered": 1 } ], - "PairsProperties": { - "DEFAULT_sell_only_mode_enabled": true, - "DEFAULT_DCA_enabled": false + "PairsProperties": { + "DEFAULT_sell_only_mode_enabled": "true", + "DEFAULT_DCA_enabled": "false" } } ] diff --git a/_Development/DevSettings/settings.analyzer.json b/_Development/DevSettings/settings.analyzer.json index baf14ff..d1b0744 100644 --- a/_Development/DevSettings/settings.analyzer.json +++ b/_Development/DevSettings/settings.analyzer.json @@ -84,7 +84,7 @@ "PairsProperties": { // Properties for PAIRS.PROPERTIES // Any valid setting from https://wiki.profittrailer.com/en/config can be used here. // You can use a specific value, or apply a discrete OFFSET or OFFSETPERCENT to the value in your default PAIRS setting. - "DEFAULT_sell_only_mode_enabled": true, + "DEFAULT_sell_only_mode_enabled": "true", "DEFAULT_trailing_profit_OFFSETPERCENT": -50 }, "DCAProperties": { // Properties for DCA.PROPERTIES @@ -112,16 +112,16 @@ ], "PairsProperties": { "max_trading_pairs_OFFSET": -2, - "DEFAULT_min_buy_volume_OFFSETPERCENT": 100, - //"DEFAULT_initial_cost_OFFSETPERCENT": -50, - //"DEFAULT_initial_cost_percentage_OFFSETPERCENT": -50, + "DEFAULT_min_buy_volume_OFFSETPERCENT": 100, + //"DEFAULT_initial_cost_OFFSETPERCENT": -50, + //"DEFAULT_initial_cost_percentage_OFFSETPERCENT": -50, "DEFAULT_trailing_buy_OFFSETPERCENT": 25, "DEFAULT_trailing_profit_OFFSETPERCENT": -25 }, "DCAProperties": { //"DEFAULT_DCA_rebuy_timeout_OFFSETPERCENT": 100, "DEFAULT_DCA_trailing_buy_OFFSETPERCENT": 25, - "DEFAULT_DCA_trailing_profit_OFFSETPERCENT": -50 + "DEFAULT_DCA_trailing_profit_OFFSETPERCENT": -50 }, "IndicatorsProperties": { } @@ -147,14 +147,14 @@ ], "PairsProperties": { "max_trading_pairs_OFFSET": -1, - //"DEFAULT_initial_cost_OFFSETPERCENT": -25, - //"DEFAULT_initial_cost_percentage_OFFSETPERCENT": -25, + //"DEFAULT_initial_cost_OFFSETPERCENT": -25, + //"DEFAULT_initial_cost_percentage_OFFSETPERCENT": -25, "DEFAULT_trailing_buy_OFFSETPERCENT": 10, "DEFAULT_trailing_profit_OFFSETPERCENT": -10 }, "DCAProperties": { "DEFAULT_DCA_trailing_buy_OFFSETPERCENT": 10, - "DEFAULT_DCA_trailing_profit_OFFSETPERCENT": -10, + "DEFAULT_DCA_trailing_profit_OFFSETPERCENT": -10, }, "IndicatorsProperties": { } @@ -180,14 +180,14 @@ ], "PairsProperties": { "max_trading_pairs_OFFSET": 1, - //"DEFAULT_initial_cost_OFFSETPERCENT": 10, - //"DEFAULT_initial_cost_percentage_OFFSETPERCENT": 10, - "DEFAULT_trailing_buy_OFFSETPERCENT": -10, + //"DEFAULT_initial_cost_OFFSETPERCENT": 10, + //"DEFAULT_initial_cost_percentage_OFFSETPERCENT": 10, + "DEFAULT_trailing_buy_OFFSETPERCENT": -10, "DEFAULT_A_sell_value_OFFSETPERCENT": 10 }, "DCAProperties": { "DEFAULT_DCA_trailing_buy_OFFSETPERCENT": -10, - "DEFAULT_DCA_trailing_profit_OFFSETPERCENT": 10, + "DEFAULT_DCA_trailing_profit_OFFSETPERCENT": 10, }, "IndicatorsProperties": { } @@ -212,14 +212,14 @@ ], "PairsProperties": { "max_trading_pairs_OFFSET": 2, - //"DEFAULT_initial_cost_OFFSETPERCENT": 20, - //"DEFAULT_initial_cost_percentage_OFFSETPERCENT": 20, - "DEFAULT_trailing_buy_OFFSETPERCENT": -10, + //"DEFAULT_initial_cost_OFFSETPERCENT": 20, + //"DEFAULT_initial_cost_percentage_OFFSETPERCENT": 20, + "DEFAULT_trailing_buy_OFFSETPERCENT": -10, "DEFAULT_A_sell_value_OFFSETPERCENT": 20 }, "DCAProperties": { "DEFAULT_DCA_trailing_buy_OFFSETPERCENT": -20, - "DEFAULT_DCA_trailing_profit_OFFSETPERCENT": 20, + "DEFAULT_DCA_trailing_profit_OFFSETPERCENT": 20, }, "IndicatorsProperties": { } @@ -253,9 +253,9 @@ } ], "PairsProperties": { - "DEFAULT_trading_enabled": false, - "DEFAULT_sell_only_mode_enabled": true, - "DEFAULT_DCA_enabled": false + "DEFAULT_trading_enabled": "false", + "DEFAULT_sell_only_mode_enabled": "true", + "DEFAULT_DCA_enabled": "false" } }, // ----------------------------- @@ -267,7 +267,7 @@ "MarketTrendName": "1h", "MarketTrendRelation": "Relative", // The relation of the single market trend. Relative = Single market // trend compared relative to the market trend - // Absolute = Single market trend viewed on its own + // Absolute = Single market trend viewed on its own "MinChange": 8 }, { @@ -284,12 +284,12 @@ "OffTriggers": [ { "HoursSinceTriggered": 3 // Any coin that triggers this setting, will remain under this setting - // for 3 hours, since the last time it triggered. + // for 3 hours, since the last time it triggered. } ], "PairsProperties": { - "DEFAULT_sell_only_mode_enabled": true, - "DEFAULT_DCA_enabled": false + "DEFAULT_sell_only_mode_enabled": "true", + "DEFAULT_DCA_enabled": "false" } }, // ----------------------------- @@ -309,8 +309,8 @@ } ], "PairsProperties": { - "DEFAULT_sell_only_mode_enabled": true, - "DEFAULT_DCA_enabled": false + "DEFAULT_sell_only_mode_enabled": "true", + "DEFAULT_DCA_enabled": "false" } } ] From c02b16b948e71d629ac07f59c8e9d4fa46624925 Mon Sep 17 00:00:00 2001 From: HojouFotytu <36724681+HojouFotytu@users.noreply.github.com> Date: Wed, 21 Apr 2021 15:33:07 +0900 Subject: [PATCH 2/3] Settings GUI changes --- Core/Main/PTMagic.cs | 19 +++++++------ Monitor/Pages/SettingsGeneral.cshtml | 37 ++++++++++++------------- Monitor/Pages/SettingsGeneral.cshtml.cs | 10 +++---- PTMagic/Program.cs | 2 +- 4 files changed, 35 insertions(+), 33 deletions(-) diff --git a/Core/Main/PTMagic.cs b/Core/Main/PTMagic.cs index 7001425..29b198d 100644 --- a/Core/Main/PTMagic.cs +++ b/Core/Main/PTMagic.cs @@ -701,13 +701,13 @@ namespace Core.Main // Check if the program is enabled if (this.PTMagicConfiguration.GeneralSettings.Application.IsEnabled) { + result = RunProfitTrailerSettingsAPIChecks(); try { if (this.PTMagicConfiguration.GeneralSettings.Application.TestMode) { - this.Log.DoLogInfo("TESTMODE ENABLED - No files will be changed!"); + this.Log.DoLogWarn("TESTMODE ENABLED - No PT settings will be changed!"); } - result = RunProfitTrailerSettingsAPIChecks(); // Check for CoinMarketCap API Key if (!String.IsNullOrEmpty(this.PTMagicConfiguration.GeneralSettings.Application.CoinMarketCapAPIKey)) @@ -731,7 +731,7 @@ namespace Core.Main } catch (System.NullReferenceException) { - this.Log.DoLogError("PTM failed to read the Config File. That means something in the File is either missing or incorrect. If this happend after an update please take a look at the release notes at: https://github.com/PTMagicians/PTMagic/releases"); + this.Log.DoLogError("PTM failed to read the General Settings file. That means something in the file is either missing or incorrect. If this happend after an update please take a look at the release notes at: https://github.com/PTMagicians/PTMagic/releases"); Console.WriteLine("Press enter to close the Application..."); Console.ReadLine(); Environment.Exit(0); @@ -739,7 +739,7 @@ namespace Core.Main } else { - this.Log.DoLogWarn("PTMagic disabled, shutting down..."); + this.Log.DoLogWarn("PTMagic is disabled. The scheduled raid was skipped."); result = false; } @@ -952,7 +952,7 @@ namespace Core.Main this.Log.DoLogInfo("+ Active setting: " + this.LastRuntimeSummary.CurrentGlobalSetting.SettingName); this.Log.DoLogInfo("+ Global setting changed: " + ((this.LastRuntimeSummary.LastGlobalSettingSwitch == this.LastRuntimeSummary.LastRuntime) ? "Yes" : "No") + " " + ((this.LastRuntimeSummary.FloodProtectedSetting != null) ? "(Flood protection!)" : "")); this.Log.DoLogInfo("+ Single Market Settings changed: " + (this.SingleMarketSettingChanged ? "Yes" : "No")); - this.Log.DoLogInfo("+ PT Config updated: " + (((this.GlobalSettingWritten || this.SingleMarketSettingChanged) && !this.PTMagicConfiguration.GeneralSettings.Application.TestMode) ? "Yes" : "No")); + this.Log.DoLogInfo("+ PT Config updated: " + (((this.GlobalSettingWritten || this.SingleMarketSettingChanged) && !this.PTMagicConfiguration.GeneralSettings.Application.TestMode) ? "Yes" : "No") + ((this.PTMagicConfiguration.GeneralSettings.Application.TestMode) ? " - TESTMODE active" : "")); this.Log.DoLogInfo("+ Markets with active single market settings: " + this.TriggeredSingleMarketSettings.Count.ToString()); foreach (string activeSMS in this.SingleMarketSettingsCount.Keys) { @@ -969,7 +969,7 @@ namespace Core.Main else { this.State = Constants.PTMagicBotState_Idle; - Log.DoLogWarn("PTMagic disabled, shutting down until next raid..."); + Log.DoLogWarn("PTMagic is disabled. The scheduled raid was skipped."); } } catch (Exception ex) @@ -2194,9 +2194,12 @@ namespace Core.Main if (!this.PTMagicConfiguration.GeneralSettings.Application.TestMode) { SettingsAPI.SendPropertyLinesToAPI(this.PairsLines, this.DCALines, this.IndicatorsLines, this.PTMagicConfiguration, this.Log); + this.Log.DoLogInfo("Settings updates sent to PT!"); + } + else + { + this.Log.DoLogWarn("TESTMODE enabled -- no updates sent to PT!"); } - - this.Log.DoLogInfo("Properties saved!"); } else { diff --git a/Monitor/Pages/SettingsGeneral.cshtml b/Monitor/Pages/SettingsGeneral.cshtml index bd8a46a..20f0d27 100644 --- a/Monitor/Pages/SettingsGeneral.cshtml +++ b/Monitor/Pages/SettingsGeneral.cshtml @@ -48,24 +48,30 @@