Fix backtest count
This commit is contained in:
@@ -397,6 +397,51 @@ namespace Managing.Application.Backtests
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Saves a bundle backtest request without creating jobs.
|
||||
/// Use this when you want to return immediately and create jobs in a background task.
|
||||
/// </summary>
|
||||
public async Task SaveBundleBacktestRequestAsync(User user, BundleBacktestRequest bundleRequest)
|
||||
{
|
||||
await _backtestRepository.InsertBundleBacktestRequestForUserAsync(user, bundleRequest);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates jobs for an existing bundle request asynchronously.
|
||||
/// This method is intended to be called from a background task after the bundle request has been saved.
|
||||
/// </summary>
|
||||
public async Task CreateJobsForBundleRequestAsync(BundleBacktestRequest bundleRequest)
|
||||
{
|
||||
try
|
||||
{
|
||||
// Generate backtest requests from variants
|
||||
var backtestRequests = await GenerateBacktestRequestsFromVariants(bundleRequest);
|
||||
|
||||
if (backtestRequests != null && backtestRequests.Any())
|
||||
{
|
||||
// Create jobs for all variants
|
||||
await _jobService.CreateBundleJobsAsync(bundleRequest, backtestRequests);
|
||||
|
||||
_logger.LogInformation(
|
||||
"Created {JobCount} backtest jobs for bundle request {BundleRequestId}",
|
||||
backtestRequests.Count, bundleRequest.RequestId);
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.LogWarning(
|
||||
"No backtest requests generated for bundle request {BundleRequestId}",
|
||||
bundleRequest.RequestId);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex,
|
||||
"Error creating jobs for bundle request {BundleRequestId}",
|
||||
bundleRequest.RequestId);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generates individual backtest requests from variant configuration
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user