PTMagic/Monitor/Pages/_get/DashboardBottom.cshtml

366 lines
18 KiB
Plaintext
Raw Normal View History

2018-05-22 10:11:50 +02:00
@page
@model DashboardBottomModel
@{
Layout = null;
}
2019-04-30 17:36:27 +02:00
@section Styles {
<link href="@Html.Raw(Model.PTMagicConfiguration.GeneralSettings.Monitor.RootUrl)assets/plugins/nvd3/nv.d3.min.css" rel="stylesheet" type="text/css" />
<link href="@Html.Raw(Model.PTMagicConfiguration.GeneralSettings.Monitor.RootUrl)assets/plugins/tablesaw/css/tablesaw.css" rel="stylesheet" type="text/css" />
}
2019-05-01 09:19:37 +02:00
<div class="row">
2021-01-25 13:30:06 +01:00
<div class="col-md-5 px-1">
2019-05-01 09:19:37 +02:00
<div class="card-box px-2" style="height:305px;">
2020-03-31 00:34:05 +02:00
<div class="cdev" data-percent="100" data-duration="@Html.Raw(@Model.PTMagicConfiguration.GeneralSettings.Monitor.RefreshSeconds * 1000)" data-color="#aaa,#414d59"></div>
2019-05-01 09:19:37 +02:00
@if (!Model.TrendChartDataJSON.Equals("")) {
<div class="trend-chart">
2020-03-31 00:34:05 +02:00
<svg style="height: 300px;width: 100%;"></svg>
2019-05-01 09:19:37 +02:00
</div>
} else {
<p>Unable to load graph, no market trend data found.</p>
}
</div>
</div>
<div class="col-md-3 px-1">
<div class="card-box px-3" style="height:305px;">
2024-01-07 22:53:49 +01:00
@*<div class="cdev" data-percent="100" data-duration="@Html.Raw(@Model.PTMagicConfiguration.GeneralSettings.Monitor.RefreshSeconds * 1000)" data-color="#aaa,#414d59"></div>*@
2019-05-04 05:52:07 +02:00
@{
2020-07-17 13:35:43 +02:00
string totalCurrentValueString = Model.totalCurrentValue.ToString("#,#0.00000000", new System.Globalization.CultureInfo("en-US"));
if (Model.totalCurrentValue > 100) {
totalCurrentValueString = Math.Round(Model.totalCurrentValue, 2).ToString("#,#0.00", new System.Globalization.CultureInfo("en-US"));
2019-05-04 05:52:07 +02:00
}
}
<div id="AssetDistribution" class="container">
2020-07-22 06:14:57 +02:00
<div class="text-center">
<small>
2024-01-07 22:53:49 +01:00
<span data-toggle="tooltip" data-placement="top" title="Starting balance from PTM settings">Start: &nbsp; <text class="text-autocolor"> @Model.SummaryData.StartBalance @Model.Summary.MainMarket </text></span>
<span data-toggle="tooltip" data-placement="top" title="TCV gain on starting balance"> &emsp; &emsp; Gain:&nbsp;<text class="text-autocolor">@Math.Round(((Model.totalCurrentValue - Model.SummaryData.StartBalance) / Model.SummaryData.StartBalance) * 100, 2)%</text></span>
2020-07-22 06:14:57 +02:00
</small>
</div>
<div class="text-center">
<span data-toggle="tooltip" data-placement="top" title="Total current account value">TCV: &nbsp; <text class="text-autocolor"> @totalCurrentValueString @Model.Summary.MainMarket </text> </span>
</div>
<div class="row px1">
<svg style="height:260px;width:100%"></svg>
</div>
2019-05-01 09:19:37 +02:00
</div>
</div>
</div>
2020-07-26 16:28:37 +02:00
2021-01-25 13:30:06 +01:00
<div class="col-md-4 px-1">
2024-01-07 22:53:49 +01:00
@*<div class="cdev" data-percent="100" data-duration="@Html.Raw(@Model.PTMagicConfiguration.GeneralSettings.Monitor.RefreshSeconds * 1000)" data-color="#aaa,#414d59"></div>*@
2019-05-01 09:19:37 +02:00
<div class="card-box px-2" style="height:305px;">
@if (!Model.ProfitChartDataJSON.Equals("")) {
<div class="profit-chart">
<svg style="height:300px;width:100%"></svg>
</div>
} else {
<p>Unable to load graph, no sales data found.</p>
}
</div>
</div>
</div>
2024-01-07 22:53:49 +01:00
2018-05-22 10:11:50 +02:00
<div class="row">
<div class="col-md-5 px-1">
<div class="card-box px-2">
<div class="cdev" data-percent="100" data-duration="@Html.Raw(@Model.PTMagicConfiguration.GeneralSettings.Monitor.RefreshSeconds * 1000)" data-color="#aaa,#414d59"></div>
<br>
2020-07-14 15:05:49 +02:00
<h4 class="m-t-0 m-b-20 header-title"><b>Market Trends at @Model.PTMagicConfiguration.GeneralSettings.Application.Exchange</b>
<small class="pull-right"><a href="@Html.Raw(Model.PTMagicConfiguration.GeneralSettings.Monitor.RootUrl)MarketAnalyzer">more</a></small></h4>
2018-12-19 15:40:44 +01:00
<table class="table table-sm">
<thead>
<tr>
<th>Name</th>
<th class="text-right">Markets</th>
<th class="text-right">Timeframe</th>
2021-02-01 09:28:22 +01:00
<th class="text-right" data-toggle="tooltip" data-placement="top" title="Pairs exceeding this threshold are excluded from the trend average.">Threshold %</th>
2018-12-19 15:40:44 +01:00
<th class="text-right">Change</th>
</tr>
</thead>
<tbody>
@foreach (var marketTrend in Model.MarketTrends.OrderBy(mt => mt.TrendMinutes)) {
2024-01-10 16:58:09 +01:00
if (Model.Summary.MarketTrendChanges.ContainsKey(marketTrend.Name)) {
double trendChange = Model.Summary.MarketTrendChanges[marketTrend.Name].Last().TrendChange;
string trendChangeOutput = trendChange.ToString("#,#0.00", new System.Globalization.CultureInfo("en-US"));
2018-12-19 15:40:44 +01:00
2024-01-10 16:58:09 +01:00
int marketCount = marketTrend.MaxMarkets;
string marketCountString = marketCount.ToString();
2018-12-19 15:40:44 +01:00
2024-01-10 16:58:09 +01:00
if (marketCount == 0) {
marketCountString = "All";
} else if (marketCount > Model.Summary.MarketSummary.Keys.Count && marketTrend.Platform.Equals("Exchange", StringComparison.InvariantCultureIgnoreCase)) {
marketCountString = Model.Summary.MarketSummary.Keys.Count.ToString();
2021-02-01 07:08:33 +01:00
}
2024-01-10 16:58:09 +01:00
// Cache the result of SplitCamelCase(marketTrend.Name)
string splitCamelCaseName = Core.Helper.SystemHelper.SplitCamelCase(marketTrend.Name);
<tr>
<td>@splitCamelCaseName</td> <!-- Use the cached value here -->
<td class="text-right">@marketCountString</td>
<td class="text-right">@Core.Helper.SystemHelper.GetProperDurationTime(marketTrend.TrendMinutes * 60, false)</td>
@if (marketTrend.TrendThreshold == 0)
{
<td class="text-right">--</td>
}
else
{
<td class="text-right">@marketTrend.TrendThreshold</td>
}
<td class="text-right text-autocolor">@trendChangeOutput%</td>
</tr>
}
2018-12-19 15:40:44 +01:00
}
</tbody>
</table>
</div>
</div>
2019-05-01 05:16:37 +02:00
<div class="col-md-7 px-1">
<div class="card-box px-2">
2024-01-07 22:53:49 +01:00
@*<div class="cdev" data-percent="100" data-duration="@Html.Raw(@Model.PTMagicConfiguration.GeneralSettings.Monitor.RefreshSeconds * 1000)" data-color="#aaa,#414d59"></div>
<br>*@
2018-05-22 10:11:50 +02:00
<h4 class="m-t-0 m-b-20 header-title"><b>Sales Overview</b><small class="pull-right"><a href="@Html.Raw(Model.PTMagicConfiguration.GeneralSettings.Monitor.RootUrl)SalesAnalyzer">more</a></small></h4>
2020-07-26 16:28:37 +02:00
@{
2018-05-22 10:11:50 +02:00
2024-01-07 22:53:49 +01:00
var overviewStats = Model.StatsData; // todaysStats is a new variable
var todaysSales = overviewStats.SalesToday;
var todaysProfit = overviewStats.ProfitToday;
var todaysFunding = overviewStats.FundingToday;
var todaysPercentGain = overviewStats.ProfitPercToday;
2024-01-07 22:53:49 +01:00
//var todaysFundingGain = todaysPercentGain * ((todaysProfit - todaysFunding) / todaysProfit);
var yesterdaysSales = overviewStats.SalesYesterday;
var yesterdaysProfit = overviewStats.ProfitYesterday;
var yesterdaysFunding = overviewStats.FundingYesterday;
var yesterdaysPercentGain = overviewStats.ProfitPercYesterday;
2024-01-07 22:53:49 +01:00
//var yesterdaysFundingGain = yesterdaysPercentGain * ((yesterdaysProfit + yesterdaysFunding) / yesterdaysProfit);
var last7DaysSales = overviewStats.SalesWeek;
var last7DaysProfit = overviewStats.ProfitWeek;
var last7DaysFunding = overviewStats.FundingWeek;
var last7DaysPercentGain = overviewStats.ProfitPercWeek;
2024-01-07 22:53:49 +01:00
//var last7DaysFundingGain = last7DaysPercentGain * ((last7DaysProfit + last7DaysFunding) / last7DaysProfit);
var thisMonthSales = overviewStats.SalesThisMonth;
var thisMonthProfit = overviewStats.ProfitThisMonth;
var thisMonthFunding = overviewStats.FundingThisMonth;
var thisMonthPercentGain = overviewStats.ProfitPercThisMonth;
//var thisMonthFundingGain = thisMonthPercentGain * ((thisMonthProfit + thisMonthFunding) / thisMonthProfit);
2024-01-07 22:53:49 +01:00
var lastMonthSales = overviewStats.SalesLastMonth;
var lastMonthProfit = overviewStats.ProfitLastMonth;
var lastMonthFunding = overviewStats.FundingLastMonth;
var lastMonthPercentGain = overviewStats.ProfitPercLastMonth;
//var lastMonthFundingGain = lastMonthPercentGain * ((lastMonthProfit + lastMonthFunding) / lastMonthProfit);
var totalSales = overviewStats.TotalSales;
var totalProfit = overviewStats.TotalProfit;
var totalFunding = overviewStats.FundingTotal;
var totalProfitPercent = overviewStats.TotalProfitPerc;
2024-01-07 22:53:49 +01:00
//var totalFundingGain = totalProfitPercent * ((totalProfit + totalFunding) / totalProfit);
2024-01-07 22:53:49 +01:00
double todaysProfitFiat = Math.Round((todaysProfit + todaysFunding) * Model.PTData.Summary.FiatConversionRate, 2);
double yesterdaysProfitFiat = Math.Round((yesterdaysProfit + yesterdaysFunding) * Model.PTData.Summary.FiatConversionRate, 2);
double last7DaysProfitFiat = Math.Round((last7DaysProfit + last7DaysFunding) * Model.PTData.Summary.FiatConversionRate, 2);
double thisMonthProfitFiat = Math.Round((thisMonthProfit + thisMonthFunding) * Model.PTData.Summary.FiatConversionRate, 2);
double lastMonthProfitFiat = Math.Round((lastMonthProfit + lastMonthFunding) * Model.PTData.Summary.FiatConversionRate, 2);
double totalProfitFiat = Math.Round((totalProfit + totalFunding) * Model.PTData.Summary.FiatConversionRate, 2);
2024-01-07 22:53:49 +01:00
bool futuresFunding = Model.PropertiesData.IsLeverageExchange;
2019-01-14 04:09:58 +01:00
}
2018-05-22 10:11:50 +02:00
<table class="table table-sm">
<thead>
<tr>
<th></th>
<th class="text-right">Sales</th>
2024-01-07 22:53:49 +01:00
<th class="text-right">Profit @Model.PTData.Summary.Market</th>
<th class="text-right">Gain</th>
2024-01-07 22:53:49 +01:00
@if (futuresFunding)
{
<th class="text-right">Funding</th>
}
<th class="text-right">@Model.PTData.Properties.Currency</th>
2018-05-22 10:11:50 +02:00
</tr>
</thead>
<tbody>
<tr>
<th>Today</th>
<td class="text-right">@overviewStats.SalesToday</td>
2018-05-22 10:11:50 +02:00
<td class="text-right text-autocolor">@todaysProfit.ToString("#,#0.00000000", new System.Globalization.CultureInfo("en-US"))</td>
2024-01-07 22:53:49 +01:00
<td class="text-right text-autocolor">@todaysPercentGain.ToString("#,#0.00", new System.Globalization.CultureInfo("en-US"))%</td>
@if (futuresFunding)
{
<td class="text-right text-autocolor">@todaysFunding.ToString("#,#0.00000000", new System.Globalization.CultureInfo("en-US"))</td>
}
<td class="text-right text-autocolor">@Html.Raw(todaysProfitFiat.ToString("#,#0.00", new System.Globalization.CultureInfo("en-US")))</td>
2018-05-22 10:11:50 +02:00
</tr>
<tr>
<th>Yesterday</th>
<td class="text-right">@yesterdaysSales</td>
2018-05-22 10:11:50 +02:00
<td class="text-right text-autocolor">@yesterdaysProfit.ToString("#,#0.00000000", new System.Globalization.CultureInfo("en-US"))</td>
2024-01-07 22:53:49 +01:00
<td class="text-right text-autocolor">@yesterdaysPercentGain.ToString("#,#0.00", new System.Globalization.CultureInfo("en-US"))%</td>
@if (futuresFunding)
{
<td class="text-right text-autocolor">@yesterdaysFunding.ToString("#,#0.00000000", new System.Globalization.CultureInfo("en-US"))</td>
}
<td class="text-right text-autocolor">@Html.Raw(yesterdaysProfitFiat.ToString("#,#0.00", new System.Globalization.CultureInfo("en-US")))</td>
2018-05-22 10:11:50 +02:00
</tr>
<tr>
<th>Last 7 Days</th>
<td class="text-right">@last7DaysSales</td>
2018-05-22 10:11:50 +02:00
<td class="text-right text-autocolor">@last7DaysProfit.ToString("#,#0.00000000", new System.Globalization.CultureInfo("en-US"))</td>
2024-01-07 22:53:49 +01:00
<td class="text-right text-autocolor">@last7DaysPercentGain.ToString("#,#0.00", new System.Globalization.CultureInfo("en-US"))%</td>
@if (futuresFunding)
{
<td class="text-right text-autocolor">@last7DaysFunding.ToString("#,#0.00000000", new System.Globalization.CultureInfo("en-US"))</td>
}
<td class="text-right text-autocolor">@Html.Raw(last7DaysProfitFiat.ToString("#,#0.00", new System.Globalization.CultureInfo("en-US")))</td>
2018-05-22 10:11:50 +02:00
</tr>
2019-01-14 04:09:58 +01:00
<tr>
2024-01-07 22:53:49 +01:00
<th>This Month</th>
<td class="text-right">@thisMonthSales</td>
<td class="text-right text-autocolor">@thisMonthProfit.ToString("#,#0.00000000", new System.Globalization.CultureInfo("en-US"))</td>
<td class="text-right text-autocolor">@thisMonthPercentGain.ToString("#,#0.00", new System.Globalization.CultureInfo("en-US"))%</td>
@if (futuresFunding)
{
<td class="text-right text-autocolor">@thisMonthFunding.ToString("#,#0.00000000", new System.Globalization.CultureInfo("en-US"))</td>
}
<td class="text-right text-autocolor">@Html.Raw(thisMonthProfitFiat.ToString("#,#0.00", new System.Globalization.CultureInfo("en-US")))</td>
</tr>
<tr>
<th>Last Month</th>
<td class="text-right">@lastMonthSales</td>
<td class="text-right text-autocolor">@lastMonthProfit.ToString("#,#0.00000000", new System.Globalization.CultureInfo("en-US"))</td>
<td class="text-right text-autocolor">@lastMonthPercentGain.ToString("#,#0.00", new System.Globalization.CultureInfo("en-US"))%</td>
@if (futuresFunding)
{
<td class="text-right text-autocolor">@lastMonthFunding.ToString("#,#0.00000000", new System.Globalization.CultureInfo("en-US"))</td>
}
<td class="text-right text-autocolor">@Html.Raw(lastMonthProfitFiat.ToString("#,#0.00", new System.Globalization.CultureInfo("en-US")))</td>
2019-01-14 04:09:58 +01:00
</tr>
2018-05-22 10:11:50 +02:00
<tr>
<th>Total</th>
<td class="text-right">@totalSales</td>
2018-05-22 10:11:50 +02:00
<td class="text-right text-autocolor">@totalProfit.ToString("#,#0.00000000", new System.Globalization.CultureInfo("en-US"))</td>
2024-01-07 22:53:49 +01:00
<td class="text-right text-autocolor">@totalProfitPercent.ToString("#,#0.00", new System.Globalization.CultureInfo("en-US"))%</td>
@if (futuresFunding)
{
<td class="text-right text-autocolor">@totalFunding.ToString("#,#0.00000000", new System.Globalization.CultureInfo("en-US"))</td>
}
<td class="text-right text-autocolor">@Html.Raw(totalProfitFiat.ToString("#,#0.00", new System.Globalization.CultureInfo("en-US")))</td>
2018-05-22 10:11:50 +02:00
</tr>
</tbody>
</table>
</div>
</div>
</div>
2019-04-30 17:36:27 +02:00
<script src="@Html.Raw(Model.PTMagicConfiguration.GeneralSettings.Monitor.RootUrl)assets/plugins/d3/d3.min.js"></script>
<script src="@Html.Raw(Model.PTMagicConfiguration.GeneralSettings.Monitor.RootUrl)assets/plugins/nvd3/nv.d3.min.js"></script>
<script src="@Html.Raw(Model.PTMagicConfiguration.GeneralSettings.Monitor.RootUrl)assets/plugins/tablesaw/js/tablesaw.js"></script>
<script src="@Html.Raw(Model.PTMagicConfiguration.GeneralSettings.Monitor.RootUrl)assets/plugins/tablesaw/js/tablesaw-init.js"></script>
2024-01-07 22:53:49 +01:00
2019-04-30 17:36:27 +02:00
<script type="text/javascript">
2024-01-07 22:53:49 +01:00
$(document).ready(function () {
$(".cdev").circlos();
$('[data-toggle="tooltip"]').tooltip();
$('.text-autocolor').autocolor(false);
var assetDistributionChart; // Keep a reference to the chart
var assetDistributionData; // Keep a reference to the data
@if (!Model.AssetDistributionData.Equals("")) {
<text>
nv.addGraph(function() {
assetDistributionChart = nv.models.pieChart()
.x(function(d) { return d.label })
.y(function(d) { return d.value })
.showLabels(true)
.labelThreshold(.1)
.labelType("percent")
.donut(true)
.donutRatio(0.3);
assetDistributionData = @Html.Raw(Model.AssetDistributionData);
2019-04-30 17:36:27 +02:00
d3.select("#AssetDistribution svg")
2024-01-07 22:53:49 +01:00
.datum(assetDistributionData)
.transition().duration(0)
.call(assetDistributionChart);
return assetDistributionChart;
2019-04-30 17:36:27 +02:00
});
2024-01-07 22:53:49 +01:00
</text>
}
});
</script>
2018-05-22 10:11:50 +02:00
2024-01-07 22:53:49 +01:00
<script type="text/javascript">
2018-05-22 10:11:50 +02:00
(function ($) {
'use strict';
$('[role="tooltip"]').remove();
$('[data-toggle="tooltip"]').tooltip();
$('.text-autocolor').autocolor(false);
2024-01-07 22:53:49 +01:00
var trendChart; // Keep a reference to the chart
var trendData; // Keep a reference to the data
2019-04-30 17:36:27 +02:00
@if (!Model.TrendChartDataJSON.Equals("")) {
2024-01-07 22:53:49 +01:00
<text>
nv.addGraph(function () {
trendChart = nv.models.lineChart();
var height = 300;
trendChart.useInteractiveGuideline(true);
trendChart.xAxis.tickFormat(function (d) { return d3.time.format('%H:%M')(new Date(d)); });
trendChart.yAxis.axisLabel('Trend %').tickFormat(d3.format(',.2f'));
trendData = @Html.Raw(Model.TrendChartDataJSON);
d3.select('.trend-chart svg')
.datum(trendData)
.transition().duration(0)
.call(trendChart);
return trendChart;
2019-04-30 17:36:27 +02:00
});
2024-01-07 22:53:49 +01:00
</text>
2019-04-30 17:36:27 +02:00
}
2024-01-07 22:53:49 +01:00
})(jQuery);
</script>
<script type="text/javascript">
(function ($) {
'use strict';
$('[role="tooltip"]').remove();
$('[data-toggle="tooltip"]').tooltip();
$('.text-autocolor').autocolor(false);
var profitChart; // Keep a reference to the chart
var profitData; // Keep a reference to the data
2019-04-30 17:36:27 +02:00
@if (!Model.ProfitChartDataJSON.Equals("")) {
2024-01-07 22:53:49 +01:00
<text>
nv.addGraph(function () {
profitChart = nv.models.lineChart();
var height = 300;
profitChart.useInteractiveGuideline(true);
profitChart.xAxis.tickFormat(function (d) { return d3.time.format('%Y/%m/%d')(new Date(d)); });
profitChart.yAxis.axisLabel('Daily Profit').tickFormat(d3.format(',.2f'));
profitData = @Html.Raw(Model.ProfitChartDataJSON);
d3.select('.profit-chart svg')
.datum(profitData)
.transition().duration(0)
.call(profitChart);
return profitChart;
2019-04-30 17:36:27 +02:00
});
2024-01-07 22:53:49 +01:00
</text>
2019-04-30 17:36:27 +02:00
}
2024-01-07 22:53:49 +01:00
})(jQuery);
2019-04-30 17:36:27 +02:00
</script>