refactor(api): compose research services with narrow collaborators (CL28)

This commit is contained in:
Boki 2026-10-28 14:45:11 -04:00
parent 3a63b2039e
commit 24487d35da
28 changed files with 281 additions and 94 deletions

View file

@ -12,11 +12,10 @@ import { PostgresBacktestRunRepository } from '../../apps/stock/orchestrator/src
import { RustBacktestAdapter } from '../../apps/stock/orchestrator/src/backtest/RustBacktestAdapter';
import { createExperimentRoutes } from '../../apps/stock/web-api/src/routes/experiments.routes';
import { BacktestServiceV2 } from '../../apps/stock/web-api/src/services/backtest-v2.service';
import { ChronologicalValidationService } from '../../apps/stock/web-api/src/services/chronological-validation.service';
import { ExperimentError } from '../../apps/stock/web-api/src/services/experiment-input';
import { ExperimentsService } from '../../apps/stock/web-api/src/services/experiments.service';
import { createResearchServices } from '../../apps/stock/web-api/src/services/research-services';
import { StrategyCatalogService } from '../../apps/stock/web-api/src/services/strategy-catalog.service';
import { WalkForwardService } from '../../apps/stock/web-api/src/services/walk-forward.service';
import { retainResearchDataset } from '../../scripts/import-research-dataset';
import { packageBuiltinStrategies } from '../../scripts/package-builtin-strategies';
import { canonicalSettings } from '../fixtures/canonical-research';
@ -158,7 +157,8 @@ async function fixture(poolMax = 1, withWalkForward = true) {
}
return rows;
};
const validations = new ChronologicalValidationService(container);
const services = createResearchServices(container);
const validations = services.validations;
const repository = new PostgresBacktestRunRepository(postgres);
const execute = async (id: string) => {
const engine = new RustBacktestAdapter({
@ -192,7 +192,7 @@ async function fixture(poolMax = 1, withWalkForward = true) {
{ autoStart: false }
),
validations,
walks: new WalkForwardService(container),
walks: services.walkForwards,
repository,
execute,
api,