Fix status and filtered positions for metrics
This commit is contained in:
@@ -169,7 +169,8 @@ public class AgentGrain : Grain, IAgentGrain
|
||||
try
|
||||
{
|
||||
// Get all positions for this agent's bots as initiator
|
||||
var positions = (await _tradingService.GetPositionByUserIdAsync((int)this.GetPrimaryKeyLong())).ToList();
|
||||
var positions = (await _tradingService.GetPositionByUserIdAsync((int)this.GetPrimaryKeyLong()))
|
||||
.Where(p => p.IsValidForMetrics()).ToList();
|
||||
|
||||
// Calculate aggregated statistics from position data
|
||||
var totalPnL = positions.Sum(p => p.ProfitAndLoss?.Realized ?? 0);
|
||||
|
||||
Reference in New Issue
Block a user