Add volume history to platform summary
This commit is contained in:
@@ -229,6 +229,20 @@ public class PlatformSummaryGrain : Grain, IPlatformSummaryGrain, IRemindable
|
||||
return Task.FromResult(_state.State.TotalPositionCount);
|
||||
}
|
||||
|
||||
public Task<List<VolumeHistoryPoint>> GetVolumeHistoryAsync()
|
||||
{
|
||||
var historyPoints = _state.State.DailySnapshots
|
||||
.OrderBy(s => s.Date)
|
||||
.Select(s => new VolumeHistoryPoint
|
||||
{
|
||||
Date = s.Date,
|
||||
Volume = s.TotalVolume
|
||||
})
|
||||
.ToList();
|
||||
|
||||
return Task.FromResult(historyPoints);
|
||||
}
|
||||
|
||||
// Event handlers for immediate updates
|
||||
public async Task UpdateActiveStrategyCountAsync(int newActiveCount)
|
||||
{
|
||||
@@ -374,6 +388,16 @@ public class PlatformSummaryGrain : Grain, IPlatformSummaryGrain, IRemindable
|
||||
|
||||
private PlatformSummaryViewModel MapToViewModel(PlatformSummaryGrainState state)
|
||||
{
|
||||
// Generate volume history from daily snapshots
|
||||
var volumeHistory = state.DailySnapshots
|
||||
.OrderBy(s => s.Date)
|
||||
.Select(s => new VolumeHistoryPoint
|
||||
{
|
||||
Date = s.Date,
|
||||
Volume = s.TotalVolume
|
||||
})
|
||||
.ToList();
|
||||
|
||||
return new PlatformSummaryViewModel
|
||||
{
|
||||
TotalAgents = state.TotalAgents,
|
||||
@@ -397,6 +421,9 @@ public class PlatformSummaryGrain : Grain, IPlatformSummaryGrain, IRemindable
|
||||
PositionCountByAsset = state.PositionCountByAsset ?? new Dictionary<Ticker, int>(),
|
||||
PositionCountByDirection = state.PositionCountByDirection ?? new Dictionary<TradeDirection, int>(),
|
||||
|
||||
// Volume history for charting (last 30 days)
|
||||
VolumeHistory = volumeHistory,
|
||||
|
||||
// Metadata
|
||||
LastUpdated = state.LastUpdated,
|
||||
Last24HourSnapshot = state.LastSnapshot
|
||||
|
||||
Reference in New Issue
Block a user