cdev
This commit is contained in:
parent
a037e1df6a
commit
6116272e77
|
@ -304,21 +304,12 @@ namespace Core.Main.DataObjects
|
|||
sellLogData.AverageBuyPrice = rsld.avgPrice;
|
||||
sellLogData.TotalCost = sellLogData.SoldAmount * sellLogData.AverageBuyPrice;
|
||||
|
||||
// check if sale was a short position
|
||||
if ((sellLogData.ProfitPercent > 0) && (sellLogData.AverageBuyPrice > sellLogData.SoldPrice))
|
||||
{
|
||||
double soldValueRaw = (sellLogData.SoldAmount * sellLogData.SoldPrice);
|
||||
double soldValueAfterFees = soldValueRaw + (soldValueRaw * ((double)rsld.fee / 100));
|
||||
sellLogData.SoldValue = soldValueAfterFees;
|
||||
sellLogData.Profit = Math.Abs(Math.Round(sellLogData.SoldValue - sellLogData.TotalCost, 8));
|
||||
}
|
||||
else
|
||||
{
|
||||
// check if bot is a shortbot via PT API. Losses on short bot showing as gains. Issue #195
|
||||
|
||||
double soldValueRaw = (sellLogData.SoldAmount * sellLogData.SoldPrice);
|
||||
double soldValueAfterFees = soldValueRaw - (soldValueRaw * ((double)rsld.fee / 100));
|
||||
sellLogData.SoldValue = soldValueAfterFees;
|
||||
sellLogData.Profit = Math.Round(sellLogData.SoldValue - sellLogData.TotalCost, 8);
|
||||
}
|
||||
|
||||
//Convert Unix Timestamp to Datetime
|
||||
System.DateTime dtDateTime = new DateTime(1970, 1, 1, 0, 0, 0, System.DateTimeKind.Utc);
|
||||
|
|
|
@ -228,7 +228,7 @@ namespace Core.ProfitTrailer
|
|||
result = "";
|
||||
}
|
||||
|
||||
// strategy labels that are variable, so can't be caught by the switch statement
|
||||
// strategy labels that are variable value
|
||||
if (result.Contains("REBUY"))
|
||||
{
|
||||
time = strategyName.Remove(0, 14);
|
||||
|
@ -423,6 +423,18 @@ namespace Core.ProfitTrailer
|
|||
case "no dca buy logic":
|
||||
result = String.Concat(strategyLetter, "NODCA");
|
||||
break;
|
||||
case "combimagain":
|
||||
result = String.Concat(strategyLetter, "COMBIG");
|
||||
break;
|
||||
case "combimaspread":
|
||||
result = String.Concat(strategyLetter, "COMBIS");
|
||||
break;
|
||||
case "combimacross":
|
||||
result = String.Concat(strategyLetter, "COMBIC");
|
||||
break;
|
||||
case "macdpercentage":
|
||||
result = String.Concat(strategyLetter, "MACDPERC");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -588,7 +600,7 @@ namespace Core.ProfitTrailer
|
|||
if (!isValidStrategy)
|
||||
{
|
||||
// Parse Formulas
|
||||
if (strategy.Name.Contains("FORMULA") && !strategy.Name.Contains("STATS"))
|
||||
if (strategy.Name.Contains("FORMULA") && !strategy.Name.Contains("STATS") && !strategy.Name.Contains("LEVEL"))
|
||||
{
|
||||
string expression = strategy.Name.Remove(0, 10);
|
||||
expression = expression.Replace("<span class=\"tdgreen\">", "true").Replace("<span class=\"red\">", "false").Replace("</span>", "").Replace("&&", "and").Replace("||", "or");
|
||||
|
@ -605,10 +617,43 @@ namespace Core.ProfitTrailer
|
|||
}
|
||||
|
||||
}
|
||||
else
|
||||
//else
|
||||
//{
|
||||
// strategyText += "<span class=\"label label-warning\" data-toggle=\"tooltip\" data-placement=\"top\" title=\"" + strategy.Name + "\">" + StrategyHelper.GetStrategyShortcut(strategy.Name, false) + "</span> ";
|
||||
//}
|
||||
|
||||
|
||||
if (strategy.Name.Contains("LEVEL") && !strategy.Name.Contains("TRIGGERED"))
|
||||
{
|
||||
strategyText += "<span class=\"label label-warning\" data-toggle=\"tooltip\" data-placement=\"top\" title=\"" + strategy.Name + "\">" + StrategyHelper.GetStrategyShortcut(strategy.Name, false) + "</span> ";
|
||||
string level = strategy.Name.Substring(5, 2);
|
||||
string expression = strategy.Name.Remove(0, 17);
|
||||
expression = expression.Replace("<span class=\"tdgreen\">", "true").Replace("<span class=\"red\">", "false").Replace("</span>", "").Replace("&&", "and").Replace("||", "or");
|
||||
expression = regx.Replace(expression, String.Empty);
|
||||
var tokens = new Tokenizer(expression).Tokenize();
|
||||
var parser = new Parser(tokens);
|
||||
if (parser.Parse())
|
||||
{
|
||||
strategyText += "<span class=\"label label-success\" data-toggle=\"tooltip\" data-placement=\"top\" title=\"LEVEL FORMULA\">LEVEL" + level + "</span> ";
|
||||
}
|
||||
else
|
||||
{
|
||||
strategyText += "<span class=\"label label-danger\" data-toggle=\"tooltip\" data-placement=\"top\" title=\"LEVEL FORMULA\">LEVEL" + level + "</span> ";
|
||||
}
|
||||
|
||||
}
|
||||
//else
|
||||
//{
|
||||
// strategyText += "<span class=\"label label-warning\" data-toggle=\"tooltip\" data-placement=\"top\" title=\"" + strategy.Name + "\">" + StrategyHelper.GetStrategyShortcut(strategy.Name, false) + "</span> ";
|
||||
//}
|
||||
|
||||
if (strategy.Name.Contains("LEVEL") && strategy.Name.Contains("TRIGGERED"))
|
||||
{
|
||||
string level = strategy.Name.Substring(5, 2);
|
||||
strategyText += "<span class=\"label label-success\" data-toggle=\"tooltip\" data-placement=\"top\" title=\"CONDITIONAL FORMULA\">LEVEL " + level + "TRIG</span> ";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
<div class="col-md-5 px-1">
|
||||
<div class="card-box px-2" style="height:305px;">
|
||||
<div class="cdev" data-percent="100" data-duration="@Html.Raw(@Model.PTMagicConfiguration.GeneralSettings.Monitor.RefreshSeconds * 1000)" data-color="#aaa,#414d59"></div>
|
||||
|
||||
@if (!Model.TrendChartDataJSON.Equals("")) {
|
||||
<div class="trend-chart">
|
||||
<svg style="height: 300px;width: 100%;"></svg>
|
||||
|
@ -25,7 +24,7 @@
|
|||
</div>
|
||||
<div class="col-md-2 px-1">
|
||||
<div class="card-box px-2" style="height:305px;">
|
||||
<div class="cdev" data-percent="100" data-duration="@Html.Raw(@Model.PTMagicConfiguration.GeneralSettings.Monitor.RefreshSeconds * 1000)" data-color="#aaa,#414d59"></div>
|
||||
|
||||
@{
|
||||
double currentBalance = Model.PTData.GetCurrentBalance();
|
||||
string currentBalanceString = currentBalance.ToString("#,#0.00000000", new System.Globalization.CultureInfo("en-US"));
|
||||
|
@ -34,21 +33,14 @@
|
|||
}
|
||||
}
|
||||
<div class="text-center">
|
||||
<small>
|
||||
Start balence: <text class="text-autocolor"> @Model.PTMagicConfiguration.GeneralSettings.Application.StartBalance @Model.Summary.MainMarket</text>
|
||||
<br>
|
||||
Current value: <text class="text-autocolor"> @currentBalanceString @Model.Summary.MainMarket</text>
|
||||
<br>
|
||||
Gain: <text class="text-autocolor"> @Math.Round(((currentBalance - Model.PTMagicConfiguration.GeneralSettings.Application.StartBalance) / Model.PTMagicConfiguration.GeneralSettings.Application.StartBalance) * 100, 2) %</text>
|
||||
</small>
|
||||
</div>
|
||||
<small>TCV: <text class="text-autocolor"> @currentBalanceString @Model.Summary.MainMarket </text> </small></div>
|
||||
<div id="AssetDistribution">
|
||||
<svg style="height:230px;width:100%"></svg>
|
||||
<svg style="height:290px;width:100%"></svg>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-5 px-1">
|
||||
<div class="cdev" data-percent="100" data-duration="@Html.Raw(@Model.PTMagicConfiguration.GeneralSettings.Monitor.RefreshSeconds * 1000)" data-color="#aaa,#414d59"></div>
|
||||
|
||||
|
||||
<div class="card-box px-2" style="height:305px;">
|
||||
@if (!Model.ProfitChartDataJSON.Equals("")) {
|
||||
|
@ -65,11 +57,9 @@
|
|||
|
||||
<div class="row">
|
||||
<div class="col-md-6 px-1">
|
||||
<div class="cdev" data-percent="100" data-duration="@Html.Raw(@Model.PTMagicConfiguration.GeneralSettings.Monitor.RefreshSeconds * 1000)" data-color="#aaa,#414d59"></div>
|
||||
|
||||
<div class="card-box px-2">
|
||||
<br/>
|
||||
<h4 class="m-t-0 m-b-20 header-title"><b>Market Trends at @Model.PTMagicConfiguration.GeneralSettings.Application.Exchange</b><small class="pull-right"><a href="@Html.Raw(Model.PTMagicConfiguration.GeneralSettings.Monitor.RootUrl)MarketAnalyzer">more</a></small></h4>
|
||||
<h4 class="m-t-0 m-b-20 header-title"><b>Market Trends at @Model.PTMagicConfiguration.GeneralSettings.Application.Exchange</b>
|
||||
<small class="pull-right"><a href="@Html.Raw(Model.PTMagicConfiguration.GeneralSettings.Monitor.RootUrl)MarketAnalyzer">more</a></small></h4>
|
||||
|
||||
<table class="table table-sm">
|
||||
<thead>
|
||||
|
@ -108,12 +98,10 @@
|
|||
</div>
|
||||
|
||||
<div class="col-md-6 px-1">
|
||||
<div class="cdev" data-percent="100" data-duration="@Html.Raw(@Model.PTMagicConfiguration.GeneralSettings.Monitor.RefreshSeconds * 1000)" data-color="#aaa,#414d59"></div>
|
||||
|
||||
<div class="card-box px-2">
|
||||
<br/>
|
||||
<h4 class="m-t-0 m-b-20 header-title"><b>Sales Overview</b><small class="pull-right"><a href="@Html.Raw(Model.PTMagicConfiguration.GeneralSettings.Monitor.RootUrl)SalesAnalyzer">more</a></small></h4>
|
||||
@{
|
||||
@{
|
||||
double totalProfit = Model.PTData.SellLog.Sum(s => s.Profit);
|
||||
double totalProfitFiat = Math.Round(totalProfit * Model.Summary.MainMarketPrice, 2);
|
||||
double percentGain = Math.Round(totalProfit / Model.PTMagicConfiguration.GeneralSettings.Application.StartBalance * 100, 2);
|
||||
|
@ -190,6 +178,7 @@
|
|||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<small class="pull-right">Starting Balance: @Model.PTMagicConfiguration.GeneralSettings.Application.StartBalance @Model.Summary.MainMarket</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -224,8 +224,9 @@
|
|||
<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>
|
||||
|
||||
<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>
|
||||
|
|
Loading…
Reference in New Issue