Update plateform summary
This commit is contained in:
@@ -459,19 +459,11 @@ public class DataController : ControllerBase
|
||||
/// <summary>
|
||||
/// Retrieves a summary of platform activity across all agents (platform-level data only)
|
||||
/// </summary>
|
||||
/// <param name="timeFilter">Time filter to apply (24H, 3D, 1W, 1M, 1Y, Total)</param>
|
||||
/// <returns>A summary of platform activity without individual agent details</returns>
|
||||
[HttpGet("GetPlatformSummary")]
|
||||
public async Task<ActionResult<PlatformSummaryViewModel>> GetPlatformSummary(string timeFilter = "Total")
|
||||
public async Task<ActionResult<PlatformSummaryViewModel>> GetPlatformSummary()
|
||||
{
|
||||
// Validate time filter
|
||||
var validTimeFilters = new[] { "24H", "3D", "1W", "1M", "1Y", "Total" };
|
||||
if (!validTimeFilters.Contains(timeFilter))
|
||||
{
|
||||
timeFilter = "Total"; // Default to Total if invalid
|
||||
}
|
||||
|
||||
string cacheKey = $"PlatformSummary_{timeFilter}";
|
||||
const string cacheKey = "PlatformSummary";
|
||||
|
||||
// Check if the platform summary is already cached
|
||||
var cachedSummary = _cacheService.GetValue<PlatformSummaryViewModel>(cacheKey);
|
||||
@@ -481,15 +473,14 @@ public class DataController : ControllerBase
|
||||
return Ok(cachedSummary);
|
||||
}
|
||||
|
||||
// Get all agents and their strategies
|
||||
var agentsWithStrategies = await _mediator.Send(new GetAllAgentsCommand(timeFilter));
|
||||
// Get all agents and their strategies (without time filter)
|
||||
var agentsWithStrategies = await _mediator.Send(new GetAllAgentsCommand());
|
||||
|
||||
// Create the platform summary
|
||||
var summary = new PlatformSummaryViewModel
|
||||
{
|
||||
TotalAgents = agentsWithStrategies.Count,
|
||||
TotalActiveStrategies = agentsWithStrategies.Values.Sum(list => list.Count),
|
||||
TimeFilter = timeFilter
|
||||
TotalActiveStrategies = agentsWithStrategies.Values.Sum(list => list.Count)
|
||||
};
|
||||
|
||||
// Calculate total platform metrics
|
||||
|
||||
@@ -71,11 +71,6 @@ namespace Managing.Api.Models.Responses
|
||||
/// Total volume traded across all agents in the last 24 hours in USD
|
||||
/// </summary>
|
||||
public decimal TotalPlatformVolumeLast24h { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Time filter applied to the data
|
||||
/// </summary>
|
||||
public string TimeFilter { get; set; } = "Total";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user