From fe32db20c55ded29f049efb889ef0372423ad593 Mon Sep 17 00:00:00 2001 From: HojouFotytu <36724681+HojouFotytu@users.noreply.github.com> Date: Fri, 17 Jul 2020 19:26:33 +0900 Subject: [PATCH] Target Profit Leverage Adjustment --- Monitor/Pages/_get/DashboardBottom.cshtml.cs | 4 -- Monitor/Pages/_get/DashboardTop.cshtml | 49 ++++++++++++++++---- 2 files changed, 40 insertions(+), 13 deletions(-) diff --git a/Monitor/Pages/_get/DashboardBottom.cshtml.cs b/Monitor/Pages/_get/DashboardBottom.cshtml.cs index 5221f1d..7fa28c2 100644 --- a/Monitor/Pages/_get/DashboardBottom.cshtml.cs +++ b/Monitor/Pages/_get/DashboardBottom.cshtml.cs @@ -153,17 +153,13 @@ namespace Monitor.Pages { { // Loop through the pairs preparing the data for display Core.Main.DataObjects.PTMagicData.MarketPairSummary mps = null; - string sellStrategyText = Core.ProfitTrailer.StrategyHelper.GetStrategyText(Summary, dcaLogEntry.SellStrategies, dcaLogEntry.SellStrategy, isSellStrategyTrue, isTrailingSellActive); - bool dcaEnabled = true; if (mps != null) { dcaEnabled = mps.IsDCAEnabled; } - // Aggregate totals - if (sellStrategyText.Contains("PENDING")) { PendingBalance = PendingBalance + (dcaLogEntry.Amount * dcaLogEntry.CurrentPrice); diff --git a/Monitor/Pages/_get/DashboardTop.cshtml b/Monitor/Pages/_get/DashboardTop.cshtml index 90c7de1..bcdb82c 100644 --- a/Monitor/Pages/_get/DashboardTop.cshtml +++ b/Monitor/Pages/_get/DashboardTop.cshtml @@ -93,12 +93,12 @@ Market - 24H Trend + 24H Cost - DCA Buy Strats - Sell Strats - Target Profit + DCA + Sell + Target Profit @@ -137,11 +137,35 @@ } bool buyDisabled = false; + string leverage = ""; + double leverageValue = 0; + string buyStrategyText = Core.ProfitTrailer.StrategyHelper.GetStrategyText(Model.Summary, dcaLogEntry.BuyStrategies, dcaLogEntry.BuyStrategy, isBuyStrategyTrue, isTrailingBuyActive); - if (!Core.ProfitTrailer.StrategyHelper.IsValidStrategy(buyStrategyText, true)) { + + if (!Core.ProfitTrailer.StrategyHelper.IsValidStrategy(buyStrategyText, true)) + { buyDisabled = true; } + + + if (buyStrategyText.Contains("CROSSED")) + { + string leverageText = buyStrategyText.Remove(0, buyStrategyText.IndexOf("CROSSED")+9); + leverage = leverageText.Remove(leverageText.IndexOf(".0)"), leverageText.Length - leverageText.IndexOf(".0)")); + leverageValue = double.Parse(leverage); + Write(leverageValue); + } + if (buyStrategyText.Contains("ISOLATED")) + { + leverage = buyStrategyText.Remove(0, 10); + leverage = leverage.Remove(leverage.Length - 3, 3); + //leverageValue = double.Parse(leverage); + Write(leverage); + } + + + string sellStrategyText = Core.ProfitTrailer.StrategyHelper.GetStrategyText(Model.Summary, dcaLogEntry.SellStrategies, dcaLogEntry.SellStrategy, isSellStrategyTrue, isTrailingSellActive); // Check for when PT loses the value of a pair @@ -197,13 +221,20 @@ } - @Html.Raw(buyStrategyText) - @Html.Raw(sellStrategyText) - @Html.Raw(dcaLogEntry.TargetGainValue.HasValue ? dcaLogEntry.TargetGainValue.Value.ToString("#,#0.00", new System.Globalization.CultureInfo("en-US")) + "%" : " ") - + + @if (leverageValue == 0) + { + @Html.Raw(dcaLogEntry.TargetGainValue.HasValue ? dcaLogEntry.TargetGainValue.Value.ToString("#,#0.00", new System.Globalization.CultureInfo("en-US")) + "%" : " ") + } + else + { + double leverageTargetGain = leverageValue * dcaLogEntry.TargetGainValue.Value; + @Html.Raw(dcaLogEntry.TargetGainValue.HasValue ? leverageTargetGain.ToString("#,#0.00", new System.Globalization.CultureInfo("en-US")) + "%" : " ") + } + @if(!@lostValue) { @dcaLogEntry.ProfitPercent.ToString("#,#0.00", new System.Globalization.CultureInfo("en-US"))%