From f8747bfe206567a19f0ddb9296d640db018a7c8d Mon Sep 17 00:00:00 2001 From: JackTerok Date: Sat, 29 Dec 2018 04:09:00 +0100 Subject: [PATCH] Bugfixes, Formatting and MainCurrency now comes from API --- Core/DataObjects/PTMagicData.cs | 6 +++--- Core/Main/PTMagic.cs | 8 ++++---- Core/MarketAnalyzer/CoinMarketCap.cs | 1 - Core/ProfitTrailer/SettingsAPI.cs | 1 + .../_default settings BTC or ETH/settings.general.json | 1 - .../_default settings USDT/settings.general.json | 1 - _Development/DevSettings/settings.general.json | 1 - 7 files changed, 8 insertions(+), 11 deletions(-) diff --git a/Core/DataObjects/PTMagicData.cs b/Core/DataObjects/PTMagicData.cs index 243b4bd..a44e37d 100644 --- a/Core/DataObjects/PTMagicData.cs +++ b/Core/DataObjects/PTMagicData.cs @@ -36,16 +36,16 @@ namespace Core.Main.DataObjects.PTMagicData public bool TestMode { get; set; } = true; public bool EnableBetaFeatures { get; set; } = false; public string ProfitTrailerPath { get; set; } - public string ProfitTrailerLicense { get; set; } + public string ProfitTrailerLicense { get; set; } = ""; public string ProfitTrailerServerAPIToken { get; set; } public string ProfitTrailerMonitorURL { get; set; } = "http://localhost:8081/"; public string ProfitTrailerDefaultSettingName { get; set; } = "default"; public bool AlwaysLoadDefaultBeforeSwitch { get; set; } = true; public int FloodProtectionMinutes { get; set; } = 15; public string Exchange { get; set; } - public double StartBalance { get; set; } + public double StartBalance { get; set; } = 0; public string InstanceName { get; set; } = "PT Magic"; - public string TimezoneOffset { get; set; } + public string TimezoneOffset { get; set; } = "+0:00"; public string MainFiatCurrency { get; set; } = "USD"; public string CoinMarketCapAPIKey { get; set; } } diff --git a/Core/Main/PTMagic.cs b/Core/Main/PTMagic.cs index 90f34eb..8aa8de1 100644 --- a/Core/Main/PTMagic.cs +++ b/Core/Main/PTMagic.cs @@ -609,6 +609,9 @@ namespace Core.Main { bool result = true; + //Import Initial ProfitTrailer Information + SettingsAPI.GetInitialProfitTrailerSettings(this.PTMagicConfiguration); + // Check for valid default setting GlobalSetting defaultSetting = this.PTMagicConfiguration.AnalyzerSettings.GlobalSettings.Find(s => s.SettingName.Equals("default", StringComparison.InvariantCultureIgnoreCase)); if (defaultSetting == null) @@ -697,7 +700,7 @@ namespace Core.Main //Check for ptServerAPIToken if (!this.PTMagicConfiguration.GeneralSettings.Application.ProfitTrailerServerAPIToken.Equals("")) { - this.Log.DoLogInfo("Profit Trailer check: Profit Trailer Server API Token Specified"); + this.Log.DoLogInfo("Profit Trailer check: Profit Trailer Server API Token Specified"); } else { @@ -738,9 +741,6 @@ namespace Core.Main result = false; } - //Import Initial ProfitTrailer Information - SettingsAPI.GetInitialProfitTrailerSettings(this.PTMagicConfiguration); - if (result) { this.Log.DoLogInfo("========== CHECKS FOR Profit Trailer COMPLETED! =========="); diff --git a/Core/MarketAnalyzer/CoinMarketCap.cs b/Core/MarketAnalyzer/CoinMarketCap.cs index 193575d..93ce88a 100644 --- a/Core/MarketAnalyzer/CoinMarketCap.cs +++ b/Core/MarketAnalyzer/CoinMarketCap.cs @@ -34,7 +34,6 @@ namespace Core.MarketAnalyzer for (int i = 0; i < jsonObject["data"].Count; i++) { - if (jsonObject["data"][i]["quote"]["USD"] != null) { Market market = new Market(); diff --git a/Core/ProfitTrailer/SettingsAPI.cs b/Core/ProfitTrailer/SettingsAPI.cs index c4b0e45..4aafa54 100644 --- a/Core/ProfitTrailer/SettingsAPI.cs +++ b/Core/ProfitTrailer/SettingsAPI.cs @@ -45,6 +45,7 @@ namespace Core.ProfitTrailer systemConfiguration.GeneralSettings.Application.Exchange = json.exchange; systemConfiguration.GeneralSettings.Application.TimezoneOffset = json.timeZoneOffset; systemConfiguration.GeneralSettings.Application.StartBalance = json.startBalance; + systemConfiguration.GeneralSettings.Application.MainFiatCurrency = json.settings.currency; } public static List GetPropertyLinesFromAPI(string ptFileName, PTMagicConfiguration systemConfiguration, LogHelper log) { diff --git a/PTMagic/_defaults/_default settings PT 2.x/_default settings BTC or ETH/settings.general.json b/PTMagic/_defaults/_default settings PT 2.x/_default settings BTC or ETH/settings.general.json index 65fb50d..9894da9 100644 --- a/PTMagic/_defaults/_default settings PT 2.x/_default settings BTC or ETH/settings.general.json +++ b/PTMagic/_defaults/_default settings PT 2.x/_default settings BTC or ETH/settings.general.json @@ -8,7 +8,6 @@ "ProfitTrailerServerAPIToken": "", //Your Profit Trailer Server API Token "ProfitTrailerMonitorURL": "http://localhost:8081/", // The URL to your profit trailer monitor (needed to change your settings for PT 2.0 and above) "ProfitTrailerDefaultSettingName": "default", // Your Profit Trailer default setting name (needed to change your settings for PT 2.0 and above) - "MainFiatCurrency": "USD", // Your main fiat currency that will be used in the monitor "AlwaysLoadDefaultBeforeSwitch": true, // If this is enabled, PTMagic will always load default settings before switching to another setting "FloodProtectionMinutes": 15, // If a price trend is just zig-zagging around its trigger, you may want to protect your settings from getting switched back and forth every minute "InstanceName": "PT Magic", // The name of the instance of this bot. This will be used in your monitor and your Telegram messages. In case you are running more than one bot, you may set different names to separate them diff --git a/PTMagic/_defaults/_default settings PT 2.x/_default settings USDT/settings.general.json b/PTMagic/_defaults/_default settings PT 2.x/_default settings USDT/settings.general.json index 65fb50d..9894da9 100644 --- a/PTMagic/_defaults/_default settings PT 2.x/_default settings USDT/settings.general.json +++ b/PTMagic/_defaults/_default settings PT 2.x/_default settings USDT/settings.general.json @@ -8,7 +8,6 @@ "ProfitTrailerServerAPIToken": "", //Your Profit Trailer Server API Token "ProfitTrailerMonitorURL": "http://localhost:8081/", // The URL to your profit trailer monitor (needed to change your settings for PT 2.0 and above) "ProfitTrailerDefaultSettingName": "default", // Your Profit Trailer default setting name (needed to change your settings for PT 2.0 and above) - "MainFiatCurrency": "USD", // Your main fiat currency that will be used in the monitor "AlwaysLoadDefaultBeforeSwitch": true, // If this is enabled, PTMagic will always load default settings before switching to another setting "FloodProtectionMinutes": 15, // If a price trend is just zig-zagging around its trigger, you may want to protect your settings from getting switched back and forth every minute "InstanceName": "PT Magic", // The name of the instance of this bot. This will be used in your monitor and your Telegram messages. In case you are running more than one bot, you may set different names to separate them diff --git a/_Development/DevSettings/settings.general.json b/_Development/DevSettings/settings.general.json index 65fb50d..9894da9 100644 --- a/_Development/DevSettings/settings.general.json +++ b/_Development/DevSettings/settings.general.json @@ -8,7 +8,6 @@ "ProfitTrailerServerAPIToken": "", //Your Profit Trailer Server API Token "ProfitTrailerMonitorURL": "http://localhost:8081/", // The URL to your profit trailer monitor (needed to change your settings for PT 2.0 and above) "ProfitTrailerDefaultSettingName": "default", // Your Profit Trailer default setting name (needed to change your settings for PT 2.0 and above) - "MainFiatCurrency": "USD", // Your main fiat currency that will be used in the monitor "AlwaysLoadDefaultBeforeSwitch": true, // If this is enabled, PTMagic will always load default settings before switching to another setting "FloodProtectionMinutes": 15, // If a price trend is just zig-zagging around its trigger, you may want to protect your settings from getting switched back and forth every minute "InstanceName": "PT Magic", // The name of the instance of this bot. This will be used in your monitor and your Telegram messages. In case you are running more than one bot, you may set different names to separate them