From 2ea0ec698a6ae152b0fcefca6a4f63d7017f0305 Mon Sep 17 00:00:00 2001
From: HojouFotytu <36724681+HojouFotytu@users.noreply.github.com>
Date: Tue, 15 Oct 2019 22:05:53 +0900
Subject: [PATCH] Bag Totals and Bug Fixes
---
Core/DataObjects/ProfitTrailerData.cs | 2 +-
Core/ProfitTrailer/StrategyHelper.cs | 2 +-
Monitor/Pages/BagAnalyzer.cshtml | 2 +-
Monitor/Pages/_get/DashboardTop.cshtml | 13 ++++++++++++-
Monitor/Pages/_get/DashboardTop.cshtml.cs | 4 +++-
Monitor/wwwroot/assets/js/analyzer-settings.js | 2 +-
6 files changed, 19 insertions(+), 6 deletions(-)
diff --git a/Core/DataObjects/ProfitTrailerData.cs b/Core/DataObjects/ProfitTrailerData.cs
index 99a206e..e951049 100644
--- a/Core/DataObjects/ProfitTrailerData.cs
+++ b/Core/DataObjects/ProfitTrailerData.cs
@@ -615,7 +615,7 @@ namespace Core.Main.DataObjects
buyStrategy.IsTrue = ((string)(bs.positive)).IndexOf("true", StringComparison.InvariantCultureIgnoreCase) > -1;
// Is SOM?
- buyLogData.IsSom = buyLogData.IsSom || buyStrategy.Name.Equals("som enabled", StringComparison.OrdinalIgnoreCase);
+ buyLogData.IsSom = buyLogData.IsSom || buyStrategy.Name.Contains("som enabled", StringComparison.OrdinalIgnoreCase);
// Is the pair trailing?
buyLogData.IsTrailing = buyLogData.IsTrailing || buyStrategy.IsTrailing;
diff --git a/Core/ProfitTrailer/StrategyHelper.cs b/Core/ProfitTrailer/StrategyHelper.cs
index ff30efe..7b0fbf1 100644
--- a/Core/ProfitTrailer/StrategyHelper.cs
+++ b/Core/ProfitTrailer/StrategyHelper.cs
@@ -336,7 +336,7 @@ namespace Core.ProfitTrailer
case "anderson":
result = String.Concat(strategyLetter, "AND");
break;
- case "som enabled":
+ case "config som enabled":
result = String.Concat(strategyLetter, "SOM");
break;
case "max buy times":
diff --git a/Monitor/Pages/BagAnalyzer.cshtml b/Monitor/Pages/BagAnalyzer.cshtml
index e2a3e3f..de6e9a9 100644
--- a/Monitor/Pages/BagAnalyzer.cshtml
+++ b/Monitor/Pages/BagAnalyzer.cshtml
@@ -30,7 +30,7 @@
Market |
Trend |
Amount |
- Value |
+ Cost |
DCA |
Buy Strats |
BS Value |
diff --git a/Monitor/Pages/_get/DashboardTop.cshtml b/Monitor/Pages/_get/DashboardTop.cshtml
index bc1377f..e41e687 100644
--- a/Monitor/Pages/_get/DashboardTop.cshtml
+++ b/Monitor/Pages/_get/DashboardTop.cshtml
@@ -94,7 +94,7 @@
Market |
24H Trend |
- Value |
+ Cost |
|
DCA Buy Strats |
Sell Strats |
@@ -147,6 +147,11 @@
bool lostValue = false;
lostValue = (dcaLogEntry.TotalCost == 0.0) || (dcaLogEntry.AverageBuyPrice == 0.0);
+ // Aggregate totals
+ Model.TotalBagCost = Model.TotalBagCost + dcaLogEntry.TotalCost;
+ double TradingFee = (dcaLogEntry.Amount * dcaLogEntry.CurrentPrice) * 0.002;
+ Model.TotalBagValue = Model.TotalBagValue + ((dcaLogEntry.Amount * dcaLogEntry.CurrentPrice) - TradingFee);
+
// Render the row
@if (mps == null || mps.ActiveSingleSettings == null || mps.ActiveSingleSettings.Count == 0) {
@@ -185,6 +190,12 @@
|
}
+
+ Totals: | |
+ @Html.Raw(Model.TotalBagCost.ToString("#,#0.000000", new System.Globalization.CultureInfo("en-US"))) |
+ | | |
+ @Html.Raw((((Model.TotalBagValue - Model.TotalBagCost) / Model.TotalBagCost) * 100).ToString("#,#0.00", new System.Globalization.CultureInfo("en-US")))% |
+
diff --git a/Monitor/Pages/_get/DashboardTop.cshtml.cs b/Monitor/Pages/_get/DashboardTop.cshtml.cs
index 9c4824e..d01629a 100644
--- a/Monitor/Pages/_get/DashboardTop.cshtml.cs
+++ b/Monitor/Pages/_get/DashboardTop.cshtml.cs
@@ -11,7 +11,7 @@ namespace Monitor.Pages {
public class DashboardTopModel : _Internal.BasePageModelSecureAJAX {
public ProfitTrailerData PTData = null;
public DateTimeOffset DateTimeNow = Constants.confMinDate;
-
+
public void OnGet() {
// Initialize Config
base.Init();
@@ -19,6 +19,8 @@ namespace Monitor.Pages {
BindData();
}
+ public double TotalBagCost = 0;
+ public double TotalBagValue = 0;
private void BindData() {
PTData = this.PtDataObject;
diff --git a/Monitor/wwwroot/assets/js/analyzer-settings.js b/Monitor/wwwroot/assets/js/analyzer-settings.js
index 405a6c7..b273f0a 100644
--- a/Monitor/wwwroot/assets/js/analyzer-settings.js
+++ b/Monitor/wwwroot/assets/js/analyzer-settings.js
@@ -93,7 +93,7 @@ const PropertyTemplate = ({ settingType, settingName, propertyType, propertyKey,