From fb5d05f93c9390c5cf9f55b26073dc6496ad5dd8 Mon Sep 17 00:00:00 2001 From: HojouFotytu <36724681+HojouFotytu@users.noreply.github.com> Date: Tue, 9 Feb 2021 13:28:37 +0900 Subject: [PATCH 1/6] leveraged profits fix --- Monitor/Pages/_get/DashboardTop.cshtml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Monitor/Pages/_get/DashboardTop.cshtml b/Monitor/Pages/_get/DashboardTop.cshtml index 9793351..48ae690 100644 --- a/Monitor/Pages/_get/DashboardTop.cshtml +++ b/Monitor/Pages/_get/DashboardTop.cshtml @@ -159,11 +159,6 @@ profitPercentage = gainStrategy.CurrentValue; } } - - // Aggregate totals - double bagGain = (profitPercentage / 100) * dcaLogEntry.TotalCost * leverageValue; - Model.TotalBagCost = Model.TotalBagCost + dcaLogEntry.TotalCost; - Model.TotalBagGain = Model.TotalBagGain + bagGain; // Render the row @@ -226,20 +221,25 @@ { } - @if (!@lostValue) - { + { + profitPercentage = profitPercentage * leverageValue; @profitPercentage.ToString("#,#0.00", new System.Globalization.CultureInfo("en-US"))% } else { No Value! } - + { + // Aggregate totals + double bagGain = (profitPercentage / 100) * dcaLogEntry.TotalCost; + Model.TotalBagCost = Model.TotalBagCost + dcaLogEntry.TotalCost; + Model.TotalBagGain = Model.TotalBagGain + bagGain; + } } Totals: From bef871c45592bc6707e3dfadf6aee9d2f7056eff Mon Sep 17 00:00:00 2001 From: HojouFotytu <36724681+HojouFotytu@users.noreply.github.com> Date: Tue, 9 Feb 2021 13:50:53 +0900 Subject: [PATCH 2/6] remove SMS TrendThreshold logging --- Core/Main/PTMagic.cs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/Core/Main/PTMagic.cs b/Core/Main/PTMagic.cs index baa503e..4bfd9b9 100644 --- a/Core/Main/PTMagic.cs +++ b/Core/Main/PTMagic.cs @@ -1648,11 +1648,6 @@ namespace Core.Main orderby m.Market select m; - foreach (var marketTrend in excludedMarkets) - { - this.Log.DoLogInfo(String.Format("SMS Off Trigger for '{0}' is ignoring {1} for exceeding TrendThreshold {2}% with {3}% on {4}", marketSetting.SettingName, marketTrend.Market, (double)trendThreshold.TrendThreshold, Math.Round(marketTrend.TrendChange, 3, MidpointRounding.ToEven), offTrigger.MarketTrendName)); - } - var includedMarkets = from m in marketTrendChanges where m.TrendChange <= trendThreshold.TrendThreshold && m.TrendChange >= (trendThreshold.TrendThreshold * -1.0) orderby m.Market From 4a87992681a5d334c3568ed5223e7d8050d26aeb Mon Sep 17 00:00:00 2001 From: HojouFotytu <36724681+HojouFotytu@users.noreply.github.com> Date: Tue, 9 Feb 2021 13:57:54 +0900 Subject: [PATCH 3/6] remove SMS TrendThreshold logging --- Core/Main/PTMagic.cs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/Core/Main/PTMagic.cs b/Core/Main/PTMagic.cs index 4bfd9b9..d303014 100644 --- a/Core/Main/PTMagic.cs +++ b/Core/Main/PTMagic.cs @@ -1857,11 +1857,6 @@ namespace Core.Main orderby m.Market select m; - foreach (var marketTrend in excludedMarkets) - { - this.Log.DoLogInfo(String.Format("SMS Trigger for '{0}' is ignoring {1} for exceeding TrendThreshold {2}% with {3}% on {4}", marketSetting.SettingName, marketTrend.Market, (double)trendThreshold.TrendThreshold, Math.Round(marketTrend.TrendChange, 3, MidpointRounding.ToEven), trigger.MarketTrendName)); - } - var includedMarkets = from m in marketTrendChanges where m.TrendChange <= trendThreshold.TrendThreshold && m.TrendChange >= (trendThreshold.TrendThreshold * -1.0) orderby m.Market From 7b39b2601a54a9445f5539e4925697adf277c9c5 Mon Sep 17 00:00:00 2001 From: HojouFotytu <36724681+HojouFotytu@users.noreply.github.com> Date: Tue, 9 Feb 2021 15:11:39 +0900 Subject: [PATCH 4/6] MarketAnalyzer TrendThreshold icon --- Monitor/Pages/MarketAnalyzer.cshtml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Monitor/Pages/MarketAnalyzer.cshtml b/Monitor/Pages/MarketAnalyzer.cshtml index c7e7e4c..691e585 100644 --- a/Monitor/Pages/MarketAnalyzer.cshtml +++ b/Monitor/Pages/MarketAnalyzer.cshtml @@ -278,7 +278,15 @@ else if (mps.MarketTrendChanges.ContainsKey(marketTrend.Name)) { marketTrendsDisplayed++; string trendChangeOutput = mps.MarketTrendChanges[marketTrend.Name].ToString("#,#0.00", new System.Globalization.CultureInfo("en-US")); - @trendChangeOutput% + if ((mps.MarketTrendChanges[marketTrend.Name] > marketTrend.TrendThreshold) || (mps.MarketTrendChanges[marketTrend.Name] > marketTrend.TrendThreshold) ) + { +   @trendChangeOutput% + } + else + { + @trendChangeOutput% + } + } } @for (int i = 0; i < marketTrends.Count - marketTrendsDisplayed; i++) { From 0442c1db92603f91dae066123f40436ade3af3f7 Mon Sep 17 00:00:00 2001 From: HojouFotytu <36724681+HojouFotytu@users.noreply.github.com> Date: Tue, 9 Feb 2021 15:41:08 +0900 Subject: [PATCH 5/6] add TrendThreshold analyzer settings --- Monitor/Pages/_get/SettingsMarketTrends.cshtml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Monitor/Pages/_get/SettingsMarketTrends.cshtml b/Monitor/Pages/_get/SettingsMarketTrends.cshtml index 916e558..a4611bf 100644 --- a/Monitor/Pages/_get/SettingsMarketTrends.cshtml +++ b/Monitor/Pages/_get/SettingsMarketTrends.cshtml @@ -77,6 +77,14 @@ +
+ +
+ + Leave empty to exclude none +
+
+
From 0b7817dff1705a8cea5ef54522e3ffa1189b7bd6 Mon Sep 17 00:00:00 2001 From: HojouFotytu <36724681+HojouFotytu@users.noreply.github.com> Date: Tue, 9 Feb 2021 21:11:02 +0900 Subject: [PATCH 6/6] removed superfluous code --- Core/Main/PTMagic.cs | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/Core/Main/PTMagic.cs b/Core/Main/PTMagic.cs index d303014..19c986d 100644 --- a/Core/Main/PTMagic.cs +++ b/Core/Main/PTMagic.cs @@ -1642,12 +1642,6 @@ namespace Core.Main // Calculate average market change, skip any that are outside the threshold if enabled if (trendThreshold.TrendThreshold != 0) { - // Exclude trends outside the threshhold. - var excludedMarkets = from m in marketTrendChanges - where m.TrendChange > trendThreshold.TrendThreshold || m.TrendChange < (trendThreshold.TrendThreshold * -1.0) - orderby m.Market - select m; - var includedMarkets = from m in marketTrendChanges where m.TrendChange <= trendThreshold.TrendThreshold && m.TrendChange >= (trendThreshold.TrendThreshold * -1.0) orderby m.Market @@ -1851,12 +1845,6 @@ namespace Core.Main // Calculate average market change, skip any that are outside the threshold if enabled if (trendThreshold.TrendThreshold != 0) { - // Exclude trends outside the threshhold. - var excludedMarkets = from m in marketTrendChanges - where m.TrendChange > trendThreshold.TrendThreshold || m.TrendChange < (trendThreshold.TrendThreshold * -1.0) - orderby m.Market - select m; - var includedMarkets = from m in marketTrendChanges where m.TrendChange <= trendThreshold.TrendThreshold && m.TrendChange >= (trendThreshold.TrendThreshold * -1.0) orderby m.Market