Bag Totals and Bug Fixes

This commit is contained in:
HojouFotytu 2019-10-15 22:05:53 +09:00
parent 69b902b6f4
commit 2ea0ec698a
6 changed files with 19 additions and 6 deletions

View File

@ -615,7 +615,7 @@ namespace Core.Main.DataObjects
buyStrategy.IsTrue = ((string)(bs.positive)).IndexOf("true", StringComparison.InvariantCultureIgnoreCase) > -1;
// Is SOM?
buyLogData.IsSom = buyLogData.IsSom || buyStrategy.Name.Equals("som enabled", StringComparison.OrdinalIgnoreCase);
buyLogData.IsSom = buyLogData.IsSom || buyStrategy.Name.Contains("som enabled", StringComparison.OrdinalIgnoreCase);
// Is the pair trailing?
buyLogData.IsTrailing = buyLogData.IsTrailing || buyStrategy.IsTrailing;

View File

@ -336,7 +336,7 @@ namespace Core.ProfitTrailer
case "anderson":
result = String.Concat(strategyLetter, "AND");
break;
case "som enabled":
case "config som enabled":
result = String.Concat(strategyLetter, "SOM");
break;
case "max buy times":

View File

@ -30,7 +30,7 @@
<th data-fieldid="Market" data-tablesaw-sortable-col>Market</th>
<th data-sortable-numeric="true" data-tablesaw-sortable-col data-fieldid="PercChange" data-toggle="tooltip" data-placement="top" title="24 hour market trend">Trend</th>
<th data-sortable-numeric="true" data-fieldid="Amount" data-tablesaw-sortable-col>Amount</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="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">Cost</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>

View File

@ -94,7 +94,7 @@
<tr>
<th>Market</th>
<th class="text-left" data-toggle="tooltip" data-placement="top" title="Market trend last 24 hours">24H Trend</th>
<th class="text-left" data-toggle="tooltip" data-placement="top" title="Total Buy Value">Value</th>
<th class="text-left" data-toggle="tooltip" data-placement="top" title="Total Buy Cost">Cost</th>
<th></th>
<th class="text-left" data-toggle="tooltip" data-placement="top" title="Active buy strategies">DCA Buy Strats</th>
<th class="text-left" data-toggle="tooltip" data-placement="top" title="Active sell strategies">Sell Strats</th>
@ -147,6 +147,11 @@
bool lostValue = false;
lostValue = (dcaLogEntry.TotalCost == 0.0) || (dcaLogEntry.AverageBuyPrice == 0.0);
// Aggregate totals
Model.TotalBagCost = Model.TotalBagCost + dcaLogEntry.TotalCost;
double TradingFee = (dcaLogEntry.Amount * dcaLogEntry.CurrentPrice) * 0.002;
Model.TotalBagValue = Model.TotalBagValue + ((dcaLogEntry.Amount * dcaLogEntry.CurrentPrice) - TradingFee);
// Render the row
<tr @(lostValue ? "class=errorRow" : "") >
@if (mps == null || mps.ActiveSingleSettings == null || mps.ActiveSingleSettings.Count == 0) {
@ -185,6 +190,12 @@
<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>
}
<td>Totals:</td><td></td>
<td>@Html.Raw(Model.TotalBagCost.ToString("#,#0.000000", new System.Globalization.CultureInfo("en-US")))</td>
<td></td><td></td><td></td>
<td class="text-autocolor">@Html.Raw((((Model.TotalBagValue - Model.TotalBagCost) / Model.TotalBagCost) * 100).ToString("#,#0.00", new System.Globalization.CultureInfo("en-US")))%</td>
</tbody>
</table>
</div>

View File

@ -19,6 +19,8 @@ namespace Monitor.Pages {
BindData();
}
public double TotalBagCost = 0;
public double TotalBagValue = 0;
private void BindData() {
PTData = this.PtDataObject;

View File

@ -93,7 +93,7 @@ const PropertyTemplate = ({ settingType, settingName, propertyType, propertyKey,
<div class="form-group row">
<div class="col-md-4">
<input type="text" class="form-control" placeholder="Profit Trailer setting" name="MarketAnalyzer_${settingType}_${settingName}|${propertyType}Property_${propertyKeySimple}" value="${propertyKeySimple}">
<span class="help-block"><small>Any <a href="https://wiki.profittrailer.com/doku.php?id=${propertyType}.properties" target="_blank">variable from PT's settings</a> may be used!</small></span>
<span class="help-block"><small>Any <a href="https://wiki.profittrailer.com/doku.php?id=${propertyType}_config" target="_blank">variable from PT's settings</a> may be used!</small></span>
</div>
<div class="col-md-3">
<input type="text" class="form-control" placeholder="Value" name="MarketAnalyzer_${settingType}_${settingName}|${propertyType}Property_${propertyKeySimple}|Value" value="${value}">