AssetDistribution Futures
This commit is contained in:
parent
21c85c5c56
commit
8516e2557b
|
@ -19,6 +19,8 @@ namespace Monitor.Pages {
|
|||
public string AssetDistributionData = "";
|
||||
public double currentBalance = 0;
|
||||
public string currentBalanceString = "";
|
||||
public double TotalBagCost = 0;
|
||||
public double TotalBagValue = 0;
|
||||
public void OnGet() {
|
||||
// Initialize Config
|
||||
base.Init();
|
||||
|
@ -140,13 +142,41 @@ namespace Monitor.Pages {
|
|||
}
|
||||
private void BuildAssetDistributionData()
|
||||
{
|
||||
double PairsBalance = PTData.GetPairsBalance();
|
||||
double DCABalance = PTData.GetDCABalance();
|
||||
double PendingBalance = PTData.GetPendingBalance();
|
||||
double DustBalance = PTData.GetDustBalance();
|
||||
double TotalValue = PTData.GetCurrentBalance();
|
||||
double AvailableBalance = (TotalValue - PairsBalance - DCABalance - PendingBalance - DustBalance);
|
||||
double PairsBalance = 0.0;
|
||||
double DCABalance = 0.0;
|
||||
double PendingBalance = 0.0;
|
||||
double AvailableBalance = PTData.GetCurrentBalance();
|
||||
bool isSellStrategyTrue =false;
|
||||
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 += "{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")) + "'},";
|
||||
|
|
Loading…
Reference in New Issue