From 9afb3df9ee89f0859750303ed1213926713bdf2e Mon Sep 17 00:00:00 2001 From: HojouFotytu <36724681+HojouFotytu@users.noreply.github.com> Date: Wed, 22 Jul 2020 16:48:40 +0900 Subject: [PATCH] fix TCV on Sales Analyzer Page --- Monitor/Pages/SalesAnalyzer.cshtml | 10 +++++----- Monitor/Pages/SalesAnalyzer.cshtml.cs | 18 +++++++++++++++++- Monitor/Pages/_get/DashboardBottom.cshtml.cs | 5 ----- 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/Monitor/Pages/SalesAnalyzer.cshtml b/Monitor/Pages/SalesAnalyzer.cshtml index f7716d2..cdf53d3 100644 --- a/Monitor/Pages/SalesAnalyzer.cshtml +++ b/Monitor/Pages/SalesAnalyzer.cshtml @@ -19,13 +19,13 @@ @{ - double currentBalance = Model.PTData.GetCurrentBalance(); - string currentBalanceString = currentBalance.ToString("#,#0.00000000", new System.Globalization.CultureInfo("en-US")); - if (currentBalance > 100) { - currentBalanceString = Math.Round(currentBalance, 2).ToString("#,#0.00", new System.Globalization.CultureInfo("en-US")); + string totalCurrentValueString = Model.totalCurrentValue.ToString("#,#0.00000000", new System.Globalization.CultureInfo("en-US")); + if (Model.totalCurrentValue > 100) + { + totalCurrentValueString = Math.Round(Model.totalCurrentValue, 2).ToString("#,#0.00", new System.Globalization.CultureInfo("en-US")); } } - Account Value:   @currentBalanceString   @Model.Summary.MainMarket + Total Account Value:   @totalCurrentValueString @Model.Summary.MainMarket Starting Value:   @Model.PTMagicConfiguration.GeneralSettings.Application.StartBalance   @Model.Summary.MainMarket diff --git a/Monitor/Pages/SalesAnalyzer.cshtml.cs b/Monitor/Pages/SalesAnalyzer.cshtml.cs index dd8f41a..7c262bd 100644 --- a/Monitor/Pages/SalesAnalyzer.cshtml.cs +++ b/Monitor/Pages/SalesAnalyzer.cshtml.cs @@ -20,12 +20,13 @@ namespace Monitor.Pages public Dictionary DailyGains = new Dictionary(); public Dictionary MonthlyGains = new Dictionary(); public DateTimeOffset DateTimeNow = Constants.confMinDate; - + public double totalCurrentValue = 0; public void OnGet() { base.Init(); BindData(); + BuildTCV(); } private void BindData() @@ -135,5 +136,20 @@ namespace Monitor.Pages } } } + + private void BuildTCV() + { + double AvailableBalance = PTData.GetCurrentBalance(); + foreach (Core.Main.DataObjects.PTMagicData.DCALogData dcaLogEntry in PTData.DCALog) + { + totalCurrentValue = totalCurrentValue + ((dcaLogEntry.Amount * dcaLogEntry.CurrentPrice) / dcaLogEntry.Leverage); + } + totalCurrentValue = totalCurrentValue + AvailableBalance; + } + + + + + } } diff --git a/Monitor/Pages/_get/DashboardBottom.cshtml.cs b/Monitor/Pages/_get/DashboardBottom.cshtml.cs index 1d86478..daa0d0f 100644 --- a/Monitor/Pages/_get/DashboardBottom.cshtml.cs +++ b/Monitor/Pages/_get/DashboardBottom.cshtml.cs @@ -19,10 +19,6 @@ namespace Monitor.Pages public string LastGlobalSetting = "Default"; public DateTimeOffset DateTimeNow = Constants.confMinDate; public string AssetDistributionData = ""; - public double currentBalance = 0; - public string currentBalanceString = ""; - public double TotalBagCost = 0; - public double TotalBagValue = 0; public double totalCurrentValue = 0; public void OnGet() { @@ -170,7 +166,6 @@ namespace Monitor.Pages foreach (Core.Main.DataObjects.PTMagicData.DCALogData dcaLogEntry in PTData.DCALog) { - Core.Main.DataObjects.PTMagicData.MarketPairSummary mps = null; string sellStrategyText = Core.ProfitTrailer.StrategyHelper.GetStrategyText(Summary, dcaLogEntry.SellStrategies, dcaLogEntry.SellStrategy, isSellStrategyTrue, isTrailingSellActive); // Aggregate totals