feat: add quant engine WBS verification harness
This commit is contained in:
@@ -5,7 +5,9 @@ using Hangfire.PostgreSql;
|
||||
using Hangfire.MemoryStorage;
|
||||
using System.Linq.Expressions;
|
||||
using QuantEngine.Application.Services;
|
||||
using QuantEngine.Application.Interfaces;
|
||||
using QuantEngine.Infrastructure.Data;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
|
||||
namespace QuantEngine.Web.Services;
|
||||
|
||||
@@ -17,15 +19,21 @@ public class SchedulerService
|
||||
private readonly ILogger<SchedulerService> _logger;
|
||||
private readonly IBackgroundJobClient _jobClient;
|
||||
private readonly IRecurringJobManager _recurringJobManager;
|
||||
private readonly IServiceScopeFactory _scopeFactory;
|
||||
private readonly IConfiguration _configuration;
|
||||
|
||||
public SchedulerService(
|
||||
ILogger<SchedulerService> logger,
|
||||
IBackgroundJobClient jobClient,
|
||||
IRecurringJobManager recurringJobManager)
|
||||
IRecurringJobManager recurringJobManager,
|
||||
IServiceScopeFactory scopeFactory,
|
||||
IConfiguration configuration)
|
||||
{
|
||||
_logger = logger;
|
||||
_jobClient = jobClient;
|
||||
_recurringJobManager = recurringJobManager;
|
||||
_scopeFactory = scopeFactory;
|
||||
_configuration = configuration;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -89,14 +97,22 @@ public class SchedulerService
|
||||
// List of tickers to collect
|
||||
var tickers = new[] { "005930", "000660", "051910", "005380", "010140", "005490" };
|
||||
|
||||
foreach (var ticker in tickers)
|
||||
{
|
||||
// Simulate data collection
|
||||
await Task.Delay(100);
|
||||
_logger.LogInformation("Collected data for ticker: {Ticker}", ticker);
|
||||
}
|
||||
// Create scope for scoped services
|
||||
using var scope = _scopeFactory.CreateScope();
|
||||
var orchestrator = scope.ServiceProvider.GetRequiredService<ICollectionOrchestrator>();
|
||||
|
||||
_logger.LogInformation("Daily data collection completed at {Time}", DateTime.Now);
|
||||
// Build runId with timestamp
|
||||
var runId = $"daily-{DateTime.Now:yyyyMMdd-HHmmss}";
|
||||
|
||||
// Read account mode from configuration (default to "mock")
|
||||
var accountMode = _configuration["Kis:AccountMode"] ?? "mock";
|
||||
|
||||
// Execute collection
|
||||
var result = await orchestrator.RunCollectionAsync(runId, accountMode, tickers.ToList());
|
||||
|
||||
// Log completion
|
||||
_logger.LogInformation("Collection run {RunId} completed: {Snapshots} snapshots, {Errors} errors",
|
||||
runId, result.SuccessCount, result.ErrorCount);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user