Merge pull request #102 from HojouFotytu/develop
Multiple Monitor Changes
This commit is contained in:
commit
27f10539f1
|
@ -611,6 +611,13 @@ namespace Core.Helper
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static string GetMainCurrencySymbol(string tvSymbol)
|
||||||
|
{
|
||||||
|
string result = tvSymbol;
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
public static string GetCurrencySymbol(string code)
|
public static string GetCurrencySymbol(string code)
|
||||||
{
|
{
|
||||||
string result = code;
|
string result = code;
|
||||||
|
|
|
@ -12,7 +12,97 @@
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-12">
|
<div class="col-sm-12">
|
||||||
<div class="card-box">
|
<div class="card-box">
|
||||||
<h4 class="m-t-0 header-title text-center">Current @Model.Summary.MainMarket Price:<text class="text-autocolor"> @Html.Raw(Model.MainFiatCurrencySymbol + Model.Summary.MainMarketPrice.ToString("#,#0.00", new System.Globalization.CultureInfo("en-US"))) </text> <small> <i class="fa fa-info-circle text-muted" data-toggle="tooltip" data-placement="top" title="This is the value of your market currency."></i></small></h4>
|
@if (Model.Summary.MainMarket.Equals("USDT", StringComparison.InvariantCultureIgnoreCase) || Model.Summary.MainMarket.Equals("TUSD", StringComparison.InvariantCultureIgnoreCase) || Model.Summary.MainMarket.Equals("USDC", StringComparison.InvariantCultureIgnoreCase) || Model.Summary.MainMarket.Equals("PAX", StringComparison.InvariantCultureIgnoreCase) || Model.Summary.MainMarket.Equals("USD", StringComparison.InvariantCultureIgnoreCase))
|
||||||
|
{
|
||||||
|
string TvSymbol = @Core.Helper.SystemHelper.GetMainCurrencySymbol(Model.Summary.MainMarket)+"USD";
|
||||||
|
<div class="tradingview-widget-container">
|
||||||
|
<div class="tradingview-widget-container__widget"></div>
|
||||||
|
<script type="text/javascript" src="https://s3.tradingview.com/external-embedding/embed-widget-mini-symbol-overview.js" async>
|
||||||
|
{
|
||||||
|
"symbol": "@Core.Helper.SystemHelper.GetMainCurrencySymbol(@TvSymbol)",
|
||||||
|
"width": "100%",
|
||||||
|
"height": "200",
|
||||||
|
"locale": "en",
|
||||||
|
"dateRange": "1d",
|
||||||
|
"colorTheme": "dark",
|
||||||
|
"trendLineColor": "#37a6ef",
|
||||||
|
"underLineColor": "rgba(55, 166, 239, 0.15)",
|
||||||
|
"isTransparent": true,
|
||||||
|
"autosize": true,
|
||||||
|
"largeChartUrl": ""
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (Model.PTMagicConfiguration.GeneralSettings.Application.Exchange.Equals("Binance", StringComparison.InvariantCultureIgnoreCase))
|
||||||
|
{
|
||||||
|
string TvSymbol = "BINANCE:" + @Core.Helper.SystemHelper.GetMainCurrencySymbol(Model.Summary.MainMarket) + "USDT";
|
||||||
|
<div class="tradingview-widget-container">
|
||||||
|
<div class="tradingview-widget-container__widget"></div>
|
||||||
|
<script type="text/javascript" src="https://s3.tradingview.com/external-embedding/embed-widget-mini-symbol-overview.js" async>
|
||||||
|
{
|
||||||
|
"symbol": "@Core.Helper.SystemHelper.GetMainCurrencySymbol(@TvSymbol)",
|
||||||
|
"width": "100%",
|
||||||
|
"height": "200",
|
||||||
|
"locale": "en",
|
||||||
|
"dateRange": "1d",
|
||||||
|
"colorTheme": "dark",
|
||||||
|
"trendLineColor": "#37a6ef",
|
||||||
|
"underLineColor": "rgba(55, 166, 239, 0.15)",
|
||||||
|
"isTransparent": true,
|
||||||
|
"autosize": true,
|
||||||
|
"largeChartUrl": ""
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if (Model.PTMagicConfiguration.GeneralSettings.Application.Exchange.Equals("Bittrex", StringComparison.InvariantCultureIgnoreCase)) {
|
||||||
|
string TvSymbol = "BITTREX:" + @Core.Helper.SystemHelper.GetMainCurrencySymbol(Model.Summary.MainMarket) + "USD";
|
||||||
|
<div class="tradingview-widget-container">
|
||||||
|
<div class="tradingview-widget-container__widget"></div>
|
||||||
|
<script type="text/javascript" src="https://s3.tradingview.com/external-embedding/embed-widget-mini-symbol-overview.js" async>
|
||||||
|
{
|
||||||
|
"symbol": "@Core.Helper.SystemHelper.GetMainCurrencySymbol(@TvSymbol)",
|
||||||
|
"width": "100%",
|
||||||
|
"height": "100%",
|
||||||
|
"locale": "en",
|
||||||
|
"dateRange": "1d",
|
||||||
|
"colorTheme": "dark",
|
||||||
|
"trendLineColor": "#37a6ef",
|
||||||
|
"underLineColor": "rgba(55, 166, 239, 0.15)",
|
||||||
|
"isTransparent": true,
|
||||||
|
"autosize": true,
|
||||||
|
"largeChartUrl": ""
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
string TvSymbol = "Poloniex:" + @Core.Helper.SystemHelper.GetMainCurrencySymbol(Model.Summary.MainMarket) + "USDT";
|
||||||
|
<div class="tradingview-widget-container">
|
||||||
|
<div class="tradingview-widget-container__widget"></div>
|
||||||
|
<script type="text/javascript" src="https://s3.tradingview.com/external-embedding/embed-widget-mini-symbol-overview.js" async>
|
||||||
|
{
|
||||||
|
"symbol": "@Core.Helper.SystemHelper.GetMainCurrencySymbol(@TvSymbol)",
|
||||||
|
"width": "100%",
|
||||||
|
"height": "100%",
|
||||||
|
"locale": "en",
|
||||||
|
"dateRange": "1d",
|
||||||
|
"colorTheme": "dark",
|
||||||
|
"trendLineColor": "#37a6ef",
|
||||||
|
"underLineColor": "rgba(55, 166, 239, 0.15)",
|
||||||
|
"isTransparent": true,
|
||||||
|
"autosize": true,
|
||||||
|
"largeChartUrl": ""
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -21,7 +111,6 @@
|
||||||
<div class="col-sm-12">
|
<div class="col-sm-12">
|
||||||
<div class="card-box">
|
<div class="card-box">
|
||||||
<h4 class="m-t-0 m-b-20 header-title"><b>Market Trend Averages</b></h4>
|
<h4 class="m-t-0 m-b-20 header-title"><b>Market Trend Averages</b></h4>
|
||||||
|
|
||||||
<table class="table table-sm">
|
<table class="table table-sm">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
|
|
@ -22,7 +22,19 @@
|
||||||
currentBalanceString = Math.Round(currentBalance, 2).ToString("#,#0.00", new System.Globalization.CultureInfo("en-US"));
|
currentBalanceString = Math.Round(currentBalance, 2).ToString("#,#0.00", new System.Globalization.CultureInfo("en-US"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
<h4 class="m-t-0 header-title text-center">Total Account Value: <text class="text-autocolor"> @currentBalanceString @Model.Summary.MainMarket </text> <small> <i class="fa fa-info-circle text-muted" data-toggle="tooltip" data-placement="top" title="This value is estimated based on your sales history and any entries on the Transactions page"></i></small></h4>
|
<h4 class="m-t-0 header-title text-center">Starting Account Value: <text class="text-autocolor"> @Model.PTMagicConfiguration.GeneralSettings.Application.StartBalance @Model.Summary.MainMarket </text> <small> <i class="fa fa-info-circle text-muted" data-toggle="tooltip" data-placement="top" title="This is the starting vlaue found in your settings file"></i></small></h4>
|
||||||
|
<h4 class="m-t-0 header-title text-center">Estimated Account Value: <text class="text-autocolor"> @currentBalanceString @Model.Summary.MainMarket </text> <small> <i class="fa fa-info-circle text-muted" data-toggle="tooltip" data-placement="top" title="This is based on your sales history and entries on the Transactions page. It doesn't include any currently held positions."></i></small></h4>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<div class="card-box">
|
||||||
|
<h4 class="m-t-0 header-title text-center">Cumulative Profits <small> <i class="fa fa-info-circle text-muted" data-toggle="tooltip" data-placement="top" title="This value is based on your sales history"></i></small></h4>
|
||||||
|
<div class="balance-chart">
|
||||||
|
<svg style="height:350px;width:100%"></svg>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -363,6 +375,21 @@
|
||||||
return lineChart;
|
return lineChart;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
nv.addGraph(function () {
|
||||||
|
var lineChart = nv.models.lineChart();
|
||||||
|
var height = 400;
|
||||||
|
/**/
|
||||||
|
var chartData = @Html.Raw(Model.BalanceChartDataJSON);
|
||||||
|
/**/
|
||||||
|
lineChart.useInteractiveGuideline(true);
|
||||||
|
lineChart.xAxis.tickFormat(function (d) { return d3.time.format('%Y/%m/%d')(new Date(d)); });
|
||||||
|
lineChart.yAxis.axisLabel('Profit').tickFormat(d3.format(',.2f'));
|
||||||
|
d3.select('.balance-chart svg').attr('perserveAspectRatio', 'xMinYMid').datum(chartData).transition().duration(500).call(lineChart);
|
||||||
|
nv.utils.windowResize(lineChart.update);
|
||||||
|
|
||||||
|
return lineChart;
|
||||||
|
});
|
||||||
|
|
||||||
$("#salesList").on("show.bs.modal", function (e) {
|
$("#salesList").on("show.bs.modal", function (e) {
|
||||||
$(this).find(".modal-content").html('<i class="fa fa-circle-o-notch fa-spin fa-3x fa-fw"></i>');
|
$(this).find(".modal-content").html('<i class="fa fa-circle-o-notch fa-spin fa-3x fa-fw"></i>');
|
||||||
var link = $(e.relatedTarget);
|
var link = $(e.relatedTarget);
|
||||||
|
|
|
@ -14,6 +14,7 @@ namespace Monitor.Pages
|
||||||
public ProfitTrailerData PTData = null;
|
public ProfitTrailerData PTData = null;
|
||||||
public string TradesChartDataJSON = "";
|
public string TradesChartDataJSON = "";
|
||||||
public string ProfitChartDataJSON = "";
|
public string ProfitChartDataJSON = "";
|
||||||
|
public string BalanceChartDataJSON = "";
|
||||||
public IEnumerable<KeyValuePair<string, double>> TopMarkets = null;
|
public IEnumerable<KeyValuePair<string, double>> TopMarkets = null;
|
||||||
public DateTime MinSellLogDate = Constants.confMinDate;
|
public DateTime MinSellLogDate = Constants.confMinDate;
|
||||||
public Dictionary<DateTime, double> DailyGains = new Dictionary<DateTime, double>();
|
public Dictionary<DateTime, double> DailyGains = new Dictionary<DateTime, double>();
|
||||||
|
@ -63,20 +64,26 @@ namespace Monitor.Pages
|
||||||
int tradeDayIndex = 0;
|
int tradeDayIndex = 0;
|
||||||
string tradesPerDayJSON = "";
|
string tradesPerDayJSON = "";
|
||||||
string profitPerDayJSON = "";
|
string profitPerDayJSON = "";
|
||||||
|
string balancePerDayJSON = "";
|
||||||
|
double balance = 0.0;
|
||||||
for (DateTime salesDate = graphStartDate; salesDate <= DateTimeNow.DateTime.Date; salesDate = salesDate.AddDays(1))
|
for (DateTime salesDate = graphStartDate; salesDate <= DateTimeNow.DateTime.Date; salesDate = salesDate.AddDays(1))
|
||||||
{
|
{
|
||||||
|
|
||||||
if (tradeDayIndex > 0)
|
if (tradeDayIndex > 0)
|
||||||
{
|
{
|
||||||
tradesPerDayJSON += ",\n";
|
tradesPerDayJSON += ",\n";
|
||||||
profitPerDayJSON += ",\n";
|
profitPerDayJSON += ",\n";
|
||||||
|
balancePerDayJSON += ",\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
int trades = PTData.SellLog.FindAll(t => t.SoldDate.Date == salesDate.Date).Count;
|
int trades = PTData.SellLog.FindAll(t => t.SoldDate.Date == salesDate.Date).Count;
|
||||||
double profit = PTData.SellLog.FindAll(t => t.SoldDate.Date == salesDate.Date).Sum(t => t.Profit);
|
double profit = PTData.SellLog.FindAll(t => t.SoldDate.Date == salesDate.Date).Sum(t => t.Profit);
|
||||||
double profitFiat = Math.Round(profit * Summary.MainMarketPrice, 2);
|
double profitFiat = Math.Round(profit * Summary.MainMarketPrice, 2);
|
||||||
|
balance += profitFiat;
|
||||||
|
|
||||||
tradesPerDayJSON += "{x: new Date('" + salesDate.Date.ToString("yyyy-MM-dd") + "'), y: " + trades + "}";
|
tradesPerDayJSON += "{x: new Date('" + salesDate.Date.ToString("yyyy-MM-dd") + "'), y: " + trades + "}";
|
||||||
profitPerDayJSON += "{x: new Date('" + salesDate.Date.ToString("yyyy-MM-dd") + "'), y: " + profitFiat.ToString("0.00", new System.Globalization.CultureInfo("en-US")) + "}";
|
profitPerDayJSON += "{x: new Date('" + salesDate.Date.ToString("yyyy-MM-dd") + "'), y: " + profitFiat.ToString("0.00", new System.Globalization.CultureInfo("en-US")) + "}";
|
||||||
|
balancePerDayJSON += "{x: new Date('" + salesDate.Date.ToString("yyyy-MM-dd") + "'), y: " + balance.ToString("0.00", new System.Globalization.CultureInfo("en-US")) + "}";
|
||||||
|
|
||||||
tradeDayIndex++;
|
tradeDayIndex++;
|
||||||
}
|
}
|
||||||
|
@ -97,6 +104,14 @@ namespace Monitor.Pages
|
||||||
ProfitChartDataJSON += "}";
|
ProfitChartDataJSON += "}";
|
||||||
ProfitChartDataJSON += "]";
|
ProfitChartDataJSON += "]";
|
||||||
|
|
||||||
|
BalanceChartDataJSON = "[";
|
||||||
|
BalanceChartDataJSON += "{";
|
||||||
|
BalanceChartDataJSON += "key: 'Profit in " + Summary.MainFiatCurrency + "',";
|
||||||
|
BalanceChartDataJSON += "color: '" + Constants.ChartLineColors[1] + "',";
|
||||||
|
BalanceChartDataJSON += "values: [" + balancePerDayJSON + "]";
|
||||||
|
BalanceChartDataJSON += "}";
|
||||||
|
BalanceChartDataJSON += "]";
|
||||||
|
|
||||||
for (DateTime salesDate = DateTimeNow.DateTime.Date; salesDate >= MinSellLogDate; salesDate = salesDate.AddDays(-1))
|
for (DateTime salesDate = DateTimeNow.DateTime.Date; salesDate >= MinSellLogDate; salesDate = salesDate.AddDays(-1))
|
||||||
{
|
{
|
||||||
List<SellLogData> salesDateSales = PTData.SellLog.FindAll(sl => sl.SoldDate.Date == salesDate);
|
List<SellLogData> salesDateSales = PTData.SellLog.FindAll(sl => sl.SoldDate.Date == salesDate);
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
double intervalSeconds = Model.PTMagicConfiguration.AnalyzerSettings.MarketAnalyzer.IntervalMinutes * 60.0;
|
double intervalSeconds = Model.PTMagicConfiguration.AnalyzerSettings.MarketAnalyzer.IntervalMinutes * 60.0;
|
||||||
|
|
||||||
string ptMagicHealthIcon = "<i class=\"fa fa-heartbeat text-success\" data-toggle=\"tooltip\" data-placement=\"top\" title=\"PT Magic is alive and healthy!\"></i>";
|
string ptMagicHealthIcon = "<i class=\"fa fa-heartbeat text-success\" data-toggle=\"tooltip\" data-placement=\"top\" title=\"PT Magic is alive and healthy!\"></i>";
|
||||||
if (elapsedSecondsSinceRuntime > (intervalSeconds + intervalSeconds * 0.2)) {
|
if (elapsedSecondsSinceRuntime > (intervalSeconds + intervalSeconds)) {
|
||||||
ptMagicHealthIcon = "<i class=\"fa fa-bolt text-danger\" data-toggle=\"tooltip\" data-placement=\"top\" title=\"PT Magic seems to have problems, check the logs!\"></i>";
|
ptMagicHealthIcon = "<i class=\"fa fa-bolt text-danger\" data-toggle=\"tooltip\" data-placement=\"top\" title=\"PT Magic seems to have problems, check the logs!\"></i>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
string iconColor = "text-success";
|
string iconColor = "text-success";
|
||||||
string ptMagicHealthIcon = "fa-heartbeat";
|
string ptMagicHealthIcon = "fa-heartbeat";
|
||||||
string ptMagicHealthTooltip = "PT Magic is alive and healthy!";
|
string ptMagicHealthTooltip = "PT Magic is alive and healthy!";
|
||||||
if (elapsedSecondsSinceRuntime > (intervalSeconds + intervalSeconds * 0.5)) {
|
if (elapsedSecondsSinceRuntime > (intervalSeconds + intervalSeconds)) {
|
||||||
ptMagicHealthIcon = "fa-exclamation-triangle";
|
ptMagicHealthIcon = "fa-exclamation-triangle";
|
||||||
ptMagicHealthTooltip = "PT Magic seems to have problems, check the logs!";
|
ptMagicHealthTooltip = "PT Magic seems to have problems, check the logs!";
|
||||||
iconColor = "text-danger";
|
iconColor = "text-danger";
|
||||||
|
|
|
@ -154,7 +154,8 @@
|
||||||
|
|
||||||
.trend-chart .nvd3.nv-line .nvd3.nv-scatter .nv-groups .nv-point,
|
.trend-chart .nvd3.nv-line .nvd3.nv-scatter .nv-groups .nv-point,
|
||||||
.trades-chart .nvd3.nv-line .nvd3.nv-scatter .nv-groups .nv-point,
|
.trades-chart .nvd3.nv-line .nvd3.nv-scatter .nv-groups .nv-point,
|
||||||
.profit-chart .nvd3.nv-line .nvd3.nv-scatter .nv-groups .nv-point {
|
.profit-chart .nvd3.nv-line .nvd3.nv-scatter .nv-groups .nv-point,
|
||||||
|
.balance-chart .nvd3.nv-line .nvd3.nv-scatter .nv-groups .nv-point {
|
||||||
fill-opacity: 1 !important;
|
fill-opacity: 1 !important;
|
||||||
stroke-opacity: 1 !important;
|
stroke-opacity: 1 !important;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue