From de1f1cb77f812b7e22303fb290eb04df359904ed Mon Sep 17 00:00:00 2001 From: HojouFotytu <36724681+HojouFotytu@users.noreply.github.com> Date: Sat, 4 May 2019 12:52:07 +0900 Subject: [PATCH 1/3] Monitor edits --- Monitor/Pages/SalesAnalyzer.cshtml | 7 ++----- Monitor/Pages/_get/DashboardBottom.cshtml | 10 ++++++++-- Monitor/Pages/_get/DashboardBottom.cshtml.cs | 3 ++- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/Monitor/Pages/SalesAnalyzer.cshtml b/Monitor/Pages/SalesAnalyzer.cshtml index 26a8476..f7716d2 100644 --- a/Monitor/Pages/SalesAnalyzer.cshtml +++ b/Monitor/Pages/SalesAnalyzer.cshtml @@ -25,14 +25,11 @@ currentBalanceString = Math.Round(currentBalance, 2).ToString("#,#0.00", new System.Globalization.CultureInfo("en-US")); } } - Estimated Account Value:     @currentBalanceString   @Model.Summary.MainMarket   - Starting Account Value:     @Model.PTMagicConfiguration.GeneralSettings.Application.StartBalance   @Model.Summary.MainMarket   + Account Value:   @currentBalanceString   @Model.Summary.MainMarket + Starting Value:   @Model.PTMagicConfiguration.GeneralSettings.Application.StartBalance   @Model.Summary.MainMarket - -

-

diff --git a/Monitor/Pages/_get/DashboardBottom.cshtml b/Monitor/Pages/_get/DashboardBottom.cshtml index e470cd3..16bad91 100644 --- a/Monitor/Pages/_get/DashboardBottom.cshtml +++ b/Monitor/Pages/_get/DashboardBottom.cshtml @@ -9,7 +9,6 @@ } -
@@ -24,7 +23,14 @@
-

Asset Distribution

