fix TCV on Sales Analyzer Page

This commit is contained in:
HojouFotytu 2020-07-22 16:48:40 +09:00
parent 7d57914549
commit 9afb3df9ee
3 changed files with 22 additions and 11 deletions

View File

@ -19,13 +19,13 @@
<thead>
<tr>
@{
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"));
}
}
<th class="m-t-0 header-title text-left">Account Value: &nbsp; <text class="text-autocolor"> @currentBalanceString &nbsp; @Model.Summary.MainMarket </text> <small> <i class="fa fa-info-circle text-muted" data-toggle="tooltip" data-placement="top" title="This is based on your sales history, entries on the Transactions page and any currently held positions."></i></small></th>
<th class="m-t-0 header-title text-left">Total Account Value: &nbsp; <text class="text-autocolor"> @totalCurrentValueString @Model.Summary.MainMarket </text> <small> <i class="fa fa-info-circle text-muted" data-toggle="tooltip" data-placement="top" title="This is based on your sales history, entries on the Transactions page and any currently held positions."></i></small></th>
<th class="text-right">Starting Value: &nbsp; <text class="text-autocolor"> @Model.PTMagicConfiguration.GeneralSettings.Application.StartBalance &nbsp; @Model.Summary.MainMarket </text> <small> <i class="fa fa-info-circle text-muted" data-toggle="tooltip" data-placement="top" title="This is the starting value found in your settings file"></i></small></th>
</tr>
</thead>

View File

@ -20,12 +20,13 @@ namespace Monitor.Pages
public Dictionary<DateTime, double> DailyGains = new Dictionary<DateTime, double>();
public Dictionary<DateTime, double> MonthlyGains = new Dictionary<DateTime, double>();
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;
}
}
}

View File

@ -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