Fix json serialization + preloaded candle
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -30,5 +30,7 @@
|
||||
"Sentry": {
|
||||
"Dsn": "https://698e00d7cb404b049aff3881e5a47f6b@bugcenter.apps.managing.live/1"
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
"AllowedHosts": "*",
|
||||
"WorkerBotManager": true,
|
||||
"WorkerBalancesTracking": true
|
||||
}
|
||||
@@ -25,5 +25,6 @@
|
||||
"Uri": "http://elasticsearch:9200"
|
||||
},
|
||||
"AllowedHosts": "*",
|
||||
"EnableBotManager": true
|
||||
"WorkerBotManager": true,
|
||||
"WorkerBalancesTracking": false
|
||||
}
|
||||
Reference in New Issue
Block a user