Fix json serialization + preloaded candle

This commit is contained in:
2025-05-23 18:11:34 +07:00
parent 2ee1322ba0
commit 564a23ddec
6 changed files with 20 additions and 21 deletions

View File

@@ -568,26 +568,12 @@ public class DataController : ControllerBase
/// <param name="endDate">Optional end date for the balance history (defaults to current time)</param>
/// <returns>A list of agent balances within the specified date range</returns>
[HttpGet("GetAgentBalances")]
public async Task<ActionResult<IList<AgentBalance>>> GetAgentBalances(
public async Task<ActionResult<AgentBalanceHistory>> GetAgentBalances(
string agentName,
DateTime startDate,
DateTime? endDate = null)
{
string cacheKey = $"AgentBalances_{agentName}_{startDate:yyyyMMdd}_{endDate?.ToString("yyyyMMdd") ?? "now"}";
// Check if the balances are already cached
var cachedBalances = _cacheService.GetValue<IList<AgentBalance>>(cacheKey);
if (cachedBalances != null)
{
return Ok(cachedBalances);
}
var balances = await _statisticService.GetAgentBalances(agentName, startDate, endDate);
// Cache the results for 5 minutes
_cacheService.SaveValue(cacheKey, balances, TimeSpan.FromMinutes(5));
return Ok(balances);
}

View File

@@ -30,5 +30,7 @@
"Sentry": {
"Dsn": "https://698e00d7cb404b049aff3881e5a47f6b@bugcenter.apps.managing.live/1"
},
"AllowedHosts": "*"
"AllowedHosts": "*",
"WorkerBotManager": true,
"WorkerBalancesTracking": true
}

View File

@@ -25,5 +25,6 @@
"Uri": "http://elasticsearch:9200"
},
"AllowedHosts": "*",
"EnableBotManager": true
"WorkerBotManager": true,
"WorkerBalancesTracking": false
}