Fix ROI calculation for Strategy

This commit is contained in:
2025-10-08 19:37:24 +07:00
parent 76b087a6e4
commit 1a99224d18
5 changed files with 41 additions and 36 deletions

View File

@@ -182,8 +182,8 @@ public class AgentGrain : Grain, IAgentGrain
_state.State.TotalFees = totalFees;
// Calculate wins/losses from position PnL
var totalWins = positions.Count(p => (p.ProfitAndLoss?.Realized ?? 0) > 0);
var totalLosses = positions.Count(p => (p.ProfitAndLoss?.Realized ?? 0) <= 0);
var totalWins = positions.Count(p => (p.ProfitAndLoss?.Net ?? 0) > 0);
var totalLosses = positions.Count(p => (p.ProfitAndLoss?.Net ?? 0) <= 0);
// Calculate ROI based on PnL minus fees
var netPnL = totalPnL - totalFees;