Merge pull request #78 from HojouFotytu/develop

Badders' highlight pairs without average price
This commit is contained in:
Dave Baddeley 2019-02-25 19:21:57 +00:00 committed by GitHub
commit 62f2636a69
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 69 additions and 9 deletions

View File

@ -29,7 +29,7 @@
<thead>
<tr>
<th data-fieldid="Market" data-tablesaw-sortable-col>Market</th>
<th data-fieldid="TotalCost" data-tablesaw-sortable-col data-sortable-numeric="true" class="text-right" data-toggle="tooltip" data-placement="top" title="Spent total cost in @Model.Summary.MainMarket">Value</th>
<th data-fieldid="TotalCost" data-tablesaw-sortable-col data-sortable-numeric="true" class="text-left" data-toggle="tooltip" data-placement="top" title="Spent total cost in @Model.Summary.MainMarket">Value</th>
<th data-fieldid="BoughtTimes" data-tablesaw-sortable-col data-sortable-numeric="true" class="text-right" data-toggle="tooltip" data-placement="top" title="Current DCA level">DCA</th>
<th data-toggle="tooltip" data-placement="top" title="Active buy strategies">Buy Strats</th>
<th class="text-right" data-toggle="tooltip" data-placement="top" title="Buy Strategy Value">BS Value</th>
@ -98,4 +98,4 @@
interval = setInterval(function () { loadBagList(); }, @Model.PTMagicConfiguration.GeneralSettings.Monitor.BagAnalyzerRefreshSeconds * 1000);
});
</script>
}
}

View File

@ -11,6 +11,7 @@
}
@foreach (Core.Main.DataObjects.PTMagicData.DCALogData dcaLogEntry in dcaLogResult) {
// 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];
@ -75,28 +76,44 @@
string triggerSellValueText = Core.ProfitTrailer.StrategyHelper.GetTriggerValueText(Model.Summary, dcaLogEntry.SellStrategies, dcaLogEntry.SellStrategy, dcaLogEntry.BBTrigger, dcaLogEntry.SellTrigger, 0, true);
double currentFiatValue = Math.Round(dcaLogEntry.Amount * dcaLogEntry.CurrentPrice * Model.Summary.MainMarketPrice, 2);
<tr>
// Check for when PT loses the value of a pair
bool lostValue = false;
lostValue = (dcaLogEntry.TotalCost == 0.0) || (dcaLogEntry.AverageBuyPrice == 0.0);
// Render the row
<tr @(lostValue ? "class=errorRow" : "" ) >
// Market
@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>
} else {
<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>
}
<td class="text-right">@Html.Raw(@dcaLogEntry.TotalCost.ToString("#,#0.00000000", new System.Globalization.CultureInfo("en-US")) + "(" + Model.MainFiatCurrencySymbol + currentFiatValue.ToString("#,#0.00", new System.Globalization.CultureInfo("en-US")) + ")")</td>
// Value
<td class="text-left">@Html.Raw(@dcaLogEntry.TotalCost.ToString("#,#0.00000000", new System.Globalization.CultureInfo("en-US")) + " (" + Model.MainFiatCurrencySymbol + currentFiatValue.ToString("#,#0.00", new System.Globalization.CultureInfo("en-US")) + ")")</td>
// DCA level
<td class="text-right">
@if (dcaLogEntry.BoughtTimes > 0) {
@dcaLogEntry.BoughtTimes;
}
</td>
// Buy strats
@if (buyDisabled) {
<td class="text-nowrap">@Html.Raw(buyStrategyText)</td>
} else {
<td class="text-nowrap">@Html.Raw(buyStrategyText)</td>
}
// BS Value
<td class="text-right text-nowrap">
@if (!buyDisabled) {
@Html.Raw(currentBuyValueText)
}
</td>
// BS Trigger
@if (!buyDisabled && dcaLogEntry.BoughtTimes < Model.Summary.DCALevels) {
<td class="text-right text-nowrap">@Html.Raw(triggerBuyValueText)</td>
} else {
@ -106,13 +123,29 @@
<td class="text-right text-warning">Disabled!</td>
}
}
<td class="text-right text-autocolor">@dcaLogEntry.ProfitPercent.ToString("#,#0.00", new System.Globalization.CultureInfo("en-US"))%</td>
// Percent
@if(!@lostValue)
{
<td class="text-right text-autocolor">@dcaLogEntry.ProfitPercent.ToString("#,#0.00", new System.Globalization.CultureInfo("en-US"))%</td>
}
else
{
<td class="text-right">No Value!</td>
}
// Sell Strats
<td class="text-nowrap">@Html.Raw(sellStrategyText)</td>
// SST
<td class="text-right text-nowrap">
@Html.Raw(triggerSellValueText)
</td>
// Bid and avg price
<td class="text-right">@dcaLogEntry.CurrentPrice.ToString("#,#0.00000000", new System.Globalization.CultureInfo("en-US"))<br>@dcaLogEntry.AverageBuyPrice.ToString("#,#0.00000000", new System.Globalization.CultureInfo("en-US"))</td>
// Details
<td><a href="@Html.Raw(Model.PTMagicConfiguration.GeneralSettings.Monitor.RootUrl)_get/BagDetails/?m=@dcaLogEntry.Market" data-remote="false" data-toggle="modal" data-target="#dca-chart" class="btn btn-sm btn-ptmagic">Details</a></td>
</tr>
}

View File

@ -93,6 +93,7 @@
</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];
@ -131,14 +132,20 @@
string sellStrategyText = Core.ProfitTrailer.StrategyHelper.GetStrategyText(Model.Summary, dcaLogEntry.SellStrategies, dcaLogEntry.SellStrategy, isSellStrategyTrue, isTrailingSellActive);
<tr>
// Check for when PT loses the value of a pair
bool lostValue = false;
lostValue = (dcaLogEntry.TotalCost == 0.0) || (dcaLogEntry.AverageBuyPrice == 0.0);
// 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>
} else {
<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>
}
<td class="text-left">@Html.Raw(dcaLogEntry.TotalCost.ToString("#,#0.000000", 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) {
@ -148,6 +155,7 @@
<span class="text-warning" data-toggle="tooltip" data-placement="top" title="DCA is disabled for this market!">Disabled!</span>
}
</td>
@if (buyDisabled) {
<td>@Html.Raw(buyStrategyText)</td>
} else {
@ -160,7 +168,16 @@
}
</td>
<td class="text-autocolor">@dcaLogEntry.ProfitPercent.ToString("#,#0.00", new System.Globalization.CultureInfo("en-US"))%</td>
@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>
}
<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" class="btn btn-mini btn-ptmagic"><i class="fa fa-plus"></i></a></td>
</tr>
}
@ -192,4 +209,4 @@
})(jQuery);
</script>
</script>

View File

@ -141,6 +141,16 @@
display: none;
}
.errorRow
{
background-color: #550000;
}
.errorRow a
{
color: white;
}
.table-scroll-hori {
display: block;
width: 100%;