@page
@model BagDetailsModel
@{
Layout = null;
Core.Main.DataObjects.PTMagicData.MarketPairSummary mps = null;
if (Model.Summary.MarketSummary.ContainsKey(Model.DCALogData.Market)) {
mps = Model.Summary.MarketSummary[Model.DCALogData.Market];
}
int nextBuyTrigger = Model.DCALogData.BoughtTimes + 1;
double nextBuyTriggerPercent = 0;
if (Model.Summary.DCATriggers.Count >= nextBuyTrigger) {
nextBuyTriggerPercent = Model.Summary.DCATriggers[nextBuyTrigger];
}
bool buyDisabled = false;
string buyTriggerText = Model.DCALogData.BuyTriggerPercent.ToString("#,#0.00", new System.Globalization.CultureInfo("en-US")) + "%";
if (mps != null) {
if (!mps.IsDCAEnabled) {
nextBuyTriggerPercent = 0;
buyDisabled = true;
buyTriggerText = "";
} else {
if (Model.DCALogData.BuyTriggerPercent == 0) {
Model.DCALogData.BuyTriggerPercent = Model.DCALogData.ProfitPercent;
}
}
} else {
buyDisabled = Model.DCALogData.BuyStrategy == null;
if (Model.DCALogData.BuyTriggerPercent == 0) {
Model.DCALogData.BuyTriggerPercent = Model.DCALogData.ProfitPercent;
}
}
bool isTrailingBuyActive = Model.DCALogData.IsTrailing;
if (Model.DCALogData.BuyStrategies.Count > 0) {
isTrailingBuyActive = (Model.DCALogData.BuyStrategies.FindAll(bs => bs.IsTrailing).Count > 0);
}
bool isBuyStrategyTrue = Model.DCALogData.IsTrue;
if (Model.DCALogData.BuyStrategies.Count > 0) {
isBuyStrategyTrue = (Model.DCALogData.BuyStrategies.FindAll(bs => !bs.IsTrue).Count == 0);
}
string buyStrategyText = Core.ProfitTrailer.StrategyHelper.GetStrategyText(Model.Summary, Model.DCALogData.BuyStrategies, Model.DCALogData.BuyStrategy, isBuyStrategyTrue, isTrailingBuyActive);
if (!Core.ProfitTrailer.StrategyHelper.IsValidStrategy(buyStrategyText, true)) {
buyDisabled = true;
}
string currentBuyValueText = Core.ProfitTrailer.StrategyHelper.GetCurrentValueText(Model.DCALogData.BuyStrategies, Model.DCALogData.BuyStrategy, Model.DCALogData.CurrentLowBBValue, Model.DCALogData.BuyTriggerPercent, true);
string triggerBuyValueText = Core.ProfitTrailer.StrategyHelper.GetTriggerValueText(Model.Summary, Model.DCALogData.BuyStrategies, Model.DCALogData.BuyStrategy, Model.DCALogData.BBTrigger, Core.Main.Constants.MinTrendChange, Model.DCALogData.BoughtTimes, true);
string bagAgeText = "";
int bagAgeSeconds = (int)Math.Ceiling(Model.DateTimeNow.Subtract(Model.DCALogData.FirstBoughtDate).TotalSeconds);
bagAgeText = Core.Helper.SystemHelper.GetProperDurationTime(bagAgeSeconds);
double nextBuyTriggerPrice = 0.0;
double nextAvgBoughtPrice = 0.0;
if (nextBuyTriggerPercent != 0) {
nextBuyTriggerPrice = Model.DCALogData.AverageBuyPrice + (Model.DCALogData.AverageBuyPrice * nextBuyTriggerPercent / 100);
nextAvgBoughtPrice = (Model.DCALogData.TotalCost + (Model.DCALogData.Amount * nextBuyTriggerPrice)) / (Model.DCALogData.Amount * 2);
}
bool isTrailingSellActive = false;
if (Model.DCALogData.SellStrategies.Count > 0) {
isTrailingSellActive = (Model.DCALogData.SellStrategies.FindAll(ss => ss.IsTrailing).Count > 0);
}
bool isSellStrategyTrue = false;
if (Model.DCALogData.BuyStrategies.Count > 0) {
isSellStrategyTrue = (Model.DCALogData.SellStrategies.FindAll(ss => !ss.IsTrue).Count == 0);
}
string sellStrategyText = Core.ProfitTrailer.StrategyHelper.GetStrategyText(Model.Summary, Model.DCALogData.SellStrategies, Model.DCALogData.SellStrategy, isSellStrategyTrue, isTrailingSellActive);
string currentSellValueText = Core.ProfitTrailer.StrategyHelper.GetCurrentValueText(Model.DCALogData.SellStrategies, Model.DCALogData.SellStrategy, Model.DCALogData.CurrentHighBBValue, Model.DCALogData.ProfitPercent, true);
string triggerSellValueText = Core.ProfitTrailer.StrategyHelper.GetTriggerValueText(Model.Summary, Model.DCALogData.SellStrategies, Model.DCALogData.SellStrategy, Model.DCALogData.BBTrigger, Model.DCALogData.SellTrigger, 0, true);
double sellTriggerPrice = Model.DCALogData.AverageBuyPrice + (Model.DCALogData.AverageBuyPrice * Model.DCALogData.SellTrigger / 100);
double averageProfitPercent = 0;
@* if (Model.PTData.SellLog.FindAll(m => m.Market == Model.DCALogData.Market).Count > 0) {
averageProfitPercent = Model.PTData.SellLog.FindAll(m => m.Market == Model.DCALogData.Market).Average(p => p.ProfitPercent);
} *@
double investedFiatValue = Math.Round(Model.DCALogData.TotalCost * Model.Summary.MainMarketPrice, 2);
double currentValue = Math.Round(Model.DCALogData.Amount * Model.DCALogData.CurrentPrice, 8);
double currentFiatValue = Math.Round(Model.DCALogData.Amount * Model.DCALogData.CurrentPrice * Model.Summary.MainMarketPrice, 2);
double currentProfit = Math.Round(currentValue - Model.DCALogData.TotalCost, 8);
double currentFiatProfit = Math.Round(currentFiatValue - investedFiatValue, 2);
}
First Bought |
@Model.DCALogData.FirstBoughtDate.ToShortDateString() @Model.DCALogData.FirstBoughtDate.ToShortTimeString() |
DCA Buy Strategies |
@if (buyDisabled) {
@Html.Raw(buyStrategyText) |
} else {
@Html.Raw(buyStrategyText) |
}
Average Buy Price |
@Model.DCALogData.AverageBuyPrice.ToString("#,#0.00000000", new System.Globalization.CultureInfo("en-US")) |
Invested @Model.Summary.MainMarket Value |
@Model.DCALogData.TotalCost.ToString("#,#0.00000000", new System.Globalization.CultureInfo("en-US")) |
Invested @Model.Summary.MainFiatCurrency Value |
@Html.Raw(Model.MainFiatCurrencySymbol + investedFiatValue.ToString("#,#0.00", new System.Globalization.CultureInfo("en-US"))) |
Current Buy Trigger Value |
@if (!buyDisabled) {
@Html.Raw(currentBuyValueText)
}
|
Next Buy Trigger |
@if (!buyDisabled && Model.DCALogData.BoughtTimes < Model.Summary.DCALevels) {
@Html.Raw(triggerBuyValueText) |
} else {
if (!buyDisabled && Model.DCALogData.BoughtTimes >= Model.Summary.DCALevels) {
MAX |
} else {
Disabled! |
}
}
@if (Model.DCALogData.BuyStrategies.Count == 0) {
Next Buy Trigger Price |
@if (!buyDisabled) {
@if (nextBuyTriggerPrice != 0) {
@nextBuyTriggerPrice.ToString("#,#0.00000000", new System.Globalization.CultureInfo("en-US")) |
} else {
MAX |
}
} else {
DCA Disabled! |
}
Next approx. Avg. Price |
@if (!buyDisabled) {
@if (nextAvgBoughtPrice != 0) {
@nextAvgBoughtPrice.ToString("#,#0.00000000", new System.Globalization.CultureInfo("en-US")) |
} else {
MAX |
}
} else {
DCA Disabled! |
}
}
Age |
@bagAgeText |
Sell Strategies |
@Html.Raw(sellStrategyText) |
Current Bid Price |
@Model.DCALogData.CurrentPrice.ToString("#,#0.00000000", new System.Globalization.CultureInfo("en-US")) |
Current @Model.Summary.MainMarket Value |
@currentValue.ToString("#,#0.00000000", new System.Globalization.CultureInfo("en-US")) (@currentProfit.ToString("#,#0.00000000", new System.Globalization.CultureInfo("en-US"))) |
Current @Model.Summary.MainFiatCurrency Value |
@Html.Raw(Model.MainFiatCurrencySymbol + currentFiatValue.ToString("#,#0.00", new System.Globalization.CultureInfo("en-US"))) (@Html.Raw(Model.MainFiatCurrencySymbol + currentFiatProfit.ToString("#,#0.00", new System.Globalization.CultureInfo("en-US")))) |
Current Profit/Loss |
@Model.DCALogData.ProfitPercent.ToString("#,#0.00", new System.Globalization.CultureInfo("en-US"))% |
@if (Model.DCALogData.CurrentHighBBValue > 0) {
Sell Value (HBB) |
@Model.DCALogData.CurrentHighBBValue.ToString("#,#0.00000000", new System.Globalization.CultureInfo("en-US")) |
}
Sell Trigger |
@Html.Raw(triggerSellValueText) |
@if (Model.DCALogData.SellStrategies.Count == 0) {
Sell Trigger Price |
@sellTriggerPrice.ToString("#,#0.00000000", new System.Globalization.CultureInfo("en-US")) |
}
Average Profit % |
@if (averageProfitPercent != 0) {
@averageProfitPercent.ToString("#,#0.00", new System.Globalization.CultureInfo("en-US"))% |
} else {
No sales found for @Model.DCALogData.Market |
}