Fix PairsBalance
This commit is contained in:
parent
94e8edd61f
commit
09099a47cd
|
@ -361,7 +361,7 @@ namespace Core.Main.DataObjects
|
|||
dcaLogData.CurrentPrice = pair.currentPrice;
|
||||
dcaLogData.SellTrigger = pair.triggerValue == null ? 0 : pair.triggerValue;
|
||||
dcaLogData.PercChange = pair.percChange;
|
||||
dcaLogData.Leverage = pair.leverage;
|
||||
dcaLogData.Leverage = pair.leverage == null ? 0 : pair.leverage;
|
||||
dcaLogData.BuyStrategy = pair.buyStrategy == null ? "" : pair.buyStrategy;
|
||||
dcaLogData.SellStrategy = pair.sellStrategy == null ? "" : pair.sellStrategy;
|
||||
dcaLogData.IsTrailing = false;
|
||||
|
|
|
@ -107,7 +107,8 @@
|
|||
double totalProfitFiat = Math.Round(totalProfit * Model.Summary.MainMarketPrice, 2);
|
||||
double percentGain = Math.Round(totalProfit / Model.PTMagicConfiguration.GeneralSettings.Application.StartBalance * 100, 2);
|
||||
string percentGainText = percentGain.ToString("#,#0.00", new System.Globalization.CultureInfo("en-US")) + "%";
|
||||
if (Model.PTData.TransactionData.Transactions.Count > 0) {
|
||||
if (Model.PTData.TransactionData.Transactions.Count > 0)
|
||||
{
|
||||
percentGainText = "<i class=\"fa fa-info-circle text-muted\" data-toggle=\"tooltip\" data-placement=\"top\" title=\"You have added at least one manual transaction, so the total gain percentage cannot be calculated.\"></i>";
|
||||
}
|
||||
|
||||
|
@ -205,12 +206,10 @@
|
|||
.donut(true) //Turn on Donut mode. Makes pie chart look tasty!
|
||||
.donutRatio(0.3) //Configure how big you want the donut hole size to be.
|
||||
;
|
||||
|
||||
d3.select("#AssetDistribution svg")
|
||||
.datum(@Html.Raw(Model.AssetDistributionData))
|
||||
.transition().duration(350)
|
||||
.call(chart);
|
||||
|
||||
return chart;
|
||||
});
|
||||
</text>
|
||||
|
@ -228,7 +227,6 @@
|
|||
$.Notification.notify('success', 'top left', '@Core.Helper.SystemHelper.SplitCamelCase(Model.Summary.CurrentGlobalSetting.SettingName) now active!', 'PTMagic switched Profit Trailer settings to "@Core.Helper.SystemHelper.SplitCamelCase(Model.Summary.CurrentGlobalSetting.SettingName)".');
|
||||
</text>
|
||||
}
|
||||
|
||||
@if (!Model.TrendChartDataJSON.Equals("")) {
|
||||
<text>
|
||||
nv.addGraph(function () {
|
||||
|
@ -244,7 +242,6 @@
|
|||
});
|
||||
</text>
|
||||
}
|
||||
|
||||
@if (!Model.ProfitChartDataJSON.Equals("")) {
|
||||
<text>
|
||||
nv.addGraph(function () {
|
||||
|
@ -256,7 +253,6 @@
|
|||
lineChart.yAxis.axisLabel('Daily Profit').tickFormat(d3.format(',.2f'));
|
||||
d3.select('.profit-chart svg').attr('perserveAspectRatio', 'xMinYMid').datum(chartData).transition().duration(500).call(lineChart);
|
||||
//nv.utils.windowResize(lineChart.update); v1.3.0 => Removed this line to prevent memory leak
|
||||
|
||||
return lineChart;
|
||||
});
|
||||
</text>
|
||||
|
|
|
@ -52,7 +52,6 @@ namespace Monitor.Pages {
|
|||
BuildMarketTrendChartData();
|
||||
BuildProfitChartData();
|
||||
}
|
||||
|
||||
private void BuildMarketTrendChartData() {
|
||||
if (MarketTrends.Count > 0) {
|
||||
TrendChartDataJSON = "[";
|
||||
|
@ -99,13 +98,10 @@ namespace Monitor.Pages {
|
|||
MarketTrendChange mtc = latestTickRange.First();
|
||||
if (trendChartTicks > 0) TrendChartDataJSON += ",\n";
|
||||
if (Double.IsInfinity(mtc.TrendChange)) mtc.TrendChange = 0;
|
||||
|
||||
TrendChartDataJSON += "{ x: new Date('" + mtc.TrendDateTime.ToString("yyyy-MM-ddTHH:mm:ss").Replace(".", ":") + "'), y: " + mtc.TrendChange.ToString("0.00", new System.Globalization.CultureInfo("en-US")) + "}";
|
||||
}
|
||||
|
||||
TrendChartDataJSON += "]";
|
||||
TrendChartDataJSON += "}";
|
||||
|
||||
mtIndex++;
|
||||
}
|
||||
}
|
||||
|
@ -143,6 +139,7 @@ namespace Monitor.Pages {
|
|||
}
|
||||
private void BuildAssetDistributionData()
|
||||
{
|
||||
// the per PT-Eelroy, the PT API doesn't provide these values when using leverage, so they are calculated here to cover either case.
|
||||
double PairsBalance = 0.0;
|
||||
double DCABalance = 0.0;
|
||||
double PendingBalance = 0.0;
|
||||
|
@ -152,14 +149,9 @@ namespace Monitor.Pages {
|
|||
|
||||
foreach (Core.Main.DataObjects.PTMagicData.DCALogData dcaLogEntry in PTData.DCALog)
|
||||
{
|
||||
// Loop through the pairs preparing the data for display
|
||||
Core.Main.DataObjects.PTMagicData.MarketPairSummary mps = null;
|
||||
string sellStrategyText = Core.ProfitTrailer.StrategyHelper.GetStrategyText(Summary, dcaLogEntry.SellStrategies, dcaLogEntry.SellStrategy, isSellStrategyTrue, isTrailingSellActive);
|
||||
bool dcaEnabled = true;
|
||||
if (mps != null)
|
||||
{
|
||||
dcaEnabled = mps.IsDCAEnabled;
|
||||
}
|
||||
|
||||
// Aggregate totals
|
||||
if (dcaLogEntry.Leverage == 0)
|
||||
{
|
||||
|
@ -167,7 +159,7 @@ namespace Monitor.Pages {
|
|||
{
|
||||
PendingBalance = PendingBalance + (dcaLogEntry.Amount * dcaLogEntry.CurrentPrice);
|
||||
}
|
||||
else if (dcaEnabled)
|
||||
else if (dcaLogEntry.BuyStrategies.Count > 0)
|
||||
{
|
||||
DCABalance = DCABalance + (dcaLogEntry.Amount * dcaLogEntry.CurrentPrice);
|
||||
}
|
||||
|
@ -182,7 +174,7 @@ namespace Monitor.Pages {
|
|||
{
|
||||
PendingBalance = PendingBalance + ((dcaLogEntry.Amount * dcaLogEntry.CurrentPrice) / dcaLogEntry.Leverage);
|
||||
}
|
||||
else if (dcaEnabled)
|
||||
else if (dcaLogEntry.BuyStrategies.Count > 0)
|
||||
{
|
||||
DCABalance = DCABalance + ((dcaLogEntry.Amount * dcaLogEntry.CurrentPrice) / dcaLogEntry.Leverage);
|
||||
}
|
||||
|
@ -191,22 +183,13 @@ namespace Monitor.Pages {
|
|||
PairsBalance = PairsBalance + ((dcaLogEntry.Amount * dcaLogEntry.CurrentPrice) / dcaLogEntry.Leverage);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
totalCurrentValue = PendingBalance + DCABalance + PairsBalance + AvailableBalance;
|
||||
|
||||
AssetDistributionData = "[";
|
||||
AssetDistributionData += "{label: 'Pairs',color: '#82E0AA',value: '" + PairsBalance.ToString("0.00", new System.Globalization.CultureInfo("en-US")) + "'},";
|
||||
AssetDistributionData += "{label: 'DCA',color: '#D98880',value: '" + DCABalance.ToString("0.00", new System.Globalization.CultureInfo("en-US")) + "'},";
|
||||
AssetDistributionData += "{label: 'Pending',color: '#F5B041',value: '" + PendingBalance.ToString("0.00", new System.Globalization.CultureInfo("en-US")) + "'},";
|
||||
AssetDistributionData += "{label: 'Balance',color: '#85C1E9',value: '" + AvailableBalance.ToString("0.00", new System.Globalization.CultureInfo("en-US")) + "'}]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue