Пример #1
0
        private void BuildTCV()
        {
            double AvailableBalance = PTData.GetCurrentBalance();

            foreach (Core.Main.DataObjects.PTMagicData.DCALogData dcaLogEntry in PTData.DCALog)
            {
                totalCurrentValue = totalCurrentValue + ((dcaLogEntry.Amount * dcaLogEntry.CurrentPrice) / dcaLogEntry.Leverage);
            }
            totalCurrentValue = totalCurrentValue + AvailableBalance;
        }
        private void BuildAssetDistributionData()
        {
            // the per PT-Eelroy, the PT API doesn't provide these values when using leverage, so they are calculated here to cover either case.
            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)
            {
                string sellStrategyText = Core.ProfitTrailer.StrategyHelper.GetStrategyText(Summary, dcaLogEntry.SellStrategies, dcaLogEntry.SellStrategy, isSellStrategyTrue, isTrailingSellActive);

                // Aggregate totals
                if (dcaLogEntry.Leverage == 0)
                {
                    if (sellStrategyText.Contains("PENDING"))
                    {
                        PendingBalance = PendingBalance + (dcaLogEntry.Amount * dcaLogEntry.CurrentPrice);
                    }
                    else if (dcaLogEntry.BuyStrategies.Count > 0)
                    {
                        DCABalance = DCABalance + (dcaLogEntry.Amount * dcaLogEntry.CurrentPrice);
                    }
                    else
                    {
                        PairsBalance = PairsBalance + (dcaLogEntry.Amount * dcaLogEntry.CurrentPrice);
                    }
                }
                else
                {
                    if (sellStrategyText.Contains("PENDING"))
                    {
                        PendingBalance = PendingBalance + ((dcaLogEntry.Amount * dcaLogEntry.CurrentPrice) / dcaLogEntry.Leverage);
                    }
                    else if (dcaLogEntry.BuyStrategies.Count > 0)
                    {
                        DCABalance = DCABalance + ((dcaLogEntry.Amount * dcaLogEntry.CurrentPrice) / dcaLogEntry.Leverage);
                    }
                    else
                    {
                        PairsBalance = PairsBalance + ((dcaLogEntry.Amount * dcaLogEntry.CurrentPrice) / dcaLogEntry.Leverage);
                    }
                }
            }
            totalCurrentValue      = PendingBalance + DCABalance + PairsBalance + AvailableBalance;
            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")) + "'},";
            AssetDistributionData += "{label: 'Pending',color: '#F5B041',value: '" + PendingBalance.ToString("0.00", new System.Globalization.CultureInfo("en-US")) + "'},";
            AssetDistributionData += "{label: 'Balance',color: '#85C1E9',value: '" + AvailableBalance.ToString("0.00", new System.Globalization.CultureInfo("en-US")) + "'}]";
        }