From efadf45a3311b3da53446da820f90054e976d2f2 Mon Sep 17 00:00:00 2001 From: Luke Plaster Date: Sat, 16 Feb 2019 04:26:37 +0800 Subject: [PATCH 1/6] Allow signal strategy --- Core/ProfitTrailer/StrategyHelper.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Core/ProfitTrailer/StrategyHelper.cs b/Core/ProfitTrailer/StrategyHelper.cs index aee5ec5..cee6e96 100644 --- a/Core/ProfitTrailer/StrategyHelper.cs +++ b/Core/ProfitTrailer/StrategyHelper.cs @@ -197,6 +197,7 @@ namespace Core.ProfitTrailer case "dema": case "hma": case "pdhigh": + case "signal": result = true; break; default: @@ -458,4 +459,4 @@ namespace Core.ProfitTrailer return result; } } -} \ No newline at end of file +} From 867ab85c09e6c9d3680837c2bcadf5d08adfe53b Mon Sep 17 00:00:00 2001 From: HojouFotytu <36724681+HojouFotytu@users.noreply.github.com> Date: Sun, 17 Feb 2019 13:48:49 +0900 Subject: [PATCH 2/6] FreeCurrencyConverterApi Fix --- Core/DataObjects/PTMagicData.cs | 1 + Core/Main/PTMagic.cs | 12 +++++++++++- Core/MarketAnalyzer/BaseAnalyzer.cs | 4 ++-- Monitor/Pages/SettingsGeneral.cshtml.cs | 1 + 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/Core/DataObjects/PTMagicData.cs b/Core/DataObjects/PTMagicData.cs index 1f2dd55..8a16385 100644 --- a/Core/DataObjects/PTMagicData.cs +++ b/Core/DataObjects/PTMagicData.cs @@ -48,6 +48,7 @@ namespace Core.Main.DataObjects.PTMagicData public string TimezoneOffset { get; set; } = "+0:00"; public string MainFiatCurrency { get; set; } = "USD"; public string CoinMarketCapAPIKey { get; set; } + public string FreeCurrencyConverterAPIKey { get; set; } } public class Monitor diff --git a/Core/Main/PTMagic.cs b/Core/Main/PTMagic.cs index 5e3ef98..f08ee52 100644 --- a/Core/Main/PTMagic.cs +++ b/Core/Main/PTMagic.cs @@ -670,6 +670,16 @@ namespace Core.Main { this.Log.DoLogInfo("No CoinMarketCap API KEY specified! You can't use CoinMarketCap in your settings.analyzer.json"); } + + // Check for CurrencyConverterApi Key + if (!this.PTMagicConfiguration.GeneralSettings.Application.FreeCurrencyConverterAPIKey.Equals("")) + { + this.Log.DoLogInfo("FreeCurrencyConverterApi KEY found"); + } + else + { + this.Log.DoLogInfo("No FreeCurrencyConverterApi KEY specified! You can't use non USD Currencies!"); + } } else @@ -1021,7 +1031,7 @@ namespace Core.Main try { this.LastRuntimeSummary.MainFiatCurrency = this.PTMagicConfiguration.GeneralSettings.Application.MainFiatCurrency; - this.LastRuntimeSummary.MainFiatCurrencyExchangeRate = BaseAnalyzer.GetMainFiatCurrencyRate(this.PTMagicConfiguration.GeneralSettings.Application.MainFiatCurrency, this.Log); + this.LastRuntimeSummary.MainFiatCurrencyExchangeRate = BaseAnalyzer.GetMainFiatCurrencyRate(this.PTMagicConfiguration.GeneralSettings.Application.MainFiatCurrency, this.PTMagicConfiguration.GeneralSettings.Application.FreeCurrencyConverterAPIKey, this.Log); this.LastMainFiatCurrency = this.LastRuntimeSummary.MainFiatCurrency; this.LastMainFiatCurrencyExchangeRate = this.LastRuntimeSummary.MainFiatCurrencyExchangeRate; diff --git a/Core/MarketAnalyzer/BaseAnalyzer.cs b/Core/MarketAnalyzer/BaseAnalyzer.cs index f20d2e5..520150d 100644 --- a/Core/MarketAnalyzer/BaseAnalyzer.cs +++ b/Core/MarketAnalyzer/BaseAnalyzer.cs @@ -195,11 +195,11 @@ namespace Core.MarketAnalyzer return result; } - public static double GetMainFiatCurrencyRate(string currency, LogHelper log) + public static double GetMainFiatCurrencyRate(string currency, string FreeCurrencyAPI, LogHelper log) { double result = 1; - string baseUrl = "http://free.currencyconverterapi.com/api/v5/convert?q=USD_" + currency + "&compact=y"; + string baseUrl = "http://free.currencyconverterapi.com/api/v5/convert?q=USD_" + currency + "&compact=y&apiKey="+FreeCurrencyAPI; log.DoLogDebug("http://free.currencyconverterapi.com - Getting latest exchange rates..."); Newtonsoft.Json.Linq.JObject jsonObject = GetSimpleJsonObjectFromURL(baseUrl, log, false); diff --git a/Monitor/Pages/SettingsGeneral.cshtml.cs b/Monitor/Pages/SettingsGeneral.cshtml.cs index 899e5eb..3c6c2bd 100644 --- a/Monitor/Pages/SettingsGeneral.cshtml.cs +++ b/Monitor/Pages/SettingsGeneral.cshtml.cs @@ -74,6 +74,7 @@ namespace Monitor.Pages PTMagicConfiguration.GeneralSettings.Application.FloodProtectionMinutes = SystemHelper.TextToInteger(HttpContext.Request.Form["Application_FloodProtectionMinutes"], PTMagicConfiguration.GeneralSettings.Application.FloodProtectionMinutes); PTMagicConfiguration.GeneralSettings.Application.InstanceName = HttpContext.Request.Form["Application_InstanceName"]; PTMagicConfiguration.GeneralSettings.Application.CoinMarketCapAPIKey = HttpContext.Request.Form["Application_CoinMarketCapAPIKey"]; + PTMagicConfiguration.GeneralSettings.Application.FreeCurrencyConverterAPIKey = HttpContext.Request.Form["Application_FreeCurrencyConverterAPIKey"]; PTMagicConfiguration.GeneralSettings.Monitor.IsPasswordProtected = HttpContext.Request.Form["Monitor_IsPasswordProtected"].Equals("on"); PTMagicConfiguration.GeneralSettings.Monitor.OpenBrowserOnStart = HttpContext.Request.Form["Monitor_OpenBrowserOnStart"].Equals("on"); From b3c6dbe5266fe5039c63498ef979f374bc1bfa14 Mon Sep 17 00:00:00 2001 From: HojouFotytu <36724681+HojouFotytu@users.noreply.github.com> Date: Sun, 17 Feb 2019 15:14:45 +0900 Subject: [PATCH 3/6] Force update from presets every run --- Core/Main/PTMagic.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Core/Main/PTMagic.cs b/Core/Main/PTMagic.cs index f08ee52..b2cca6f 100644 --- a/Core/Main/PTMagic.cs +++ b/Core/Main/PTMagic.cs @@ -560,6 +560,7 @@ namespace Core.Main SettingsFiles.CheckPresets(this.PTMagicConfiguration, this.Log, true); EnforceSettingsReapply = true; + this.StartPTMagicIntervalTimer(); return result; @@ -798,7 +799,9 @@ namespace Core.Main this.RunCount++; bool headerLinesAdded = false; - this.EnforceSettingsReapply = this.HaveSettingsChanged(); + + // Force update from preset files with every run + this.EnforceSettingsReapply = true; // = this.HaveSettingsChanged(); if (PTMagicConfiguration.GeneralSettings.Application.IsEnabled) { From ec9ba3745d115b4e8abcc434f12872746726aa0b Mon Sep 17 00:00:00 2001 From: HojouFotytu <36724681+HojouFotytu@users.noreply.github.com> Date: Sun, 17 Feb 2019 21:39:22 +0900 Subject: [PATCH 4/6] Revert "Minor Fixes" --- Core/DataObjects/PTMagicData.cs | 1 - Core/Main/PTMagic.cs | 17 ++--------------- Core/MarketAnalyzer/BaseAnalyzer.cs | 4 ++-- Monitor/Pages/SettingsGeneral.cshtml.cs | 1 - 4 files changed, 4 insertions(+), 19 deletions(-) diff --git a/Core/DataObjects/PTMagicData.cs b/Core/DataObjects/PTMagicData.cs index 8a16385..1f2dd55 100644 --- a/Core/DataObjects/PTMagicData.cs +++ b/Core/DataObjects/PTMagicData.cs @@ -48,7 +48,6 @@ namespace Core.Main.DataObjects.PTMagicData public string TimezoneOffset { get; set; } = "+0:00"; public string MainFiatCurrency { get; set; } = "USD"; public string CoinMarketCapAPIKey { get; set; } - public string FreeCurrencyConverterAPIKey { get; set; } } public class Monitor diff --git a/Core/Main/PTMagic.cs b/Core/Main/PTMagic.cs index b2cca6f..5e3ef98 100644 --- a/Core/Main/PTMagic.cs +++ b/Core/Main/PTMagic.cs @@ -560,7 +560,6 @@ namespace Core.Main SettingsFiles.CheckPresets(this.PTMagicConfiguration, this.Log, true); EnforceSettingsReapply = true; - this.StartPTMagicIntervalTimer(); return result; @@ -671,16 +670,6 @@ namespace Core.Main { this.Log.DoLogInfo("No CoinMarketCap API KEY specified! You can't use CoinMarketCap in your settings.analyzer.json"); } - - // Check for CurrencyConverterApi Key - if (!this.PTMagicConfiguration.GeneralSettings.Application.FreeCurrencyConverterAPIKey.Equals("")) - { - this.Log.DoLogInfo("FreeCurrencyConverterApi KEY found"); - } - else - { - this.Log.DoLogInfo("No FreeCurrencyConverterApi KEY specified! You can't use non USD Currencies!"); - } } else @@ -799,9 +788,7 @@ namespace Core.Main this.RunCount++; bool headerLinesAdded = false; - - // Force update from preset files with every run - this.EnforceSettingsReapply = true; // = this.HaveSettingsChanged(); + this.EnforceSettingsReapply = this.HaveSettingsChanged(); if (PTMagicConfiguration.GeneralSettings.Application.IsEnabled) { @@ -1034,7 +1021,7 @@ namespace Core.Main try { this.LastRuntimeSummary.MainFiatCurrency = this.PTMagicConfiguration.GeneralSettings.Application.MainFiatCurrency; - this.LastRuntimeSummary.MainFiatCurrencyExchangeRate = BaseAnalyzer.GetMainFiatCurrencyRate(this.PTMagicConfiguration.GeneralSettings.Application.MainFiatCurrency, this.PTMagicConfiguration.GeneralSettings.Application.FreeCurrencyConverterAPIKey, this.Log); + this.LastRuntimeSummary.MainFiatCurrencyExchangeRate = BaseAnalyzer.GetMainFiatCurrencyRate(this.PTMagicConfiguration.GeneralSettings.Application.MainFiatCurrency, this.Log); this.LastMainFiatCurrency = this.LastRuntimeSummary.MainFiatCurrency; this.LastMainFiatCurrencyExchangeRate = this.LastRuntimeSummary.MainFiatCurrencyExchangeRate; diff --git a/Core/MarketAnalyzer/BaseAnalyzer.cs b/Core/MarketAnalyzer/BaseAnalyzer.cs index 520150d..f20d2e5 100644 --- a/Core/MarketAnalyzer/BaseAnalyzer.cs +++ b/Core/MarketAnalyzer/BaseAnalyzer.cs @@ -195,11 +195,11 @@ namespace Core.MarketAnalyzer return result; } - public static double GetMainFiatCurrencyRate(string currency, string FreeCurrencyAPI, LogHelper log) + public static double GetMainFiatCurrencyRate(string currency, LogHelper log) { double result = 1; - string baseUrl = "http://free.currencyconverterapi.com/api/v5/convert?q=USD_" + currency + "&compact=y&apiKey="+FreeCurrencyAPI; + string baseUrl = "http://free.currencyconverterapi.com/api/v5/convert?q=USD_" + currency + "&compact=y"; log.DoLogDebug("http://free.currencyconverterapi.com - Getting latest exchange rates..."); Newtonsoft.Json.Linq.JObject jsonObject = GetSimpleJsonObjectFromURL(baseUrl, log, false); diff --git a/Monitor/Pages/SettingsGeneral.cshtml.cs b/Monitor/Pages/SettingsGeneral.cshtml.cs index 3c6c2bd..899e5eb 100644 --- a/Monitor/Pages/SettingsGeneral.cshtml.cs +++ b/Monitor/Pages/SettingsGeneral.cshtml.cs @@ -74,7 +74,6 @@ namespace Monitor.Pages PTMagicConfiguration.GeneralSettings.Application.FloodProtectionMinutes = SystemHelper.TextToInteger(HttpContext.Request.Form["Application_FloodProtectionMinutes"], PTMagicConfiguration.GeneralSettings.Application.FloodProtectionMinutes); PTMagicConfiguration.GeneralSettings.Application.InstanceName = HttpContext.Request.Form["Application_InstanceName"]; PTMagicConfiguration.GeneralSettings.Application.CoinMarketCapAPIKey = HttpContext.Request.Form["Application_CoinMarketCapAPIKey"]; - PTMagicConfiguration.GeneralSettings.Application.FreeCurrencyConverterAPIKey = HttpContext.Request.Form["Application_FreeCurrencyConverterAPIKey"]; PTMagicConfiguration.GeneralSettings.Monitor.IsPasswordProtected = HttpContext.Request.Form["Monitor_IsPasswordProtected"].Equals("on"); PTMagicConfiguration.GeneralSettings.Monitor.OpenBrowserOnStart = HttpContext.Request.Form["Monitor_OpenBrowserOnStart"].Equals("on"); From 031613c778771e219219aeed057acd8204606b7c Mon Sep 17 00:00:00 2001 From: HojouFotytu <36724681+HojouFotytu@users.noreply.github.com> Date: Sun, 17 Feb 2019 23:45:00 +0900 Subject: [PATCH 5/6] CurrencyConverterAPI & ASPNetCore Update --- Core/DataObjects/PTMagicData.cs | 1 + Core/Main/PTMagic.cs | 12 +++++++++++- Core/MarketAnalyzer/BaseAnalyzer.cs | 4 ++-- Monitor/Monitor.csproj | 8 ++++---- 4 files changed, 18 insertions(+), 7 deletions(-) diff --git a/Core/DataObjects/PTMagicData.cs b/Core/DataObjects/PTMagicData.cs index 1f2dd55..8a16385 100644 --- a/Core/DataObjects/PTMagicData.cs +++ b/Core/DataObjects/PTMagicData.cs @@ -48,6 +48,7 @@ namespace Core.Main.DataObjects.PTMagicData public string TimezoneOffset { get; set; } = "+0:00"; public string MainFiatCurrency { get; set; } = "USD"; public string CoinMarketCapAPIKey { get; set; } + public string FreeCurrencyConverterAPIKey { get; set; } } public class Monitor diff --git a/Core/Main/PTMagic.cs b/Core/Main/PTMagic.cs index 5e3ef98..f66faad 100644 --- a/Core/Main/PTMagic.cs +++ b/Core/Main/PTMagic.cs @@ -670,6 +670,16 @@ namespace Core.Main { this.Log.DoLogInfo("No CoinMarketCap API KEY specified! You can't use CoinMarketCap in your settings.analyzer.json"); } + + // Check for CurrencyConverterApi Key + if (!this.PTMagicConfiguration.GeneralSettings.Application.FreeCurrencyConverterAPIKey.Equals("")) + { + this.Log.DoLogInfo("FreeCurrencyConverterApi KEY found"); + } + else + { + this.Log.DoLogInfo("No FreeCurrencyConverterApi KEY specified! You can't use non USD Currencies!"); + } } else @@ -1021,7 +1031,7 @@ namespace Core.Main try { this.LastRuntimeSummary.MainFiatCurrency = this.PTMagicConfiguration.GeneralSettings.Application.MainFiatCurrency; - this.LastRuntimeSummary.MainFiatCurrencyExchangeRate = BaseAnalyzer.GetMainFiatCurrencyRate(this.PTMagicConfiguration.GeneralSettings.Application.MainFiatCurrency, this.Log); + this.LastRuntimeSummary.MainFiatCurrencyExchangeRate = BaseAnalyzer.GetMainFiatCurrencyRate(this.PTMagicConfiguration.GeneralSettings.Application.MainFiatCurrency, this.PTMagicConfiguration.GeneralSettings.Application.FreeCurrencyConverterAPIKey, this.Log); this.LastMainFiatCurrency = this.LastRuntimeSummary.MainFiatCurrency; this.LastMainFiatCurrencyExchangeRate = this.LastRuntimeSummary.MainFiatCurrencyExchangeRate; diff --git a/Core/MarketAnalyzer/BaseAnalyzer.cs b/Core/MarketAnalyzer/BaseAnalyzer.cs index f20d2e5..520150d 100644 --- a/Core/MarketAnalyzer/BaseAnalyzer.cs +++ b/Core/MarketAnalyzer/BaseAnalyzer.cs @@ -195,11 +195,11 @@ namespace Core.MarketAnalyzer return result; } - public static double GetMainFiatCurrencyRate(string currency, LogHelper log) + public static double GetMainFiatCurrencyRate(string currency, string FreeCurrencyAPI, LogHelper log) { double result = 1; - string baseUrl = "http://free.currencyconverterapi.com/api/v5/convert?q=USD_" + currency + "&compact=y"; + string baseUrl = "http://free.currencyconverterapi.com/api/v5/convert?q=USD_" + currency + "&compact=y&apiKey="+FreeCurrencyAPI; log.DoLogDebug("http://free.currencyconverterapi.com - Getting latest exchange rates..."); Newtonsoft.Json.Linq.JObject jsonObject = GetSimpleJsonObjectFromURL(baseUrl, log, false); diff --git a/Monitor/Monitor.csproj b/Monitor/Monitor.csproj index f81b5e1..4aa31e8 100644 --- a/Monitor/Monitor.csproj +++ b/Monitor/Monitor.csproj @@ -22,10 +22,10 @@ - - - - + + + + From 330707fbd89888b9cbb3556f0637da0a21329d37 Mon Sep 17 00:00:00 2001 From: HojouFotytu <36724681+HojouFotytu@users.noreply.github.com> Date: Mon, 18 Feb 2019 00:40:25 +0900 Subject: [PATCH 6/6] update version number 2.1.2 --- PTMagic/Program.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PTMagic/Program.cs b/PTMagic/Program.cs index 31a3b7c..ddb21c8 100644 --- a/PTMagic/Program.cs +++ b/PTMagic/Program.cs @@ -7,7 +7,7 @@ using Core.Helper; using Core.Main.DataObjects.PTMagicData; using Microsoft.Extensions.DependencyInjection; -[assembly: AssemblyVersion("2.1.1")] +[assembly: AssemblyVersion("2.1.2")] [assembly: AssemblyProduct("PT Magic")] namespace PTMagic