diff --git a/Core/DataObjects/PTMagicData.cs b/Core/DataObjects/PTMagicData.cs index b847c6c..0489937 100644 --- a/Core/DataObjects/PTMagicData.cs +++ b/Core/DataObjects/PTMagicData.cs @@ -486,6 +486,7 @@ namespace Core.Main.DataObjects.PTMagicData public double CurrentPrice { get; set; } public int BoughtTimes { get; set; } public double PercChange { get; set; } + public double Volume24h { get; set; } public List BuyStrategies { get; set; } = new List(); } diff --git a/Core/DataObjects/ProfitTrailerData.cs b/Core/DataObjects/ProfitTrailerData.cs index 0e86115..230eb78 100644 --- a/Core/DataObjects/ProfitTrailerData.cs +++ b/Core/DataObjects/ProfitTrailerData.cs @@ -453,6 +453,7 @@ namespace Core.Main.DataObjects buyLogData.ProfitPercent = rbld.profit; buyLogData.CurrentPrice = rbld.currentPrice; buyLogData.PercChange = rbld.percChange; + buyLogData.Volume24h = rbld.volume; if (rbld.positive != null) { diff --git a/Monitor/Pages/_get/DashboardBottom.cshtml b/Monitor/Pages/_get/DashboardBottom.cshtml index 1051b58..7964e06 100644 --- a/Monitor/Pages/_get/DashboardBottom.cshtml +++ b/Monitor/Pages/_get/DashboardBottom.cshtml @@ -30,13 +30,15 @@ if (Model.totalCurrentValue > 100) { totalCurrentValueString = Math.Round(Model.totalCurrentValue, 2).ToString("#,#0.00", new System.Globalization.CultureInfo("en-US")); } - } -
TCV:   @totalCurrentValueString   @Model.Summary.MainMarket  
-
- -
- Start:   @Model.PTMagicConfiguration.GeneralSettings.Application.StartBalance @Model.Summary.MainMarket - Gain:   @Math.Round(((Model.totalCurrentValue - Model.PTMagicConfiguration.GeneralSettings.Application.StartBalance) / Model.PTMagicConfiguration.GeneralSettings.Application.StartBalance) * 100, 2) % + } +
+
+
Start: @Model.PTMagicConfiguration.GeneralSettings.Application.StartBalance @Model.Summary.MainMarket
+
TCV: @totalCurrentValueString @Model.Summary.MainMarket
+
Gain: @Math.Round(((Model.totalCurrentValue - Model.PTMagicConfiguration.GeneralSettings.Application.StartBalance) / Model.PTMagicConfiguration.GeneralSettings.Application.StartBalance) * 100, 2)%
+
+
+
diff --git a/Monitor/Pages/_get/DashboardBottom.cshtml.cs b/Monitor/Pages/_get/DashboardBottom.cshtml.cs index c291295..1d86478 100644 --- a/Monitor/Pages/_get/DashboardBottom.cshtml.cs +++ b/Monitor/Pages/_get/DashboardBottom.cshtml.cs @@ -8,8 +8,10 @@ using Core.Main.DataObjects; using Core.Main.DataObjects.PTMagicData; using Core.MarketAnalyzer; -namespace Monitor.Pages { - public class DashboardBottomModel : _Internal.BasePageModelSecureAJAX { +namespace Monitor.Pages +{ + public class DashboardBottomModel : _Internal.BasePageModelSecureAJAX + { public ProfitTrailerData PTData = null; public List MarketTrends { get; set; } = new List(); public string TrendChartDataJSON = ""; @@ -22,7 +24,8 @@ namespace Monitor.Pages { public double TotalBagCost = 0; public double TotalBagValue = 0; public double totalCurrentValue = 0; - public void OnGet() { + public void OnGet() + { // Initialize Config base.Init(); @@ -30,7 +33,8 @@ namespace Monitor.Pages { BuildAssetDistributionData(); } - private void BindData() { + private void BindData() + { PTData = this.PtDataObject; // Cleanup temp files @@ -41,7 +45,8 @@ namespace Monitor.Pages { DateTimeNow = DateTimeOffset.UtcNow.ToOffset(offsetTimeSpan); // Get last and current active setting - if (!String.IsNullOrEmpty(HttpContext.Session.GetString("LastGlobalSetting"))) { + if (!String.IsNullOrEmpty(HttpContext.Session.GetString("LastGlobalSetting"))) + { LastGlobalSetting = HttpContext.Session.GetString("LastGlobalSetting"); } HttpContext.Session.SetString("LastGlobalSetting", Summary.CurrentGlobalSetting.SettingName); @@ -52,23 +57,32 @@ namespace Monitor.Pages { BuildMarketTrendChartData(); BuildProfitChartData(); } - private void BuildMarketTrendChartData() { - if (MarketTrends.Count > 0) { + private void BuildMarketTrendChartData() + { + if (MarketTrends.Count > 0) + { TrendChartDataJSON = "["; int mtIndex = 0; - foreach (MarketTrend mt in MarketTrends) { - if (mt.DisplayGraph) { + foreach (MarketTrend mt in MarketTrends) + { + if (mt.DisplayGraph) + { string lineColor = ""; - if (mtIndex < Constants.ChartLineColors.Length) { + if (mtIndex < Constants.ChartLineColors.Length) + { lineColor = Constants.ChartLineColors[mtIndex]; - } else { + } + else + { lineColor = Constants.ChartLineColors[mtIndex - 20]; } - if (Summary.MarketTrendChanges.ContainsKey(mt.Name)) { + if (Summary.MarketTrendChanges.ContainsKey(mt.Name)) + { List marketTrendChangeSummaries = Summary.MarketTrendChanges[mt.Name]; - if (marketTrendChangeSummaries.Count > 0) { + if (marketTrendChangeSummaries.Count > 0) + { if (!TrendChartDataJSON.Equals("[")) TrendChartDataJSON += ","; TrendChartDataJSON += "{"; @@ -81,9 +95,11 @@ namespace Monitor.Pages { DateTime startDateTime = currentDateTime.AddHours(-PTMagicConfiguration.GeneralSettings.Monitor.GraphMaxTimeframeHours); DateTime endDateTime = currentDateTime; int trendChartTicks = 0; - for (DateTime tickTime = startDateTime; tickTime <= endDateTime; tickTime = tickTime.AddMinutes(PTMagicConfiguration.GeneralSettings.Monitor.GraphIntervalMinutes)) { + for (DateTime tickTime = startDateTime; tickTime <= endDateTime; tickTime = tickTime.AddMinutes(PTMagicConfiguration.GeneralSettings.Monitor.GraphIntervalMinutes)) + { List tickRange = marketTrendChangeSummaries.FindAll(m => m.TrendDateTime >= tickTime).OrderBy(m => m.TrendDateTime).ToList(); - if (tickRange.Count > 0) { + if (tickRange.Count > 0) + { MarketTrendChange mtc = tickRange.First(); if (tickTime != startDateTime) TrendChartDataJSON += ",\n"; if (Double.IsInfinity(mtc.TrendChange)) mtc.TrendChange = 0; @@ -94,7 +110,8 @@ namespace Monitor.Pages { } // Add most recent tick List latestTickRange = marketTrendChangeSummaries.OrderByDescending(m => m.TrendDateTime).ToList(); - if (latestTickRange.Count > 0) { + if (latestTickRange.Count > 0) + { MarketTrendChange mtc = latestTickRange.First(); if (trendChartTicks > 0) TrendChartDataJSON += ",\n"; if (Double.IsInfinity(mtc.TrendChange)) mtc.TrendChange = 0; @@ -111,15 +128,19 @@ namespace Monitor.Pages { } } - private void BuildProfitChartData() { + private void BuildProfitChartData() + { int tradeDayIndex = 0; string profitPerDayJSON = ""; - if (PTData.SellLog.Count > 0) { + if (PTData.SellLog.Count > 0) + { DateTime minSellLogDate = PTData.SellLog.OrderBy(sl => sl.SoldDate).First().SoldDate.Date; DateTime graphStartDate = DateTime.UtcNow.Date.AddDays(-30); if (minSellLogDate > graphStartDate) graphStartDate = minSellLogDate; - for (DateTime salesDate = graphStartDate; salesDate <= DateTime.UtcNow.Date; salesDate = salesDate.AddDays(1)) { - if (tradeDayIndex > 0) { + 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; @@ -144,10 +165,10 @@ namespace Monitor.Pages { double DCABalance = 0.0; double PendingBalance = 0.0; double AvailableBalance = PTData.GetCurrentBalance(); - bool isSellStrategyTrue =false; - bool isTrailingSellActive =false; - - foreach (Core.Main.DataObjects.PTMagicData.DCALogData dcaLogEntry in PTData.DCALog) + bool isSellStrategyTrue = false; + bool isTrailingSellActive = false; + + 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); @@ -157,30 +178,30 @@ namespace Monitor.Pages { { if (sellStrategyText.Contains("PENDING")) { - PendingBalance = PendingBalance + (dcaLogEntry.Amount * dcaLogEntry.CurrentPrice); + PendingBalance = PendingBalance + (dcaLogEntry.Amount * dcaLogEntry.CurrentPrice); } - else if (dcaLogEntry.BuyStrategies.Count > 0) + else if (dcaLogEntry.BuyStrategies.Count > 0) { - DCABalance = DCABalance + (dcaLogEntry.Amount * dcaLogEntry.CurrentPrice); + DCABalance = DCABalance + (dcaLogEntry.Amount * dcaLogEntry.CurrentPrice); } else { - PairsBalance = PairsBalance + (dcaLogEntry.Amount * dcaLogEntry.CurrentPrice); + PairsBalance = PairsBalance + (dcaLogEntry.Amount * dcaLogEntry.CurrentPrice); } } else { if (sellStrategyText.Contains("PENDING")) { - PendingBalance = PendingBalance + ((dcaLogEntry.Amount * dcaLogEntry.CurrentPrice) / dcaLogEntry.Leverage); + PendingBalance = PendingBalance + ((dcaLogEntry.Amount * dcaLogEntry.CurrentPrice) / dcaLogEntry.Leverage); } - else if (dcaLogEntry.BuyStrategies.Count > 0) + else if (dcaLogEntry.BuyStrategies.Count > 0) { - DCABalance = DCABalance + ((dcaLogEntry.Amount * dcaLogEntry.CurrentPrice) / dcaLogEntry.Leverage); + DCABalance = DCABalance + ((dcaLogEntry.Amount * dcaLogEntry.CurrentPrice) / dcaLogEntry.Leverage); } else { - PairsBalance = PairsBalance + ((dcaLogEntry.Amount * dcaLogEntry.CurrentPrice) / dcaLogEntry.Leverage); + PairsBalance = PairsBalance + ((dcaLogEntry.Amount * dcaLogEntry.CurrentPrice) / dcaLogEntry.Leverage); } } } diff --git a/Monitor/Pages/_get/DashboardTop.cshtml b/Monitor/Pages/_get/DashboardTop.cshtml index 0c0dec8..188ea87 100644 --- a/Monitor/Pages/_get/DashboardTop.cshtml +++ b/Monitor/Pages/_get/DashboardTop.cshtml @@ -18,9 +18,9 @@ Market - Ask - Volume - 24H + Ask + Volume + 24H Buy Strategies @@ -59,8 +59,8 @@ } else { @buyLogEntry.Market } - @buyLogEntry.CurrentPrice.ToString("#,#0.00000000", new System.Globalization.CultureInfo("en-US")) - @string.Format("{0}", (buyLogEntry.Volume).ToString()) + @buyLogEntry.CurrentPrice.ToString("#,#0.00000000", new System.Globalization.CultureInfo("en-US")) + @string.Format("{0}", (buyLogEntry.Volume24h).ToString()) @string.Format("{0}%", (buyLogEntry.PercChange * 100).ToString("#,#0.00")) @if (buyDisabled) { @Html.Raw(buyStrategyText)