2018-05-22 10:11:50 +02:00
|
|
|
@page
|
|
|
|
@model DashboardTopModel
|
|
|
|
@{
|
|
|
|
Layout = null;
|
|
|
|
}
|
|
|
|
|
|
|
|
<div class="row">
|
2019-05-01 09:19:37 +02:00
|
|
|
<div class="col-md-5 px-1">
|
2019-04-16 22:22:28 +02:00
|
|
|
<div class="card-box px-2">
|
2018-05-22 10:11:50 +02:00
|
|
|
<h4 class="m-t-0 m-b-20 header-title"><b>Possible Buys (@Model.PTData.BuyLog.Count)</b><small id="buylist-refresh-icon"></small><small class="pull-right"><a href="@Html.Raw(Model.PTMagicConfiguration.GeneralSettings.Monitor.RootUrl)BuyAnalyzer">more</a></small></h4>
|
|
|
|
@if (Model.PTData.BuyLog.Count == 0) {
|
|
|
|
|
|
|
|
<p>Your Profit Trailer did not find anything worth buying so far.</p>
|
|
|
|
|
|
|
|
} else {
|
2019-04-16 22:22:28 +02:00
|
|
|
|
2018-05-22 10:11:50 +02:00
|
|
|
<table class="table table-sm m-b-0">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>Market</th>
|
2019-03-17 08:49:19 +01:00
|
|
|
<th>24H Trend</th>
|
|
|
|
<th>Buy Strategies</th>
|
2018-05-22 10:11:50 +02:00
|
|
|
<th class="text-right" data-toggle="tooltip" data-placement="top" title="Current ask price for this market">Ask Price</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
2019-03-26 01:01:43 +01:00
|
|
|
@foreach (Core.Main.DataObjects.PTMagicData.BuyLogData buyLogEntry in Model.PTData.BuyLog.OrderBy(b => b.IsSom).
|
|
|
|
ThenByDescending(b => b.IsTrailing).
|
2019-03-19 00:32:10 +01:00
|
|
|
ThenByDescending(b => b.IsTrue).
|
|
|
|
ThenByDescending(b => b.TrueStrategyCount).
|
2019-03-26 01:01:43 +01:00
|
|
|
|
2019-03-19 00:32:10 +01:00
|
|
|
ThenByDescending(b => b.PercChange).
|
|
|
|
Take(Model.PTMagicConfiguration.GeneralSettings.Monitor.MaxDashboardBuyEntries)) {
|
|
|
|
|
2018-05-22 10:11:50 +02:00
|
|
|
Core.Main.DataObjects.PTMagicData.MarketPairSummary mps = null;
|
|
|
|
if (Model.Summary.MarketSummary.ContainsKey(buyLogEntry.Market)) {
|
|
|
|
mps = Model.Summary.MarketSummary[buyLogEntry.Market];
|
|
|
|
}
|
|
|
|
|
|
|
|
bool isTrailingBuyActive = buyLogEntry.IsTrailing;
|
|
|
|
if (buyLogEntry.BuyStrategies.Count > 0) {
|
2018-06-05 09:40:22 +02:00
|
|
|
isTrailingBuyActive = (buyLogEntry.BuyStrategies.FindAll(bs => bs.IsTrailing).Count > 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool isBuyStrategyTrue = buyLogEntry.IsTrue;
|
|
|
|
if (buyLogEntry.BuyStrategies.Count > 0) {
|
|
|
|
isBuyStrategyTrue = (buyLogEntry.BuyStrategies.FindAll(bs => !bs.IsTrue).Count == 0);
|
2018-05-22 10:11:50 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
bool buyDisabled = false;
|
2018-06-05 09:40:22 +02:00
|
|
|
string buyStrategyText = Core.ProfitTrailer.StrategyHelper.GetStrategyText(Model.Summary, buyLogEntry.BuyStrategies, buyLogEntry.BuyStrategy, isBuyStrategyTrue, isTrailingBuyActive);
|
2018-05-22 10:11:50 +02:00
|
|
|
if (!Core.ProfitTrailer.StrategyHelper.IsValidStrategy(buyStrategyText, true)) {
|
|
|
|
buyDisabled = true;
|
2019-10-13 22:08:48 +02:00
|
|
|
}
|
2018-05-22 10:11:50 +02:00
|
|
|
|
|
|
|
<tr>
|
|
|
|
@if (mps == null || mps.ActiveSingleSettings == null || mps.ActiveSingleSettings.Count == 0) {
|
|
|
|
<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></th>
|
|
|
|
} 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>
|
|
|
|
}
|
2019-10-13 22:08:48 +02:00
|
|
|
<td class="text-autocolor">@string.Format("{0}%", (buyLogEntry.PercChange * 100).ToString("#,#0.00"))</td>
|
2018-05-22 10:11:50 +02:00
|
|
|
@if (buyDisabled) {
|
|
|
|
<td>@Html.Raw(buyStrategyText)</td>
|
|
|
|
} else {
|
|
|
|
<td>@Html.Raw(buyStrategyText)</td>
|
|
|
|
}
|
|
|
|
<td class="text-right">@buyLogEntry.CurrentPrice.ToString("#,#0.00000000", new System.Globalization.CultureInfo("en-US"))</td>
|
|
|
|
</tr>
|
|
|
|
}
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
|
|
|
|
@if (Model.PTData.BuyLog.Count > Model.PTMagicConfiguration.GeneralSettings.Monitor.MaxDashboardBuyEntries) {
|
|
|
|
<p class="text-right"><small><i class="fa fa-info-circle"></i> @Model.PTMagicConfiguration.GeneralSettings.Monitor.MaxDashboardBuyEntries of @Model.PTData.BuyLog.Count items listed - <a href="@Html.Raw(Model.PTMagicConfiguration.GeneralSettings.Monitor.RootUrl)BuyAnalyzer">View all items</a></small></p>
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2019-05-01 09:19:37 +02:00
|
|
|
<div class="col-md-7 px-1">
|
2019-04-16 22:22:28 +02:00
|
|
|
<div class="card-box px-2">
|
2019-05-04 14:11:29 +02:00
|
|
|
<h4 class="m-t-0 m-b-20 header-title"><b>Pairs / DCA / Pending (@Model.PTData.DCALog.Count)</b><small id="baglist-refresh-icon"></small><small class="pull-right"><a href="@Html.Raw(Model.PTMagicConfiguration.GeneralSettings.Monitor.RootUrl)BagAnalyzer">more</a></small></h4>
|
2018-05-22 10:11:50 +02:00
|
|
|
|
|
|
|
@if (Model.PTData.DCALog.Count == 0) {
|
|
|
|
|
2019-05-04 14:11:29 +02:00
|
|
|
<p>Profit Trailer is not reporting any holdings on your exchange.</p>
|
2018-05-22 10:11:50 +02:00
|
|
|
|
|
|
|
} else {
|
2019-04-16 00:21:54 +02:00
|
|
|
|
2019-04-16 22:22:28 +02:00
|
|
|
<div class="table-responsive">
|
|
|
|
<table class="table table-sm m-b-0">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>Market</th>
|
2020-07-17 12:26:33 +02:00
|
|
|
<th class="text-left" data-toggle="tooltip" data-placement="top" title="Market trend last 24 hours">24H</th>
|
2019-10-15 15:05:53 +02:00
|
|
|
<th class="text-left" data-toggle="tooltip" data-placement="top" title="Total Buy Cost">Cost</th>
|
2019-04-16 22:22:28 +02:00
|
|
|
<th></th>
|
2020-07-17 12:26:33 +02:00
|
|
|
<th class="text-left" data-toggle="tooltip" data-placement="top" title="Active buy strategies">DCA</th>
|
|
|
|
<th class="text-left" data-toggle="tooltip" data-placement="top" title="Active sell strategies">Sell</th>
|
|
|
|
<th class="text-left" data-toggle="tooltip" data-placement="top" title="Target profit to sell">Target</th>
|
2019-04-16 22:22:28 +02:00
|
|
|
<th class="text-left" data-toggle="tooltip" data-placement="top" title="Current Profit">Profit</th>
|
|
|
|
<th></th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
@foreach (Core.Main.DataObjects.PTMagicData.DCALogData dcaLogEntry in Model.PTData.DCALog.OrderByDescending(d => d.ProfitPercent).Take(Model.PTMagicConfiguration.GeneralSettings.Monitor.MaxDashboardBagEntries)) {
|
|
|
|
// Loop through the pairs preparing the data for display
|
|
|
|
Core.Main.DataObjects.PTMagicData.MarketPairSummary mps = null;
|
|
|
|
if (Model.Summary.MarketSummary.ContainsKey(dcaLogEntry.Market)) {
|
|
|
|
mps = Model.Summary.MarketSummary[dcaLogEntry.Market];
|
|
|
|
}
|
2018-05-22 10:11:50 +02:00
|
|
|
|
2019-04-16 22:22:28 +02:00
|
|
|
bool dcaEnabled = true;
|
|
|
|
if (mps != null) {
|
|
|
|
dcaEnabled = mps.IsDCAEnabled;
|
|
|
|
}
|
2018-05-22 10:11:50 +02:00
|
|
|
|
2019-04-16 22:22:28 +02:00
|
|
|
bool isTrailingBuyActive = dcaLogEntry.IsTrailing;
|
|
|
|
if (dcaLogEntry.BuyStrategies.Count > 0) {
|
|
|
|
isTrailingBuyActive = (dcaLogEntry.BuyStrategies.FindAll(bs => bs.IsTrailing).Count > 0);
|
|
|
|
}
|
2018-06-05 09:40:22 +02:00
|
|
|
|
2019-04-16 22:22:28 +02:00
|
|
|
bool isBuyStrategyTrue = dcaLogEntry.IsTrue;
|
|
|
|
if (dcaLogEntry.BuyStrategies.Count > 0) {
|
|
|
|
isBuyStrategyTrue = (dcaLogEntry.BuyStrategies.FindAll(bs => !bs.IsTrue).Count == 0);
|
|
|
|
}
|
2018-05-22 10:11:50 +02:00
|
|
|
|
2019-04-16 22:22:28 +02:00
|
|
|
bool isTrailingSellActive = false;
|
|
|
|
if (dcaLogEntry.SellStrategies.Count > 0) {
|
|
|
|
isTrailingSellActive = (dcaLogEntry.SellStrategies.FindAll(ss => ss.IsTrailing).Count > 0);
|
|
|
|
}
|
2018-06-05 09:40:22 +02:00
|
|
|
|
2019-04-16 22:22:28 +02:00
|
|
|
bool isSellStrategyTrue = false;
|
2020-03-25 19:02:59 +01:00
|
|
|
if (dcaLogEntry.SellStrategies.Count > 0) {
|
2019-04-16 22:22:28 +02:00
|
|
|
isSellStrategyTrue = (dcaLogEntry.SellStrategies.FindAll(ss => !ss.IsTrue).Count == 0);
|
|
|
|
}
|
2018-05-22 10:11:50 +02:00
|
|
|
|
2019-04-16 22:22:28 +02:00
|
|
|
bool buyDisabled = false;
|
2020-07-17 12:26:33 +02:00
|
|
|
string leverage = "";
|
|
|
|
double leverageValue = 0;
|
|
|
|
|
2019-04-16 22:22:28 +02:00
|
|
|
string buyStrategyText = Core.ProfitTrailer.StrategyHelper.GetStrategyText(Model.Summary, dcaLogEntry.BuyStrategies, dcaLogEntry.BuyStrategy, isBuyStrategyTrue, isTrailingBuyActive);
|
2020-07-17 12:26:33 +02:00
|
|
|
|
|
|
|
if (!Core.ProfitTrailer.StrategyHelper.IsValidStrategy(buyStrategyText, true))
|
|
|
|
{
|
2019-04-16 22:22:28 +02:00
|
|
|
buyDisabled = true;
|
|
|
|
}
|
2018-05-22 10:11:50 +02:00
|
|
|
|
2020-07-17 12:26:33 +02:00
|
|
|
|
|
|
|
|
|
|
|
if (buyStrategyText.Contains("CROSSED"))
|
|
|
|
{
|
|
|
|
string leverageText = buyStrategyText.Remove(0, buyStrategyText.IndexOf("CROSSED")+9);
|
|
|
|
leverage = leverageText.Remove(leverageText.IndexOf(".0)"), leverageText.Length - leverageText.IndexOf(".0)"));
|
|
|
|
leverageValue = double.Parse(leverage);
|
|
|
|
Write(leverageValue);
|
|
|
|
}
|
|
|
|
if (buyStrategyText.Contains("ISOLATED"))
|
|
|
|
{
|
|
|
|
leverage = buyStrategyText.Remove(0, 10);
|
|
|
|
leverage = leverage.Remove(leverage.Length - 3, 3);
|
|
|
|
//leverageValue = double.Parse(leverage);
|
|
|
|
Write(leverage);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-04-16 22:22:28 +02:00
|
|
|
string sellStrategyText = Core.ProfitTrailer.StrategyHelper.GetStrategyText(Model.Summary, dcaLogEntry.SellStrategies, dcaLogEntry.SellStrategy, isSellStrategyTrue, isTrailingSellActive);
|
2018-05-22 10:11:50 +02:00
|
|
|
|
2019-04-16 22:22:28 +02:00
|
|
|
// Check for when PT loses the value of a pair
|
|
|
|
bool lostValue = false;
|
|
|
|
lostValue = (dcaLogEntry.TotalCost == 0.0) || (dcaLogEntry.AverageBuyPrice == 0.0);
|
2019-02-25 17:02:52 +01:00
|
|
|
|
2019-10-15 15:05:53 +02:00
|
|
|
// Aggregate totals
|
|
|
|
Model.TotalBagCost = Model.TotalBagCost + dcaLogEntry.TotalCost;
|
2019-10-16 07:03:19 +02:00
|
|
|
double ExchangeFee = 0;
|
|
|
|
|
2019-10-17 04:06:16 +02:00
|
|
|
switch (Model.PTMagicConfiguration.GeneralSettings.Application.Exchange.ToLower())
|
|
|
|
{
|
|
|
|
case "binance":
|
|
|
|
ExchangeFee = 0.002;
|
|
|
|
break;
|
|
|
|
case "binanceus":
|
|
|
|
ExchangeFee = 0.002;
|
|
|
|
break;
|
2019-12-30 16:13:28 +01:00
|
|
|
case "binancefutures":
|
|
|
|
ExchangeFee = 0.002;
|
|
|
|
break;
|
2019-10-17 04:06:16 +02:00
|
|
|
case "bittrex":
|
|
|
|
ExchangeFee = 0.0025;
|
|
|
|
break;
|
|
|
|
case "poloniex":
|
|
|
|
ExchangeFee = 0.0025;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
2019-10-16 03:05:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
double TradingFee = (dcaLogEntry.Amount * dcaLogEntry.CurrentPrice) * ExchangeFee;
|
2019-10-15 15:05:53 +02:00
|
|
|
Model.TotalBagValue = Model.TotalBagValue + ((dcaLogEntry.Amount * dcaLogEntry.CurrentPrice) - TradingFee);
|
|
|
|
|
2019-04-16 22:22:28 +02:00
|
|
|
// Render the row
|
|
|
|
<tr @(lostValue ? "class=errorRow" : "") >
|
|
|
|
@if (mps == null || mps.ActiveSingleSettings == null || mps.ActiveSingleSettings.Count == 0) {
|
|
|
|
<th class="align-top"><a href="@Core.Helper.SystemHelper.GetMarketLink(Model.PTMagicConfiguration.GeneralSettings.Monitor.LinkPlatform,Model.PTMagicConfiguration.GeneralSettings.Application.Exchange, dcaLogEntry.Market, Model.Summary.MainMarket)" target="_blank">@dcaLogEntry.Market</a></th>
|
2018-05-22 10:11:50 +02:00
|
|
|
} else {
|
2019-04-16 22:22:28 +02:00
|
|
|
<th class="align-top"><a href="@Core.Helper.SystemHelper.GetMarketLink(Model.PTMagicConfiguration.GeneralSettings.Monitor.LinkPlatform,Model.PTMagicConfiguration.GeneralSettings.Application.Exchange, dcaLogEntry.Market, Model.Summary.MainMarket)" target="_blank">@dcaLogEntry.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>
|
2018-05-22 10:11:50 +02:00
|
|
|
}
|
2019-04-16 22:22:28 +02:00
|
|
|
|
|
|
|
<td class="text-autocolor">@Html.Raw((dcaLogEntry.PercChange * 100).ToString("#,#0.00", new System.Globalization.CultureInfo("en-US")))%</td>
|
|
|
|
|
|
|
|
<td class="text-left">@Html.Raw(dcaLogEntry.TotalCost.ToString("#,#0.000000", new System.Globalization.CultureInfo("en-US")))</td>
|
|
|
|
|
|
|
|
<td class="text-right">
|
|
|
|
@if (dcaEnabled) {
|
|
|
|
@if (dcaLogEntry.BoughtTimes > 0) {
|
|
|
|
@dcaLogEntry.BoughtTimes;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
<span data-toggle="tooltip" data-placement="top" title="DCA is disabled"><i class="fa fa-ban text-highlight"></i></span>
|
|
|
|
}
|
|
|
|
</td>
|
|
|
|
<td>@Html.Raw(buyStrategyText)</td>
|
|
|
|
<td>@Html.Raw(sellStrategyText)</td>
|
|
|
|
|
2020-07-17 12:26:33 +02:00
|
|
|
|
|
|
|
@if (leverageValue == 0)
|
|
|
|
{
|
|
|
|
<td class="@Html.Raw((dcaLogEntry.TargetGainValue.HasValue && (dcaLogEntry.ProfitPercent > dcaLogEntry.TargetGainValue.Value)) ? "text-success" : "text-danger")">@Html.Raw(dcaLogEntry.TargetGainValue.HasValue ? dcaLogEntry.TargetGainValue.Value.ToString("#,#0.00", new System.Globalization.CultureInfo("en-US")) + "%" : " ")</td>
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
double leverageTargetGain = leverageValue * dcaLogEntry.TargetGainValue.Value;
|
|
|
|
<td class="@Html.Raw((dcaLogEntry.TargetGainValue.HasValue && (dcaLogEntry.ProfitPercent > dcaLogEntry.TargetGainValue.Value)) ? "text-success" : "text-danger")">@Html.Raw(dcaLogEntry.TargetGainValue.HasValue ? leverageTargetGain.ToString("#,#0.00", new System.Globalization.CultureInfo("en-US")) + "%" : " ")</td>
|
|
|
|
}
|
|
|
|
|
2019-04-16 22:22:28 +02:00
|
|
|
@if(!@lostValue)
|
|
|
|
{
|
|
|
|
<td class="text-autocolor">@dcaLogEntry.ProfitPercent.ToString("#,#0.00", new System.Globalization.CultureInfo("en-US"))%</td>
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
<td class="text-left">No Value!</td>
|
|
|
|
}
|
2019-02-25 17:02:52 +01:00
|
|
|
|
2019-04-16 22:22:28 +02:00
|
|
|
<td class="text-right"><a href="@Html.Raw(Model.PTMagicConfiguration.GeneralSettings.Monitor.RootUrl)_get/BagDetails/?m=@dcaLogEntry.Market" data-remote="false" data-toggle="modal" data-target="#dca-chart"><i class="fa fa-plus-circle"></i></a></td>
|
|
|
|
</tr>
|
|
|
|
}
|
2019-10-15 15:05:53 +02:00
|
|
|
|
2020-03-25 23:55:47 +01:00
|
|
|
<td>Totals:</td>
|
|
|
|
<td></td>
|
2019-10-15 15:05:53 +02:00
|
|
|
<td>@Html.Raw(Model.TotalBagCost.ToString("#,#0.000000", new System.Globalization.CultureInfo("en-US")))</td>
|
2020-03-25 23:55:47 +01:00
|
|
|
<td></td>
|
|
|
|
<td></td>
|
|
|
|
<td></td>
|
|
|
|
<td></td>
|
2019-10-15 15:05:53 +02:00
|
|
|
|
2020-07-14 15:05:49 +02:00
|
|
|
<td class="text-autocolor">@Html.Raw( (((Model.TotalBagValue - Model.TotalBagCost) / Model.TotalBagCost) * 100).ToString("#0.00", new System.Globalization.CultureInfo("en-US")))%</td>
|
|
|
|
|
2019-04-16 22:22:28 +02:00
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</div>
|
2018-05-22 10:11:50 +02:00
|
|
|
|
|
|
|
@if (Model.PTData.DCALog.Count > Model.PTMagicConfiguration.GeneralSettings.Monitor.MaxDashboardBagEntries) {
|
|
|
|
<p class="text-right"><small><i class="fa fa-info-circle"></i> @Model.PTMagicConfiguration.GeneralSettings.Monitor.MaxDashboardBagEntries of @Model.PTData.DCALog.Count items listed - <a href="@Html.Raw(Model.PTMagicConfiguration.GeneralSettings.Monitor.RootUrl)BagAnalyzer">View all items</a></small></p>
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<script src="@Html.Raw(Model.PTMagicConfiguration.GeneralSettings.Monitor.RootUrl)assets/js/jquery.nicescroll.js"></script>
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
(function ($) {
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
$("#dca-chart").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>');
|
|
|
|
var link = $(e.relatedTarget);
|
|
|
|
$(this).find(".modal-content").load(link.attr("href"), function () {
|
|
|
|
$('.text-autocolor').autocolor(false);
|
|
|
|
$('[data-toggle="tooltip"]').tooltip();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
})(jQuery);
|
|
|
|
|
2019-02-25 17:02:52 +01:00
|
|
|
</script>
|