Merge pull request #110 from djbadders/develop
Updated to use PT data for balance and buy order tweak
This commit is contained in:
commit
619fbf65ab
|
@ -400,26 +400,6 @@ namespace Core.Main.DataObjects.PTMagicData
|
|||
|
||||
#region Profit Trailer JSON Objects
|
||||
|
||||
public class PTData
|
||||
{
|
||||
public List<sellLogData> SellLogData { get; set; } = new List<sellLogData>();
|
||||
public List<dcaLogData> DCALogData { get; set; } = new List<dcaLogData>();
|
||||
public List<dcaLogData> GainLogData { get; set; } = new List<dcaLogData>();
|
||||
public List<buyLogData> bbBuyLogData { get; set; } = new List<buyLogData>();
|
||||
}
|
||||
|
||||
public class sellLogData
|
||||
{
|
||||
public double soldAmount { get; set; }
|
||||
public double soldDate { get; set; }
|
||||
public int boughtTimes { get; set; }
|
||||
public string market { get; set; }
|
||||
public double profit { get; set; }
|
||||
public double avgPrice { get; set; }
|
||||
public double currentPrice { get; set; }
|
||||
public double fee { get; set; }
|
||||
}
|
||||
|
||||
public class SellLogData
|
||||
{
|
||||
public double SoldAmount { get; set; }
|
||||
|
@ -434,13 +414,6 @@ namespace Core.Main.DataObjects.PTMagicData
|
|||
public double SoldValue { get; set; }
|
||||
}
|
||||
|
||||
public class AverageCalculator
|
||||
{
|
||||
public double totalAmountWithSold { get; set; }
|
||||
public double avgCost { get; set; }
|
||||
public double totalWeightedPrice { get; set; }
|
||||
}
|
||||
|
||||
public class PTStrategy
|
||||
{
|
||||
public string type { get; set; }
|
||||
|
@ -454,29 +427,6 @@ namespace Core.Main.DataObjects.PTMagicData
|
|||
public string positive { get; set; }
|
||||
}
|
||||
|
||||
public class dcaLogData
|
||||
{
|
||||
public int boughtTimes { get; set; } = 0;
|
||||
public string market { get; set; }
|
||||
public string positive { get; set; }
|
||||
public double buyProfit { get; set; }
|
||||
public double BBLow { get; set; }
|
||||
public double BBTrigger { get; set; }
|
||||
public double highbb { get; set; }
|
||||
public double profit { get; set; }
|
||||
public double avgPrice { get; set; }
|
||||
public double totalCost { get; set; }
|
||||
public double totalAmount { get; set; }
|
||||
public int firstBoughtDate { get; set; }
|
||||
public double currentPrice { get; set; }
|
||||
public string sellStrategy { get; set; }
|
||||
public string buyStrategy { get; set; }
|
||||
public double triggerValue { get; set; }
|
||||
public double percChange { get; set; }
|
||||
public List<PTStrategy> buyStrategies { get; set; }
|
||||
public List<PTStrategy> sellStrategies { get; set; }
|
||||
}
|
||||
|
||||
public class Strategy
|
||||
{
|
||||
public string Type { get; set; }
|
||||
|
@ -504,6 +454,7 @@ namespace Core.Main.DataObjects.PTMagicData
|
|||
public double ProfitPercent { get; set; }
|
||||
public double AverageBuyPrice { get; set; }
|
||||
public double TotalCost { get; set; }
|
||||
public double CurrentValue { get; set; }
|
||||
public double Amount { get; set; }
|
||||
public double CurrentPrice { get; set; }
|
||||
public double SellTrigger { get; set; }
|
||||
|
@ -515,27 +466,14 @@ namespace Core.Main.DataObjects.PTMagicData
|
|||
public List<Strategy> SellStrategies { get; set; } = new List<Strategy>();
|
||||
}
|
||||
|
||||
public class buyLogData
|
||||
{
|
||||
public string market { get; set; }
|
||||
public string positive { get; set; }
|
||||
public double BBLow { get; set; }
|
||||
public double BBHigh { get; set; }
|
||||
public double BBTrigger { get; set; }
|
||||
public double profit { get; set; }
|
||||
public double currentPrice { get; set; }
|
||||
public double currentValue { get; set; }
|
||||
public string buyStrategy { get; set; }
|
||||
public double triggerValue { get; set; }
|
||||
public double percChange { get; set; }
|
||||
public List<PTStrategy> buyStrategies { get; set; }
|
||||
}
|
||||
|
||||
public class BuyLogData
|
||||
{
|
||||
public double CurrentLowBBValue { get; set; }
|
||||
public double CurrentHighBBValue { get; set; }
|
||||
public double BBTrigger { get; set; }
|
||||
public double CurrentValue { get; set; }
|
||||
public double TriggerValue { get; set; }
|
||||
public string BuyStrategy { get; set; }
|
||||
public bool IsTrailing { get; set; }
|
||||
public bool IsTrue { get; set; }
|
||||
public bool IsSom { get; set; }
|
||||
|
@ -543,12 +481,20 @@ namespace Core.Main.DataObjects.PTMagicData
|
|||
public string Market { get; set; }
|
||||
public double ProfitPercent { get; set; }
|
||||
public double CurrentPrice { get; set; }
|
||||
public double CurrentValue { get; set; }
|
||||
public double TriggerValue { get; set; }
|
||||
public int BoughtTimes { get; set; }
|
||||
public double PercChange { get; set; }
|
||||
public string BuyStrategy { get; set; }
|
||||
public List<Strategy> BuyStrategies { get; set; } = new List<Strategy>();
|
||||
}
|
||||
|
||||
public class SummaryData
|
||||
{
|
||||
public double Balance { get; set; }
|
||||
public double StartBalance { get; set; }
|
||||
public double PairsValue { get; set; }
|
||||
public double DCAValue { get; set; }
|
||||
public double PendingValue { get; set; }
|
||||
public double DustValue { get; set; }
|
||||
public string Market { get; set; }
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ using System.Threading.Tasks;
|
|||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Core.Main.DataObjects.PTMagicData;
|
||||
|
||||
namespace Core.Main.DataObjects
|
||||
|
@ -17,6 +18,7 @@ namespace Core.Main.DataObjects
|
|||
|
||||
public class ProfitTrailerData
|
||||
{
|
||||
private SummaryData _summary = null;
|
||||
private List<SellLogData> _sellLog = new List<SellLogData>();
|
||||
private List<DCALogData> _dcaLog = new List<DCALogData>();
|
||||
private List<BuyLogData> _buyLog = new List<BuyLogData>();
|
||||
|
@ -45,27 +47,31 @@ namespace Core.Main.DataObjects
|
|||
response.Close();
|
||||
|
||||
// Parse the JSON and build the data sets
|
||||
PTData rawPTData = JsonConvert.DeserializeObject<PTData>(html);
|
||||
dynamic rawPTData = JObject.Parse(html);
|
||||
|
||||
Parallel.Invoke(() =>
|
||||
{
|
||||
if (rawPTData.SellLogData != null)
|
||||
_summary = BuildSummaryData(rawPTData);
|
||||
},
|
||||
() =>
|
||||
{
|
||||
this.BuildSellLogData(rawPTData.SellLogData, _systemConfiguration);
|
||||
if (rawPTData.sellLogData != null)
|
||||
{
|
||||
this.BuildSellLogData(rawPTData.sellLogData, _systemConfiguration);
|
||||
}
|
||||
},
|
||||
() =>
|
||||
{
|
||||
if (rawPTData.bbBuyLogData != null)
|
||||
{
|
||||
this.BuildBuyLogData(rawPTData.bbBuyLogData, _systemConfiguration);
|
||||
this.BuildBuyLogData(rawPTData.bbBuyLogData);
|
||||
}
|
||||
},
|
||||
() =>
|
||||
{
|
||||
if (rawPTData.DCALogData != null)
|
||||
if (rawPTData.dcaLogData != null)
|
||||
{
|
||||
this.BuildDCALogData(rawPTData.DCALogData, rawPTData.GainLogData, _systemConfiguration);
|
||||
this.BuildDCALogData(rawPTData.dcaLogData, rawPTData.gainLogData, _systemConfiguration);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -74,6 +80,13 @@ namespace Core.Main.DataObjects
|
|||
_dateTimeNow = DateTimeOffset.UtcNow.ToOffset(offsetTimeSpan);
|
||||
}
|
||||
|
||||
public SummaryData Summary
|
||||
{
|
||||
get
|
||||
{
|
||||
return _summary;
|
||||
}
|
||||
}
|
||||
public List<SellLogData> SellLog
|
||||
{
|
||||
get
|
||||
|
@ -141,7 +154,12 @@ namespace Core.Main.DataObjects
|
|||
|
||||
public double GetCurrentBalance()
|
||||
{
|
||||
return this.GetSnapshotBalance(DateTime.UtcNow);
|
||||
return
|
||||
(this.Summary.Balance +
|
||||
this.Summary.PairsValue +
|
||||
this.Summary.DCAValue +
|
||||
this.Summary.PendingValue +
|
||||
this.Summary.DustValue);
|
||||
}
|
||||
|
||||
public double GetSnapshotBalance(DateTime snapshotDateTime)
|
||||
|
@ -149,14 +167,30 @@ namespace Core.Main.DataObjects
|
|||
double result = _systemConfiguration.GeneralSettings.Application.StartBalance;
|
||||
|
||||
result += this.SellLog.FindAll(sl => sl.SoldDate.Date < snapshotDateTime.Date).Sum(sl => sl.Profit);
|
||||
result += this.TransactionData.Transactions.FindAll(t => t.GetLocalDateTime(_systemConfiguration.GeneralSettings.Application.TimezoneOffset) < snapshotDateTime).Sum(t => t.Amount);
|
||||
result += this.TransactionData.Transactions.FindAll(t => t.UTCDateTime < snapshotDateTime).Sum(t => t.Amount);
|
||||
|
||||
// Calculate holdings for snapshot date
|
||||
result += this.DCALog.FindAll(pairs => pairs.FirstBoughtDate <= snapshotDateTime).Sum(pairs => pairs.CurrentValue);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private void BuildSellLogData(List<sellLogData> rawSellLogData, PTMagicConfiguration systemConfiguration)
|
||||
private SummaryData BuildSummaryData(dynamic PTData)
|
||||
{
|
||||
foreach (sellLogData rsld in rawSellLogData)
|
||||
return new SummaryData()
|
||||
{
|
||||
Market = PTData.market,
|
||||
Balance = PTData.realBalance,
|
||||
PairsValue = PTData.totalPairsCurrentValue,
|
||||
DCAValue = PTData.totalDCACurrentValue,
|
||||
PendingValue = PTData.totalPendingCurrentValue,
|
||||
DustValue = PTData.totalDustCurrentValue
|
||||
};
|
||||
}
|
||||
|
||||
private void BuildSellLogData(dynamic rawSellLogData, PTMagicConfiguration systemConfiguration)
|
||||
{
|
||||
foreach (var rsld in rawSellLogData)
|
||||
{
|
||||
SellLogData sellLogData = new SellLogData();
|
||||
sellLogData.SoldAmount = rsld.soldAmount;
|
||||
|
@ -168,13 +202,13 @@ namespace Core.Main.DataObjects
|
|||
sellLogData.TotalCost = sellLogData.SoldAmount * sellLogData.AverageBuyPrice;
|
||||
|
||||
double soldValueRaw = (sellLogData.SoldAmount * sellLogData.SoldPrice);
|
||||
double soldValueAfterFees = soldValueRaw - (soldValueRaw * (rsld.fee / 100));
|
||||
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);
|
||||
dtDateTime = dtDateTime.AddSeconds(rsld.soldDate).ToUniversalTime();
|
||||
dtDateTime = dtDateTime.AddSeconds((double)rsld.soldDate).ToUniversalTime();
|
||||
|
||||
// Profit Trailer sales are saved in UTC
|
||||
DateTimeOffset ptSoldDate = DateTimeOffset.Parse(dtDateTime.Year.ToString() + "-" + dtDateTime.Month.ToString("00") + "-" + dtDateTime.Day.ToString("00") + "T" + dtDateTime.Hour.ToString("00") + ":" + dtDateTime.Minute.ToString("00") + ":" + dtDateTime.Second.ToString("00"), CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal);
|
||||
|
@ -189,9 +223,9 @@ namespace Core.Main.DataObjects
|
|||
}
|
||||
}
|
||||
|
||||
private void BuildDCALogData(List<dcaLogData> rawDCALogData, List<dcaLogData> rawPairsLogData, PTMagicConfiguration systemConfiguration)
|
||||
private void BuildDCALogData(dynamic rawDCALogData, dynamic rawPairsLogData, PTMagicConfiguration systemConfiguration)
|
||||
{
|
||||
foreach (dcaLogData rdld in rawDCALogData)
|
||||
foreach (var rdld in rawDCALogData)
|
||||
{
|
||||
DCALogData dcaLogData = new DCALogData();
|
||||
dcaLogData.Amount = rdld.totalAmount;
|
||||
|
@ -201,27 +235,25 @@ namespace Core.Main.DataObjects
|
|||
dcaLogData.AverageBuyPrice = rdld.avgPrice;
|
||||
dcaLogData.TotalCost = rdld.totalCost;
|
||||
dcaLogData.BuyTriggerPercent = rdld.buyProfit;
|
||||
dcaLogData.CurrentLowBBValue = rdld.BBLow;
|
||||
dcaLogData.CurrentHighBBValue = rdld.highbb;
|
||||
dcaLogData.BBTrigger = rdld.BBTrigger;
|
||||
dcaLogData.CurrentLowBBValue = rdld.bbLow == null ? 0 : rdld.bbLow;
|
||||
dcaLogData.CurrentHighBBValue = rdld.highBb == null ? 0 : rdld.highBb;
|
||||
dcaLogData.BBTrigger = rdld.bbTrigger == null ? 0 : rdld.bbTrigger;
|
||||
dcaLogData.CurrentPrice = rdld.currentPrice;
|
||||
dcaLogData.SellTrigger = rdld.triggerValue;
|
||||
dcaLogData.SellTrigger = rdld.triggerValue == null ? 0 : rdld.triggerValue;
|
||||
dcaLogData.PercChange = rdld.percChange;
|
||||
dcaLogData.BuyStrategy = rdld.buyStrategy;
|
||||
if (dcaLogData.BuyStrategy == null) dcaLogData.BuyStrategy = "";
|
||||
dcaLogData.SellStrategy = rdld.sellStrategy;
|
||||
if (dcaLogData.SellStrategy == null) dcaLogData.SellStrategy = "";
|
||||
dcaLogData.BuyStrategy = rdld.buyStrategy == null ? "" : rdld.buyStrategy;
|
||||
dcaLogData.SellStrategy = rdld.sellStrategy == null ? "" : rdld.sellStrategy;
|
||||
|
||||
if (rdld.positive != null)
|
||||
{
|
||||
dcaLogData.IsTrailing = rdld.positive.IndexOf("trailing", StringComparison.InvariantCultureIgnoreCase) > -1;
|
||||
dcaLogData.IsTrue = rdld.positive.IndexOf("true", StringComparison.InvariantCultureIgnoreCase) > -1;
|
||||
dcaLogData.IsTrailing = ((string)rdld.positive).IndexOf("trailing", StringComparison.InvariantCultureIgnoreCase) > -1;
|
||||
dcaLogData.IsTrue = ((string)rdld.positive).IndexOf("true", StringComparison.InvariantCultureIgnoreCase) > -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (rdld.buyStrategies != null)
|
||||
{
|
||||
foreach (PTStrategy bs in rdld.buyStrategies)
|
||||
foreach (var bs in rdld.buyStrategies)
|
||||
{
|
||||
Strategy buyStrategy = new Strategy();
|
||||
buyStrategy.Type = bs.type;
|
||||
|
@ -232,8 +264,8 @@ namespace Core.Main.DataObjects
|
|||
buyStrategy.CurrentValue = bs.currentValue;
|
||||
buyStrategy.CurrentValuePercentage = bs.currentValuePercentage;
|
||||
buyStrategy.Decimals = bs.decimals;
|
||||
buyStrategy.IsTrailing = bs.positive.IndexOf("trailing", StringComparison.InvariantCultureIgnoreCase) > -1;
|
||||
buyStrategy.IsTrue = bs.positive.IndexOf("true", StringComparison.InvariantCultureIgnoreCase) > -1;
|
||||
buyStrategy.IsTrailing = ((string)bs.positive).IndexOf("trailing", StringComparison.InvariantCultureIgnoreCase) > -1;
|
||||
buyStrategy.IsTrue = ((string)bs.positive).IndexOf("true", StringComparison.InvariantCultureIgnoreCase) > -1;
|
||||
|
||||
dcaLogData.BuyStrategies.Add(buyStrategy);
|
||||
}
|
||||
|
@ -241,7 +273,7 @@ namespace Core.Main.DataObjects
|
|||
|
||||
if (rdld.sellStrategies != null)
|
||||
{
|
||||
foreach (PTStrategy ss in rdld.sellStrategies)
|
||||
foreach (var ss in rdld.sellStrategies)
|
||||
{
|
||||
Strategy sellStrategy = new Strategy();
|
||||
sellStrategy.Type = ss.type;
|
||||
|
@ -252,17 +284,20 @@ namespace Core.Main.DataObjects
|
|||
sellStrategy.CurrentValue = ss.currentValue;
|
||||
sellStrategy.CurrentValuePercentage = ss.currentValuePercentage;
|
||||
sellStrategy.Decimals = ss.decimals;
|
||||
sellStrategy.IsTrailing = ss.positive.IndexOf("trailing", StringComparison.InvariantCultureIgnoreCase) > -1;
|
||||
sellStrategy.IsTrue = ss.positive.IndexOf("true", StringComparison.InvariantCultureIgnoreCase) > -1;
|
||||
sellStrategy.IsTrailing = ((string)ss.positive).IndexOf("trailing", StringComparison.InvariantCultureIgnoreCase) > -1;
|
||||
sellStrategy.IsTrue = ((string)ss.positive).IndexOf("true", StringComparison.InvariantCultureIgnoreCase) > -1;
|
||||
|
||||
dcaLogData.SellStrategies.Add(sellStrategy);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Calculate current value
|
||||
dcaLogData.CurrentValue = dcaLogData.CurrentPrice * dcaLogData.Amount;
|
||||
|
||||
//Convert Unix Timestamp to Datetime
|
||||
System.DateTime rdldDateTime = new DateTime(1970, 1, 1, 0, 0, 0, System.DateTimeKind.Utc);
|
||||
rdldDateTime = rdldDateTime.AddSeconds(rdld.firstBoughtDate).ToUniversalTime();
|
||||
rdldDateTime = rdldDateTime.AddSeconds((double)rdld.firstBoughtDate).ToUniversalTime();
|
||||
|
||||
// Profit Trailer bought times are saved in UTC
|
||||
if (rdld.firstBoughtDate > 0)
|
||||
|
@ -283,7 +318,7 @@ namespace Core.Main.DataObjects
|
|||
_dcaLog.Add(dcaLogData);
|
||||
}
|
||||
|
||||
foreach (dcaLogData rpld in rawPairsLogData)
|
||||
foreach (var rpld in rawPairsLogData)
|
||||
{
|
||||
DCALogData dcaLogData = new DCALogData();
|
||||
dcaLogData.Amount = rpld.totalAmount;
|
||||
|
@ -294,17 +329,15 @@ namespace Core.Main.DataObjects
|
|||
dcaLogData.TotalCost = rpld.totalCost;
|
||||
dcaLogData.BuyTriggerPercent = rpld.buyProfit;
|
||||
dcaLogData.CurrentPrice = rpld.currentPrice;
|
||||
dcaLogData.SellTrigger = rpld.triggerValue;
|
||||
dcaLogData.SellTrigger = rpld.triggerValue == null ? 0 : rpld.triggerValue;
|
||||
dcaLogData.PercChange = rpld.percChange;
|
||||
dcaLogData.BuyStrategy = rpld.buyStrategy;
|
||||
if (dcaLogData.BuyStrategy == null) dcaLogData.BuyStrategy = "";
|
||||
dcaLogData.SellStrategy = rpld.sellStrategy;
|
||||
if (dcaLogData.SellStrategy == null) dcaLogData.SellStrategy = "";
|
||||
dcaLogData.BuyStrategy = rpld.buyStrategy == null ? "" : rpld.buyStrategy;
|
||||
dcaLogData.SellStrategy = rpld.sellStrategy == null ? "" : rpld.sellStrategy;
|
||||
dcaLogData.IsTrailing = false;
|
||||
|
||||
if (rpld.sellStrategies != null)
|
||||
{
|
||||
foreach (PTStrategy ss in rpld.sellStrategies)
|
||||
foreach (var ss in rpld.sellStrategies)
|
||||
{
|
||||
Strategy sellStrategy = new Strategy();
|
||||
sellStrategy.Type = ss.type;
|
||||
|
@ -315,8 +348,8 @@ namespace Core.Main.DataObjects
|
|||
sellStrategy.CurrentValue = ss.currentValue;
|
||||
sellStrategy.CurrentValuePercentage = ss.currentValuePercentage;
|
||||
sellStrategy.Decimals = ss.decimals;
|
||||
sellStrategy.IsTrailing = ss.positive.IndexOf("trailing", StringComparison.InvariantCultureIgnoreCase) > -1;
|
||||
sellStrategy.IsTrue = ss.positive.IndexOf("true", StringComparison.InvariantCultureIgnoreCase) > -1;
|
||||
sellStrategy.IsTrailing = ((string)ss.positive).IndexOf("trailing", StringComparison.InvariantCultureIgnoreCase) > -1;
|
||||
sellStrategy.IsTrue = ((string)ss.positive).IndexOf("true", StringComparison.InvariantCultureIgnoreCase) > -1;
|
||||
|
||||
dcaLogData.SellStrategies.Add(sellStrategy);
|
||||
}
|
||||
|
@ -324,7 +357,7 @@ namespace Core.Main.DataObjects
|
|||
|
||||
//Convert Unix Timestamp to Datetime
|
||||
System.DateTime rpldDateTime = new DateTime(1970, 1, 1, 0, 0, 0, System.DateTimeKind.Utc);
|
||||
rpldDateTime = rpldDateTime.AddSeconds(rpld.firstBoughtDate).ToUniversalTime();
|
||||
rpldDateTime = rpldDateTime.AddSeconds((double)rpld.firstBoughtDate).ToUniversalTime();
|
||||
|
||||
// Profit Trailer bought times are saved in UTC
|
||||
if (rpld.firstBoughtDate > 0)
|
||||
|
@ -346,34 +379,26 @@ namespace Core.Main.DataObjects
|
|||
}
|
||||
}
|
||||
|
||||
private void BuildBuyLogData(List<buyLogData> rawBuyLogData, PTMagicConfiguration systemConfiguration)
|
||||
private void BuildBuyLogData(dynamic rawBuyLogData)
|
||||
{
|
||||
foreach (buyLogData rbld in rawBuyLogData)
|
||||
foreach (var rbld in rawBuyLogData)
|
||||
{
|
||||
BuyLogData buyLogData = new BuyLogData() {IsTrailing = false, IsTrue = false, IsSom = false, TrueStrategyCount = 0};
|
||||
BuyLogData buyLogData = new BuyLogData() { IsTrailing = false, IsTrue = false, IsSom = false, TrueStrategyCount = 0 };
|
||||
buyLogData.Market = rbld.market;
|
||||
buyLogData.ProfitPercent = rbld.profit;
|
||||
buyLogData.TriggerValue = rbld.triggerValue;
|
||||
buyLogData.CurrentValue = rbld.currentValue;
|
||||
buyLogData.CurrentPrice = rbld.currentPrice;
|
||||
buyLogData.PercChange = rbld.percChange;
|
||||
buyLogData.BuyStrategy = rbld.buyStrategy;
|
||||
buyLogData.CurrentLowBBValue = rbld.BBLow;
|
||||
buyLogData.CurrentHighBBValue = rbld.BBHigh;
|
||||
buyLogData.BBTrigger = rbld.BBTrigger;
|
||||
|
||||
if (buyLogData.BuyStrategy == null) buyLogData.BuyStrategy = "";
|
||||
|
||||
if (rbld.positive != null)
|
||||
{
|
||||
buyLogData.IsTrailing = rbld.positive.IndexOf("trailing", StringComparison.InvariantCultureIgnoreCase) > -1;
|
||||
buyLogData.IsTrue = rbld.positive.IndexOf("true", StringComparison.InvariantCultureIgnoreCase) > -1;
|
||||
buyLogData.IsTrailing = ((string)(rbld.positive)).IndexOf("trailing", StringComparison.InvariantCultureIgnoreCase) > -1;
|
||||
buyLogData.IsTrue = ((string)(rbld.positive)).IndexOf("true", StringComparison.InvariantCultureIgnoreCase) > -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (rbld.buyStrategies != null)
|
||||
{
|
||||
foreach (PTStrategy bs in rbld.buyStrategies)
|
||||
foreach (var bs in rbld.buyStrategies)
|
||||
{
|
||||
Strategy buyStrategy = new Strategy();
|
||||
buyStrategy.Type = bs.type;
|
||||
|
@ -384,8 +409,8 @@ namespace Core.Main.DataObjects
|
|||
buyStrategy.CurrentValue = bs.currentValue;
|
||||
buyStrategy.CurrentValuePercentage = bs.currentValuePercentage;
|
||||
buyStrategy.Decimals = bs.decimals;
|
||||
buyStrategy.IsTrailing = bs.positive.IndexOf("trailing", StringComparison.InvariantCultureIgnoreCase) > -1;
|
||||
buyStrategy.IsTrue = bs.positive.IndexOf("true", StringComparison.InvariantCultureIgnoreCase) > -1;
|
||||
buyStrategy.IsTrailing = ((string)(bs.positive)).IndexOf("trailing", StringComparison.InvariantCultureIgnoreCase) > -1;
|
||||
buyStrategy.IsTrue = ((string)(bs.positive)).IndexOf("true", StringComparison.InvariantCultureIgnoreCase) > -1;
|
||||
|
||||
// Is SOM?
|
||||
buyLogData.IsSom = buyLogData.IsSom || buyStrategy.Name.Equals("som enabled", StringComparison.OrdinalIgnoreCase);
|
||||
|
|
|
@ -27,8 +27,8 @@
|
|||
currentBalanceString = Math.Round(currentBalance, 2).ToString("#,#0.00", new System.Globalization.CultureInfo("en-US"));
|
||||
}
|
||||
}
|
||||
<th class="text-left">Estimated Account Value: <text class="text-autocolor"> @currentBalanceString @Model.Summary.MainMarket </text> <small> <i class="fa fa-info-circle text-muted" data-toggle="tooltip" data-placement="top" title="This is based on your sales history and entries on the Transactions page. It doesn't include any currently held positions."></i></small></th>
|
||||
<th class="text-right">Starting Account Value: <text class="text-autocolor"> @Model.PTMagicConfiguration.GeneralSettings.Application.StartBalance @Model.Summary.MainMarket </text> <small> <i class="fa fa-info-circle text-muted" data-toggle="tooltip" data-placement="top" title="This is the starting vlaue found in your settings file"></i></small></th>
|
||||
<th class="text-left">Estimated Account Value: <text class="text-autocolor"> @currentBalanceString @Model.Summary.MainMarket </text> <small> <i class="fa fa-info-circle text-muted" data-toggle="tooltip" data-placement="top" title="This is based on your sales history, entries on the Transactions page and any currently held positions."></i></small></th>
|
||||
<th class="text-right">Starting Account Value: <text class="text-autocolor"> @Model.PTMagicConfiguration.GeneralSettings.Application.StartBalance @Model.Summary.MainMarket </text> <small> <i class="fa fa-info-circle text-muted" data-toggle="tooltip" data-placement="top" title="This is the starting value found in your settings file"></i></small></th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
|
|
|
@ -23,10 +23,11 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (Core.Main.DataObjects.PTMagicData.BuyLogData buyLogEntry in Model.PTData.BuyLog.OrderByDescending(b => b.IsTrailing).
|
||||
@foreach (Core.Main.DataObjects.PTMagicData.BuyLogData buyLogEntry in Model.PTData.BuyLog.OrderBy(b => b.IsSom).
|
||||
ThenByDescending(b => b.IsTrailing).
|
||||
ThenByDescending(b => b.IsTrue).
|
||||
ThenByDescending(b => b.TrueStrategyCount).
|
||||
ThenBy(b => b.IsSom).
|
||||
|
||||
ThenByDescending(b => b.PercChange).
|
||||
Take(Model.PTMagicConfiguration.GeneralSettings.Monitor.MaxDashboardBuyEntries)) {
|
||||
|
||||
|
|
Loading…
Reference in New Issue