update stats data

This commit is contained in:
2025-08-15 07:42:26 +07:00
parent 0a4a4e1398
commit 7528405845
8 changed files with 413 additions and 450 deletions

View File

@@ -40,8 +40,10 @@ public interface IPlatformSummaryGrain : IGrainWithStringKey
Task<int> GetTotalPositionCountAsync();
// Event handlers for immediate updates
Task OnStrategyDeployedAsync(StrategyDeployedEvent evt);
Task OnStrategyStoppedAsync(StrategyStoppedEvent evt);
/// <summary>
/// Updates the active strategy count
/// </summary>
Task UpdateActiveStrategyCountAsync(int newActiveCount);
Task OnPositionOpenedAsync(PositionOpenedEvent evt);
Task OnPositionClosedAsync(PositionClosedEvent evt);
Task OnTradeExecutedAsync(TradeExecutedEvent evt);
@@ -57,37 +59,7 @@ public abstract class PlatformMetricsEvent
public DateTime Timestamp { get; set; } = DateTime.UtcNow;
}
/// <summary>
/// Event fired when a new strategy is deployed
/// </summary>
[GenerateSerializer]
public class StrategyDeployedEvent : PlatformMetricsEvent
{
[Id(1)]
public Guid StrategyId { get; set; }
[Id(2)]
public string AgentName { get; set; } = string.Empty;
[Id(3)]
public string StrategyName { get; set; } = string.Empty;
}
/// <summary>
/// Event fired when a strategy is stopped
/// </summary>
[GenerateSerializer]
public class StrategyStoppedEvent : PlatformMetricsEvent
{
[Id(1)]
public Guid StrategyId { get; set; }
[Id(2)]
public string AgentName { get; set; } = string.Empty;
[Id(3)]
public string StrategyName { get; set; } = string.Empty;
}
/// <summary>
/// Event fired when a new position is opened