@page @model BagListModel @{ Layout = null; System.Reflection.PropertyInfo propertyInfo = typeof(Core.Main.DataObjects.PTMagicData.DCALogData).GetProperty(Model.SortFieldId); List dcaLogResult = Model.PTData.DCALog.OrderByDescending(d => propertyInfo.GetValue(d, null)).ToList(); if (Model.SortDirection.Equals("ASC")) { dcaLogResult = Model.PTData.DCALog.OrderBy(d => propertyInfo.GetValue(d, null)).ToList(); } } @foreach (Core.Main.DataObjects.PTMagicData.DCALogData dcaLogEntry in dcaLogResult) { Core.Main.DataObjects.PTMagicData.MarketPairSummary mps = null; if (Model.Summary.MarketSummary.ContainsKey(dcaLogEntry.Market)) { mps = Model.Summary.MarketSummary[dcaLogEntry.Market]; } int nextBuyTrigger = dcaLogEntry.BoughtTimes + 1; double nextBuyTriggerPercent = 0; if (Model.Summary.DCATriggers.Count >= nextBuyTrigger) { nextBuyTriggerPercent = Model.Summary.DCATriggers[nextBuyTrigger]; } bool buyDisabled = false; string buyTriggerText = dcaLogEntry.BuyTriggerPercent.ToString("#,#0.00", new System.Globalization.CultureInfo("en-US")) + "%"; if (mps != null) { if (!mps.IsDCAEnabled) { nextBuyTriggerPercent = 0; buyDisabled = true; buyTriggerText = ""; } else { if (dcaLogEntry.BuyTriggerPercent == 0) { dcaLogEntry.BuyTriggerPercent = dcaLogEntry.ProfitPercent; } } } else { buyDisabled = dcaLogEntry.BuyStrategy == null; if (dcaLogEntry.BuyTriggerPercent == 0) { dcaLogEntry.BuyTriggerPercent = dcaLogEntry.ProfitPercent; } } bool isTrailingBuyActive = dcaLogEntry.IsTrailing; if (dcaLogEntry.BuyStrategies.Count > 0) { isTrailingBuyActive = (dcaLogEntry.BuyStrategies.FindAll(bs => !bs.IsTrailing).Count == 0); } string buyStrategyText = Core.ProfitTrailer.StrategyHelper.GetStrategyText(Model.Summary, dcaLogEntry.BuyStrategies, dcaLogEntry.BuyStrategy, isTrailingBuyActive); if (!Core.ProfitTrailer.StrategyHelper.IsValidStrategy(buyStrategyText, true)) { buyDisabled = true; } string currentBuyValueText = Core.ProfitTrailer.StrategyHelper.GetCurrentValueText(dcaLogEntry.BuyStrategies, dcaLogEntry.BuyStrategy, dcaLogEntry.CurrentLowBBValue, dcaLogEntry.BuyTriggerPercent, true); string triggerBuyValueText = Core.ProfitTrailer.StrategyHelper.GetTriggerValueText(Model.Summary, dcaLogEntry.BuyStrategies, dcaLogEntry.BuyStrategy, dcaLogEntry.BBTrigger, Core.Main.Constants.MinTrendChange, dcaLogEntry.BoughtTimes, true); bool isTrailingSellActive = false; if (dcaLogEntry.SellStrategies.Count > 0) { isTrailingSellActive = (dcaLogEntry.SellStrategies.FindAll(ss => !ss.IsTrailing).Count == 0); } string sellStrategyText = Core.ProfitTrailer.StrategyHelper.GetStrategyText(Model.Summary, dcaLogEntry.SellStrategies, dcaLogEntry.SellStrategy, isTrailingSellActive); string currentSellValueText = Core.ProfitTrailer.StrategyHelper.GetCurrentValueText(dcaLogEntry.SellStrategies, dcaLogEntry.SellStrategy, dcaLogEntry.CurrentHighBBValue, dcaLogEntry.ProfitPercent, true); string triggerSellValueText = Core.ProfitTrailer.StrategyHelper.GetTriggerValueText(Model.Summary, dcaLogEntry.SellStrategies, dcaLogEntry.SellStrategy, dcaLogEntry.BBTrigger, dcaLogEntry.SellTrigger, 0, true); @if (mps != null && (mps.ActiveSingleSettings == null || mps.ActiveSingleSettings.Count == 0)) { @dcaLogEntry.Market } else { @dcaLogEntry.Market } @if (dcaLogEntry.BoughtTimes > 0) { @dcaLogEntry.BoughtTimes; } @if (buyDisabled) { @Html.Raw(buyStrategyText) } else { @Html.Raw(buyStrategyText) } @if (!buyDisabled) { @Html.Raw(currentBuyValueText) } @if (!buyDisabled && dcaLogEntry.BoughtTimes < Model.Summary.DCALevels) { @Html.Raw(triggerBuyValueText) } else { if (!buyDisabled && dcaLogEntry.BoughtTimes >= Model.Summary.DCALevels) { MAX } else { Disabled! } } @dcaLogEntry.ProfitPercent.ToString("#,#0.00", new System.Globalization.CultureInfo("en-US"))% @Html.Raw(sellStrategyText) @Html.Raw(triggerSellValueText) @dcaLogEntry.CurrentPrice.ToString("#,#0.00000000", new System.Globalization.CultureInfo("en-US")) @dcaLogEntry.AverageBuyPrice.ToString("#,#0.00000000", new System.Globalization.CultureInfo("en-US")) @dcaLogEntry.TotalCost.ToString("#,#0.00000000", new System.Globalization.CultureInfo("en-US")) Details }