Fix dailySnapshot for platformsummary

This commit is contained in:
2025-09-24 12:21:56 +07:00
parent 44846a1817
commit d2a4bd4426
11 changed files with 241 additions and 397 deletions

View File

@@ -1,4 +1,3 @@
using Managing.Application.Abstractions.Models;
using Managing.Common;
namespace Managing.Api.Models.Responses
@@ -55,6 +54,22 @@ namespace Managing.Api.Models.Responses
/// </summary>
public class PlatformSummaryViewModel
{
/// <summary>
/// When the data was last updated
/// </summary>
public required DateTime LastUpdated { get; set; }
/// <summary>
/// When the last 24-hour snapshot was taken
/// </summary>
public required DateTime LastSnapshot { get; set; }
/// <summary>
/// Whether there are pending changes to be saved
/// </summary>
public required bool HasPendingChanges { get; set; }
// Current metrics
/// <summary>
/// Total number of agents on the platform
/// </summary>
@@ -75,58 +90,34 @@ namespace Managing.Api.Models.Responses
/// </summary>
public required decimal TotalPlatformVolume { get; set; }
/// <summary>
/// Total volume traded across all agents in the last 24 hours in USD
/// </summary>
public required decimal TotalPlatformVolumeLast24h { get; set; }
/// <summary>
/// Total open interest across all positions in USD
/// </summary>
public required decimal TotalOpenInterest { get; set; }
public required decimal OpenInterest { get; set; }
/// <summary>
/// Total number of open positions across all strategies
/// </summary>
public required int TotalPositionCount { get; set; }
// 24-hour changes
/// <summary>
/// Change in agent count over the last 24 hours
/// Total platform-wide fees paid in USD
/// </summary>
public required int AgentsChange24h { get; set; }
public required decimal TotalPlatformFees { get; set; }
// Historical snapshots
/// <summary>
/// Change in strategy count over the last 24 hours
/// Daily snapshots for the last 60 days
/// </summary>
public required int StrategiesChange24h { get; set; }
public required List<DailySnapshot> DailySnapshots { get; set; }
/// <summary>
/// Change in PnL over the last 24 hours
/// </summary>
public required decimal PnLChange24h { get; set; }
/// <summary>
/// Change in volume over the last 24 hours
/// </summary>
public required decimal VolumeChange24h { get; set; }
/// <summary>
/// Change in open interest over the last 24 hours
/// </summary>
public required decimal OpenInterestChange24h { get; set; }
/// <summary>
/// Change in position count over the last 24 hours
/// </summary>
public required int PositionCountChange24h { get; set; }
// Breakdowns
// Volume breakdown by asset
/// <summary>
/// Volume breakdown by asset/ticker
/// </summary>
public required Dictionary<Enums.Ticker, decimal> VolumeByAsset { get; set; }
// Position count breakdown
/// <summary>
/// Position count breakdown by asset/ticker
/// </summary>
@@ -136,18 +127,47 @@ namespace Managing.Api.Models.Responses
/// Position count breakdown by direction (Long/Short)
/// </summary>
public required Dictionary<Enums.TradeDirection, int> PositionCountByDirection { get; set; }
}
// Metadata
/// <summary>
/// Daily snapshot of platform metrics
/// </summary>
public class DailySnapshot
{
/// <summary>
/// When the data was last updated
/// Date of the snapshot
/// </summary>
public required DateTime LastUpdated { get; set; }
public required DateTime Date { get; set; }
/// <summary>
/// When the last 24-hour snapshot was taken
/// Total number of agents on this date
/// </summary>
public required DateTime Last24HourSnapshot { get; set; }
public List<VolumeHistoryPoint> VolumeHistory { get; internal set; }
public required int TotalAgents { get; set; }
/// <summary>
/// Total number of active strategies on this date
/// </summary>
public required int TotalStrategies { get; set; }
/// <summary>
/// Total volume traded on this date in USD
/// </summary>
public required decimal TotalVolume { get; set; }
/// <summary>
/// Total PnL on this date in USD
/// </summary>
public required decimal TotalPnL { get; set; }
/// <summary>
/// Total open interest on this date in USD
/// </summary>
public required decimal TotalOpenInterest { get; set; }
/// <summary>
/// Total number of positions on this date
/// </summary>
public required int TotalPositionCount { get; set; }
}
/// <summary>