+ @{ + 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")); + } + } +
TCV:   @currentBalanceString   @Model.Summary.MainMarket  
diff --git a/Monitor/Pages/_get/DashboardBottom.cshtml.cs b/Monitor/Pages/_get/DashboardBottom.cshtml.cs index 428e19c..9a5c5c0 100644 --- a/Monitor/Pages/_get/DashboardBottom.cshtml.cs +++ b/Monitor/Pages/_get/DashboardBottom.cshtml.cs @@ -17,6 +17,8 @@ namespace Monitor.Pages { public string LastGlobalSetting = "Default"; public DateTimeOffset DateTimeNow = Constants.confMinDate; public string AssetDistributionData = ""; + public double currentBalance = 0; + public string currentBalanceString = ""; public void OnGet() { // Initialize Config base.Init(); @@ -149,7 +151,6 @@ namespace Monitor.Pages { AssetDistributionData += "{label: 'Pairs',color: '#82E0AA',value: " + PairsBalance.ToString() + "},"; AssetDistributionData += "{label: 'DCA',color: '#D98880',value: " + DCABalance.ToString() + "},"; AssetDistributionData += "{label: 'Pending',color: '#F5B041',value: " + PendingBalance.ToString() + "},"; - AssetDistributionData += "{label: 'Dust',color: '#BB8FCE',value: " + DustBalance.ToString() + "},"; AssetDistributionData += "{label: 'Balance',color: '#85C1E9',value: " + AvailableBalance.ToString() + "}]"; } } From 4abb4aa6bc1361b8a118529910035cdaec49391b Mon Sep 17 00:00:00 2001 From: HojouFotytu <36724681+HojouFotytu@users.noreply.github.com> Date: Sat, 4 May 2019 20:57:49 +0900 Subject: [PATCH 2/3] Add Pending Log --- Core/DataObjects/ProfitTrailerData.cs | 64 ++++++++++++++++++++++++++- 1 file changed, 62 insertions(+), 2 deletions(-) diff --git a/Core/DataObjects/ProfitTrailerData.cs b/Core/DataObjects/ProfitTrailerData.cs index e4c6e9d..4c7bca1 100644 --- a/Core/DataObjects/ProfitTrailerData.cs +++ b/Core/DataObjects/ProfitTrailerData.cs @@ -71,7 +71,7 @@ namespace Core.Main.DataObjects { if (rawPTData.dcaLogData != null) { - this.BuildDCALogData(rawPTData.dcaLogData, rawPTData.gainLogData, _systemConfiguration); + this.BuildDCALogData(rawPTData.dcaLogData, rawPTData.gainLogData, rawPTData.pendingLogData, _systemConfiguration); } }); @@ -245,7 +245,7 @@ namespace Core.Main.DataObjects } } - private void BuildDCALogData(dynamic rawDCALogData, dynamic rawPairsLogData, PTMagicConfiguration systemConfiguration) + private void BuildDCALogData(dynamic rawDCALogData, dynamic rawPairsLogData, dynamic rawPendingLogData, PTMagicConfiguration systemConfiguration) { foreach (var rdld in rawDCALogData) { @@ -399,6 +399,66 @@ namespace Core.Main.DataObjects _dcaLog.Add(dcaLogData); } + + foreach (var rpld in rawPendingLogData) + { + DCALogData dcaLogData = new DCALogData(); + dcaLogData.Amount = rpld.totalAmount; + dcaLogData.BoughtTimes = 0; + dcaLogData.Market = rpld.market; + dcaLogData.ProfitPercent = rpld.profit; + dcaLogData.AverageBuyPrice = rpld.avgPrice; + dcaLogData.TotalCost = rpld.totalCost; + dcaLogData.BuyTriggerPercent = rpld.buyProfit; + dcaLogData.CurrentPrice = rpld.currentPrice; + dcaLogData.SellTrigger = rpld.triggerValue == null ? 0 : rpld.triggerValue; + dcaLogData.PercChange = rpld.percChange; + dcaLogData.BuyStrategy = rpld.buyStrategy == null ? "" : rpld.buyStrategy; + dcaLogData.SellStrategy = rpld.sellStrategy == null ? "" : rpld.sellStrategy; + dcaLogData.IsTrailing = false; + + if (rpld.sellStrategies != null) + { + foreach (var ss in rpld.sellStrategies) + { + Strategy sellStrategy = new Strategy(); + sellStrategy.Type = ss.type; + sellStrategy.Name = ss.name; + sellStrategy.EntryValue = ss.entryValue; + sellStrategy.EntryValueLimit = ss.entryValueLimit; + sellStrategy.TriggerValue = ss.triggerValue; + sellStrategy.CurrentValue = ss.currentValue; + sellStrategy.CurrentValuePercentage = ss.currentValuePercentage; + sellStrategy.Decimals = ss.decimals; + sellStrategy.IsTrailing = ((string)ss.positive).IndexOf("trailing", StringComparison.InvariantCultureIgnoreCase) > -1; + sellStrategy.IsTrue = ((string)ss.positive).IndexOf("true", StringComparison.InvariantCultureIgnoreCase) > -1; + + dcaLogData.SellStrategies.Add(sellStrategy); + } + } + + //Convert Unix Timestamp to Datetime + System.DateTime rpldDateTime = new DateTime(1970, 1, 1, 0, 0, 0, System.DateTimeKind.Utc); + rpldDateTime = rpldDateTime.AddSeconds((double)rpld.firstBoughtDate).ToUniversalTime(); + + // Profit Trailer bought times are saved in UTC + if (rpld.firstBoughtDate > 0) + { + DateTimeOffset ptFirstBoughtDate = DateTimeOffset.Parse(rpldDateTime.Year.ToString() + "-" + rpldDateTime.Month.ToString("00") + "-" + rpldDateTime.Day.ToString("00") + "T" + rpldDateTime.Hour.ToString("00") + ":" + rpldDateTime.Minute.ToString("00") + ":" + rpldDateTime.Second.ToString("00"), CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal); + + // Convert UTC bought time to local offset time + TimeSpan offsetTimeSpan = TimeSpan.Parse(systemConfiguration.GeneralSettings.Application.TimezoneOffset.Replace("+", "")); + ptFirstBoughtDate = ptFirstBoughtDate.ToOffset(offsetTimeSpan); + + dcaLogData.FirstBoughtDate = ptFirstBoughtDate.DateTime; + } + else + { + dcaLogData.FirstBoughtDate = Constants.confMinDate; + } + + _dcaLog.Add(dcaLogData); + } } private void BuildBuyLogData(dynamic rawBuyLogData) From 5fb9e5d847240c73a808e70fa5760cdbfcf3e70f Mon Sep 17 00:00:00 2001 From: HojouFotytu <36724681+HojouFotytu@users.noreply.github.com> Date: Sat, 4 May 2019 21:11:29 +0900 Subject: [PATCH 3/3] Update dashboard title --- Monitor/Pages/_get/DashboardTop.cshtml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Monitor/Pages/_get/DashboardTop.cshtml b/Monitor/Pages/_get/DashboardTop.cshtml index 0bac1c1..b559b89 100644 --- a/Monitor/Pages/_get/DashboardTop.cshtml +++ b/Monitor/Pages/_get/DashboardTop.cshtml @@ -82,11 +82,11 @@
-

Pairs & DCA (@Model.PTData.DCALog.Count)more

+

Pairs / DCA / Pending (@Model.PTData.DCALog.Count)more

@if (Model.PTData.DCALog.Count == 0) { -

Your Profit Trailer did not buy anything so far that's worth analyzing.

+

Profit Trailer is not reporting any holdings on your exchange.

} else {