Merge pull request #208 from djbadders/develop
Fixed UI issues, exposed buy volume data
This commit is contained in:
commit
beaac8a0dd
|
@ -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<Strategy> BuyStrategies { get; set; } = new List<Strategy>();
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -31,12 +31,14 @@
|
|||
totalCurrentValueString = Math.Round(Model.totalCurrentValue, 2).ToString("#,#0.00", new System.Globalization.CultureInfo("en-US"));
|
||||
}
|
||||
}
|
||||
<div class="text-center"><small>TCV: <text class="text-autocolor"> @totalCurrentValueString @Model.Summary.MainMarket </text> </small></div>
|
||||
<div id="AssetDistribution">
|
||||
<svg style="height:230px;width:100%"></svg>
|
||||
<div class="text">
|
||||
<small>Start: <text class="text-autocolor"> @Model.PTMagicConfiguration.GeneralSettings.Application.StartBalance @Model.Summary.MainMarket </text>
|
||||
<text class="pull-right">Gain: <text class="text-autocolor"> @Math.Round(((Model.totalCurrentValue - Model.PTMagicConfiguration.GeneralSettings.Application.StartBalance) / Model.PTMagicConfiguration.GeneralSettings.Application.StartBalance) * 100, 2) %</text></small>
|
||||
<div id="AssetDistribution" class="container">
|
||||
<div class="row px1">
|
||||
<div class="col-3 px-1 text-center"><small>Start: <text class="text-autocolor">@Model.PTMagicConfiguration.GeneralSettings.Application.StartBalance @Model.Summary.MainMarket</text></small></div>
|
||||
<div class="col-6 px-1 text-center"><small>TCV: <text class="text-autocolor">@totalCurrentValueString @Model.Summary.MainMarket</text></small></div>
|
||||
<div class="col-3 px-1 text-center"><small>Gain: <text class="text-autocolor">@Math.Round(((Model.totalCurrentValue - Model.PTMagicConfiguration.GeneralSettings.Application.StartBalance) / Model.PTMagicConfiguration.GeneralSettings.Application.StartBalance) * 100, 2)%</text></small></div>
|
||||
</div>
|
||||
<div class="row px1">
|
||||
<svg style="height:260px;width:100%"></svg>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -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<MarketTrend> MarketTrends { get; set; } = new List<MarketTrend>();
|
||||
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<MarketTrendChange> 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<MarketTrendChange> 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<MarketTrendChange> 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,8 +165,8 @@ namespace Monitor.Pages {
|
|||
double DCABalance = 0.0;
|
||||
double PendingBalance = 0.0;
|
||||
double AvailableBalance = PTData.GetCurrentBalance();
|
||||
bool isSellStrategyTrue =false;
|
||||
bool isTrailingSellActive =false;
|
||||
bool isSellStrategyTrue = false;
|
||||
bool isTrailingSellActive = false;
|
||||
|
||||
foreach (Core.Main.DataObjects.PTMagicData.DCALogData dcaLogEntry in PTData.DCALog)
|
||||
{
|
||||
|
|
|
@ -18,9 +18,9 @@
|
|||
<thead>
|
||||
<tr>
|
||||
<th>Market</th>
|
||||
<th class="text-right" data-toggle="tooltip" data-placement="top" title="Current ask price for this market">Ask</th>
|
||||
<th class="text-right" data-toggle="tooltip" data-placement="top" title="Current Volume">Volume</th>
|
||||
<th class="text-right" data-toggle="tooltip" data-placement="top" title="24 Hour Trend">24H</th>
|
||||
<th class="text-left" data-toggle="tooltip" data-placement="top" title="Current ask price for this market">Ask</th>
|
||||
<th class="text-left" data-toggle="tooltip" data-placement="top" title="Current Volume">Volume</th>
|
||||
<th class="text-left" data-toggle="tooltip" data-placement="top" title="24 Hour Trend">24H</th>
|
||||
<th>Buy Strategies</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
@ -59,8 +59,8 @@
|
|||
} else {
|
||||
<th class="align-top"><a href="@Core.Helper.SystemHelper.GetMarketLink(Model.PTMagicConfiguration.GeneralSettings.Monitor.LinkPlatform,Model.PTMagicConfiguration.GeneralSettings.Application.Exchange, buyLogEntry.Market, Model.Summary.MainMarket)" target="_blank">@buyLogEntry.Market</a> <i class="fa fa-exclamation-triangle text-highlight" data-toggle="tooltip" data-placement="top" data-html="true" title="@await Component.InvokeAsync("PairIcon", mps)" data-template="<div class='tooltip' role='tooltip'><div class='tooltip-arrow'></div><div class='tooltip-inner pair-tooltip'></div></div>"></i></th>
|
||||
}
|
||||
<td class="text-right">@buyLogEntry.CurrentPrice.ToString("#,#0.00000000", new System.Globalization.CultureInfo("en-US"))</td>
|
||||
<td class="text">@string.Format("{0}", (buyLogEntry.Volume).ToString())</td>
|
||||
<td class="text-left">@buyLogEntry.CurrentPrice.ToString("#,#0.00000000", new System.Globalization.CultureInfo("en-US"))</td>
|
||||
<td class="text">@string.Format("{0}", (buyLogEntry.Volume24h).ToString())</td>
|
||||
<td class="text-autocolor">@string.Format("{0}%", (buyLogEntry.PercChange * 100).ToString("#,#0.00"))</td>
|
||||
@if (buyDisabled) {
|
||||
<td>@Html.Raw(buyStrategyText)</td>
|
||||
|
|
Loading…
Reference in New Issue