Target Profit Leverage Adjustment
This commit is contained in:
parent
8516e2557b
commit
fe32db20c5
|
@ -153,17 +153,13 @@ namespace Monitor.Pages {
|
||||||
{
|
{
|
||||||
// Loop through the pairs preparing the data for display
|
// Loop through the pairs preparing the data for display
|
||||||
Core.Main.DataObjects.PTMagicData.MarketPairSummary mps = null;
|
Core.Main.DataObjects.PTMagicData.MarketPairSummary mps = null;
|
||||||
|
|
||||||
string sellStrategyText = Core.ProfitTrailer.StrategyHelper.GetStrategyText(Summary, dcaLogEntry.SellStrategies, dcaLogEntry.SellStrategy, isSellStrategyTrue, isTrailingSellActive);
|
string sellStrategyText = Core.ProfitTrailer.StrategyHelper.GetStrategyText(Summary, dcaLogEntry.SellStrategies, dcaLogEntry.SellStrategy, isSellStrategyTrue, isTrailingSellActive);
|
||||||
|
|
||||||
bool dcaEnabled = true;
|
bool dcaEnabled = true;
|
||||||
if (mps != null)
|
if (mps != null)
|
||||||
{
|
{
|
||||||
dcaEnabled = mps.IsDCAEnabled;
|
dcaEnabled = mps.IsDCAEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Aggregate totals
|
// Aggregate totals
|
||||||
|
|
||||||
if (sellStrategyText.Contains("PENDING"))
|
if (sellStrategyText.Contains("PENDING"))
|
||||||
{
|
{
|
||||||
PendingBalance = PendingBalance + (dcaLogEntry.Amount * dcaLogEntry.CurrentPrice);
|
PendingBalance = PendingBalance + (dcaLogEntry.Amount * dcaLogEntry.CurrentPrice);
|
||||||
|
|
|
@ -93,12 +93,12 @@
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Market</th>
|
<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="Market trend last 24 hours">24H</th>
|
||||||
<th class="text-left" data-toggle="tooltip" data-placement="top" title="Total Buy Cost">Cost</th>
|
<th class="text-left" data-toggle="tooltip" data-placement="top" title="Total Buy Cost">Cost</th>
|
||||||
<th></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 buy strategies">DCA</th>
|
||||||
<th class="text-left" data-toggle="tooltip" data-placement="top" title="Active sell strategies">Sell Strats</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 for sale">Target Profit</th>
|
<th class="text-left" data-toggle="tooltip" data-placement="top" title="Target profit to sell">Target</th>
|
||||||
<th class="text-left" data-toggle="tooltip" data-placement="top" title="Current Profit">Profit</th>
|
<th class="text-left" data-toggle="tooltip" data-placement="top" title="Current Profit">Profit</th>
|
||||||
<th></th>
|
<th></th>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -137,11 +137,35 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
bool buyDisabled = false;
|
bool buyDisabled = false;
|
||||||
|
string leverage = "";
|
||||||
|
double leverageValue = 0;
|
||||||
|
|
||||||
string buyStrategyText = Core.ProfitTrailer.StrategyHelper.GetStrategyText(Model.Summary, dcaLogEntry.BuyStrategies, dcaLogEntry.BuyStrategy, isBuyStrategyTrue, isTrailingBuyActive);
|
string buyStrategyText = Core.ProfitTrailer.StrategyHelper.GetStrategyText(Model.Summary, dcaLogEntry.BuyStrategies, dcaLogEntry.BuyStrategy, isBuyStrategyTrue, isTrailingBuyActive);
|
||||||
if (!Core.ProfitTrailer.StrategyHelper.IsValidStrategy(buyStrategyText, true)) {
|
|
||||||
|
if (!Core.ProfitTrailer.StrategyHelper.IsValidStrategy(buyStrategyText, true))
|
||||||
|
{
|
||||||
buyDisabled = true;
|
buyDisabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
string sellStrategyText = Core.ProfitTrailer.StrategyHelper.GetStrategyText(Model.Summary, dcaLogEntry.SellStrategies, dcaLogEntry.SellStrategy, isSellStrategyTrue, isTrailingSellActive);
|
string sellStrategyText = Core.ProfitTrailer.StrategyHelper.GetStrategyText(Model.Summary, dcaLogEntry.SellStrategies, dcaLogEntry.SellStrategy, isSellStrategyTrue, isTrailingSellActive);
|
||||||
|
|
||||||
// Check for when PT loses the value of a pair
|
// Check for when PT loses the value of a pair
|
||||||
|
@ -197,13 +221,20 @@
|
||||||
<span data-toggle="tooltip" data-placement="top" title="DCA is disabled"><i class="fa fa-ban text-highlight"></i></span>
|
<span data-toggle="tooltip" data-placement="top" title="DCA is disabled"><i class="fa fa-ban text-highlight"></i></span>
|
||||||
}
|
}
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td>@Html.Raw(buyStrategyText)</td>
|
<td>@Html.Raw(buyStrategyText)</td>
|
||||||
|
|
||||||
<td>@Html.Raw(sellStrategyText)</td>
|
<td>@Html.Raw(sellStrategyText)</td>
|
||||||
|
|
||||||
<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>
|
|
||||||
|
@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>
|
||||||
|
}
|
||||||
|
|
||||||
@if(!@lostValue)
|
@if(!@lostValue)
|
||||||
{
|
{
|
||||||
<td class="text-autocolor">@dcaLogEntry.ProfitPercent.ToString("#,#0.00", new System.Globalization.CultureInfo("en-US"))%</td>
|
<td class="text-autocolor">@dcaLogEntry.ProfitPercent.ToString("#,#0.00", new System.Globalization.CultureInfo("en-US"))%</td>
|
||||||
|
|
Loading…
Reference in New Issue