Get TotalAgentCount

This commit is contained in:
2025-09-28 14:43:15 +07:00
parent 147186724e
commit c71716d5c2
5 changed files with 23 additions and 3 deletions

View File

@@ -99,11 +99,9 @@ public class PlatformSummaryGrain : Grain, IPlatformSummaryGrain, IRemindable
{
_logger.LogInformation("Refreshing platform summary data");
var agents = await _agentService.GetAllAgentSummaries();
var strategies = await _botService.GetBotsAsync();
// Calculate totals
var totalAgents = agents.Count();
var totalActiveStrategies = strategies.Count(s => s.Status == BotStatus.Running);
// Calculate volume from strategies
@@ -116,7 +114,6 @@ public class PlatformSummaryGrain : Grain, IPlatformSummaryGrain, IRemindable
var (totalOpenInterest, totalPositionCount) = await CalculatePositionMetricsAsync();
// Update state
_state.State.TotalAgents = totalAgents;
_state.State.TotalActiveStrategies = totalActiveStrategies;
// Only update volume if it hasn't been updated by events recently
@@ -131,6 +128,7 @@ public class PlatformSummaryGrain : Grain, IPlatformSummaryGrain, IRemindable
_logger.LogDebug("Preserving event-updated volume: {Volume}", _state.State.TotalPlatformVolume);
}
_state.State.TotalAgents = await _agentService.GetTotalAgentCount();
_state.State.TotalPlatformPnL = totalPnL;
_state.State.OpenInterest = totalOpenInterest;
_state.State.TotalLifetimePositionCount = totalPositionCount;