diff --git a/Core/DataObjects/ProfitTrailerData.cs b/Core/DataObjects/ProfitTrailerData.cs index 813545a..e4c6e9d 100644 --- a/Core/DataObjects/ProfitTrailerData.cs +++ b/Core/DataObjects/ProfitTrailerData.cs @@ -161,6 +161,28 @@ namespace Core.Main.DataObjects this.Summary.PendingValue + this.Summary.DustValue); } + public double GetPairsBalance() + { + return + (this.Summary.PairsValue); + } + public double GetDCABalance() + { + return + (this.Summary.DCAValue); + } + public double GetPendingBalance() + { + return + (this.Summary.PendingValue); + } + public double GetDustBalance() + { + return + (this.Summary.DustValue); + } + + public double GetSnapshotBalance(DateTime snapshotDateTime) { diff --git a/Monitor/Pages/SalesAnalyzer.cshtml b/Monitor/Pages/SalesAnalyzer.cshtml index 7905010..26a8476 100644 --- a/Monitor/Pages/SalesAnalyzer.cshtml +++ b/Monitor/Pages/SalesAnalyzer.cshtml @@ -15,8 +15,6 @@
- - diff --git a/Monitor/Pages/_get/DashboardBottom.cshtml b/Monitor/Pages/_get/DashboardBottom.cshtml index bd00504..b571626 100644 --- a/Monitor/Pages/_get/DashboardBottom.cshtml +++ b/Monitor/Pages/_get/DashboardBottom.cshtml @@ -4,6 +4,11 @@ Layout = null; } +@section Styles { + + +} +
@@ -44,6 +49,39 @@
+
+
+

Asset Distribution

+
+ +
+
+
+
+
+ @if (!Model.ProfitChartDataJSON.Equals("")) { +
+ +
+ } else { +

Unable to load graph, no sales data found.

+ } +
+
+
+ +
+
+
+ @if (!Model.TrendChartDataJSON.Equals("")) { +
+ +
+ } else { +

Unable to load graph, no market trend data found.

+ } +
+

Sales Overviewmore

@@ -127,81 +165,84 @@
- -
- -
-
-
- @if (!Model.TrendChartDataJSON.Equals("")) { -
- -
- } else { -

Not able to load graph, no market trend data found.
If you still do not see a graph after more than hour, report an issue.

- } -
-
-
-
- @if (!Model.ProfitChartDataJSON.Equals("")) { -
- -
- } else { -

Not able to load graph, no sales data found.
If you still do not see a graph after you made your first sale, report an issue.

- } -
-
-
+ + + + \ No newline at end of file + return lineChart; + }); + + } + })(jQuery); + diff --git a/Monitor/Pages/_get/DashboardBottom.cshtml.cs b/Monitor/Pages/_get/DashboardBottom.cshtml.cs index c2153a9..46173a3 100644 --- a/Monitor/Pages/_get/DashboardBottom.cshtml.cs +++ b/Monitor/Pages/_get/DashboardBottom.cshtml.cs @@ -16,12 +16,13 @@ namespace Monitor.Pages { public string ProfitChartDataJSON = ""; public string LastGlobalSetting = "Default"; public DateTimeOffset DateTimeNow = Constants.confMinDate; - + public string AssetDistributionData = ""; public void OnGet() { // Initialize Config base.Init(); BindData(); + BuildAssetDistributionData(); } private void BindData() { @@ -87,7 +88,6 @@ namespace Monitor.Pages { trendChartTicks++; } } - // Add most recent tick List latestTickRange = marketTrendChangeSummaries.OrderByDescending(m => m.TrendDateTime).ToList(); if (latestTickRange.Count > 0) { @@ -115,22 +115,18 @@ namespace Monitor.Pages { string profitPerDayJSON = ""; if (PTData.SellLog.Count > 0) { DateTime minSellLogDate = PTData.SellLog.OrderBy(sl => sl.SoldDate).First().SoldDate.Date; - DateTime graphStartDate = DateTime.UtcNow.Date.AddDays(-30); + DateTime graphStartDate = DateTime.UtcNow.Date.AddDays(-10); if (minSellLogDate > graphStartDate) graphStartDate = minSellLogDate; for (DateTime salesDate = graphStartDate; salesDate <= DateTime.UtcNow.Date; salesDate = salesDate.AddDays(1)) { if (tradeDayIndex > 0) { profitPerDayJSON += ",\n"; } - int trades = PTData.SellLog.FindAll(t => t.SoldDate.Date == salesDate).Count; double profit = PTData.SellLog.FindAll(t => t.SoldDate.Date == salesDate).Sum(t => t.Profit); double profitFiat = Math.Round(profit * Summary.MainMarketPrice, 2); - profitPerDayJSON += "{x: new Date('" + salesDate.ToString("yyyy-MM-dd") + "'), y: " + profitFiat.ToString("0.00", new System.Globalization.CultureInfo("en-US")) + "}"; - tradeDayIndex++; } - ProfitChartDataJSON = "["; ProfitChartDataJSON += "{"; ProfitChartDataJSON += "key: 'Profit in " + Summary.MainFiatCurrency + "',"; @@ -140,5 +136,21 @@ namespace Monitor.Pages { ProfitChartDataJSON += "]"; } } + private void BuildAssetDistributionData() + { + double PairsBalance = PTData.GetPairsBalance(); + double DCABalance = PTData.GetDCABalance(); + double PendingBalance = PTData.GetPendingBalance(); + double DustBalance = PTData.GetDustBalance(); + double TotalValue = PTData.GetCurrentBalance(); + double AvailableBalance = (TotalValue - PairsBalance - DCABalance - PendingBalance - DustBalance); + + AssetDistributionData = "["; + 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() + "}]"; + } } }