AssetDistribution Futures
This commit is contained in:
parent
21c85c5c56
commit
8516e2557b
|
@ -19,6 +19,8 @@ namespace Monitor.Pages {
|
||||||
public string AssetDistributionData = "";
|
public string AssetDistributionData = "";
|
||||||
public double currentBalance = 0;
|
public double currentBalance = 0;
|
||||||
public string currentBalanceString = "";
|
public string currentBalanceString = "";
|
||||||
|
public double TotalBagCost = 0;
|
||||||
|
public double TotalBagValue = 0;
|
||||||
public void OnGet() {
|
public void OnGet() {
|
||||||
// Initialize Config
|
// Initialize Config
|
||||||
base.Init();
|
base.Init();
|
||||||
|
@ -140,13 +142,41 @@ namespace Monitor.Pages {
|
||||||
}
|
}
|
||||||
private void BuildAssetDistributionData()
|
private void BuildAssetDistributionData()
|
||||||
{
|
{
|
||||||
double PairsBalance = PTData.GetPairsBalance();
|
double PairsBalance = 0.0;
|
||||||
double DCABalance = PTData.GetDCABalance();
|
double DCABalance = 0.0;
|
||||||
double PendingBalance = PTData.GetPendingBalance();
|
double PendingBalance = 0.0;
|
||||||
double DustBalance = PTData.GetDustBalance();
|
double AvailableBalance = PTData.GetCurrentBalance();
|
||||||
double TotalValue = PTData.GetCurrentBalance();
|
bool isSellStrategyTrue =false;
|
||||||
double AvailableBalance = (TotalValue - PairsBalance - DCABalance - PendingBalance - DustBalance);
|
bool isTrailingSellActive =false;
|
||||||
|
|
||||||
|
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 (sellStrategyText.Contains("PENDING"))
|
||||||
|
{
|
||||||
|
PendingBalance = PendingBalance + (dcaLogEntry.Amount * dcaLogEntry.CurrentPrice);
|
||||||
|
}
|
||||||
|
else if (dcaEnabled)
|
||||||
|
{
|
||||||
|
DCABalance = DCABalance + (dcaLogEntry.Amount * dcaLogEntry.CurrentPrice);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
PairsBalance = PairsBalance + (dcaLogEntry.Amount * dcaLogEntry.CurrentPrice);
|
||||||
|
}
|
||||||
|
}
|
||||||
AssetDistributionData = "[";
|
AssetDistributionData = "[";
|
||||||
AssetDistributionData += "{label: 'Pairs',color: '#82E0AA',value: '" + PairsBalance.ToString("0.00", new System.Globalization.CultureInfo("en-US")) + "'},";
|
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: 'DCA',color: '#D98880',value: '" + DCABalance.ToString("0.00", new System.Globalization.CultureInfo("en-US")) + "'},";
|
||||||
|
|
Loading…
Reference in New Issue