@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];
}
bool dcaEnabled = true;
if (mps != null) {
dcaEnabled = mps.IsDCAEnabled;
}
bool isTrailingBuyActive = dcaLogEntry.IsTrailing;
if (dcaLogEntry.BuyStrategies.Count > 0) {
isTrailingBuyActive = (dcaLogEntry.BuyStrategies.FindAll(bs => bs.IsTrailing).Count > 0);
}
bool isBuyStrategyTrue = dcaLogEntry.IsTrue;
if (dcaLogEntry.BuyStrategies.Count > 0) {
isBuyStrategyTrue = (dcaLogEntry.BuyStrategies.FindAll(bs => !bs.IsTrue).Count == 0);
}
bool isTrailingSellActive = false;
if (dcaLogEntry.SellStrategies.Count > 0) {
isTrailingSellActive = (dcaLogEntry.SellStrategies.FindAll(ss => ss.IsTrailing).Count > 0);
}
bool isSellStrategyTrue = false;
if (dcaLogEntry.BuyStrategies.Count > 0) {
isSellStrategyTrue = (dcaLogEntry.SellStrategies.FindAll(ss => !ss.IsTrue).Count == 0);
}
bool buyDisabled = false;
string buyStrategyText = Core.ProfitTrailer.StrategyHelper.GetStrategyText(Model.Summary, dcaLogEntry.BuyStrategies, dcaLogEntry.BuyStrategy, isBuyStrategyTrue, isTrailingBuyActive);
if (!Core.ProfitTrailer.StrategyHelper.IsValidStrategy(buyStrategyText, true)) {
buyDisabled = true;
}
string sellStrategyText = Core.ProfitTrailer.StrategyHelper.GetStrategyText(Model.Summary, dcaLogEntry.SellStrategies, dcaLogEntry.SellStrategy, isSellStrategyTrue, isTrailingSellActive);
// Check for when PT loses the value of a pair
bool lostValue = false;
lostValue = (dcaLogEntry.TotalCost == 0.0) || (dcaLogEntry.AverageBuyPrice == 0.0);
// Aggregate totals
Model.TotalBagCost = Model.TotalBagCost + dcaLogEntry.TotalCost;
double ExchangeFee = 0;
switch (Model.PTMagicConfiguration.GeneralSettings.Application.Exchange.ToLower())
{
case "binance":
ExchangeFee = 0.002;
break;
case "binanceus":
ExchangeFee = 0.002;
break;
case "binancefutures":
ExchangeFee = 0.002;
break;
case "bittrex":
ExchangeFee = 0.0025;
break;
case "poloniex":
ExchangeFee = 0.0025;
break;
default:
break;
}
double TradingFee = (dcaLogEntry.Amount * dcaLogEntry.CurrentPrice) * ExchangeFee;
Model.TotalBagValue = Model.TotalBagValue + ((dcaLogEntry.Amount * dcaLogEntry.CurrentPrice) - TradingFee);
// Render the row
@if (mps == null || mps.ActiveSingleSettings == null || mps.ActiveSingleSettings.Count == 0) {
@dcaLogEntry.Market |
} else {
@dcaLogEntry.Market |
}
@Html.Raw((dcaLogEntry.PercChange * 100).ToString("#,#0.00", new System.Globalization.CultureInfo("en-US")))% |
@Html.Raw(dcaLogEntry.TotalCost.ToString("#,#0.000000", new System.Globalization.CultureInfo("en-US"))) |
@if (dcaEnabled) {
@if (dcaLogEntry.BoughtTimes > 0) {
@dcaLogEntry.BoughtTimes;
}
} else {
}
|
@Html.Raw(buyStrategyText) |
@Html.Raw(sellStrategyText) |
@if(!@lostValue)
{
@dcaLogEntry.ProfitPercent.ToString("#,#0.00", new System.Globalization.CultureInfo("en-US"))% |
}
else
{
No Value! |
}
|
}
Totals: | |
@Html.Raw(Model.TotalBagCost.ToString("#,#0.000000", new System.Globalization.CultureInfo("en-US"))) |
| | |
@Html.Raw((((Model.TotalBagValue - Model.TotalBagCost) / Model.TotalBagCost) * 100).ToString("#,#0.00", new System.Globalization.CultureInfo("en-US")))% |