Fix Wallet balances

This commit is contained in:
2025-07-17 22:29:13 +07:00
parent 0ea05bca50
commit 03a4e179f7
2 changed files with 3 additions and 2 deletions

View File

@@ -296,7 +296,8 @@ namespace Managing.Application.Backtesting
var optimizedMoneyManagement =
TradingBox.GetBestMoneyManagement(candles, bot.Positions, config.MoneyManagement);
var stats = TradingHelpers.GetStatistics(bot.WalletBalances);
var growthPercentage = TradingHelpers.GetGrowthFromInitalBalance(config.BotTradingBalance, finalPnl);
var growthPercentage =
TradingHelpers.GetGrowthFromInitalBalance(bot.WalletBalances.FirstOrDefault().Value, finalPnl);
var hodlPercentage = TradingHelpers.GetHodlPercentage(candles[0], candles.Last());
var fees = bot.GetTotalFees();

View File

@@ -1313,7 +1313,7 @@ public class TradingBot : Bot, ITradingBot
public decimal GetProfitAndLoss()
{
var pnl = Positions.Where(p => p.ProfitAndLoss != null).Sum(p => p.ProfitAndLoss.Realized);
var pnl = Positions.Where(p => p.ProfitAndLoss != null && p.IsFinished()).Sum(p => p.ProfitAndLoss.Realized);
return pnl - GetTotalFees();
}