refactor(orchestrator): require canonical research contracts (CL14)
This commit is contained in:
parent
bc2b8a89da
commit
21666242f4
37 changed files with 151 additions and 319 deletions
36
test/contracts/canonical-runner.type-test.ts
Normal file
36
test/contracts/canonical-runner.type-test.ts
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
import { BacktestRunner } from '../../apps/stock/orchestrator/src/backtest/BacktestRunner';
|
||||
import type {
|
||||
BacktestExecutionEngine,
|
||||
LegacyBacktestExecutionEngine,
|
||||
} from '../../apps/stock/orchestrator/src/backtest/execution-engine';
|
||||
import type { BacktestRunRepository } from '../../apps/stock/orchestrator/src/backtest/run-repository';
|
||||
import { RustBacktestAdapter } from '../../apps/stock/orchestrator/src/backtest/RustBacktestAdapter';
|
||||
|
||||
function canonicalDependencies(
|
||||
engine: BacktestExecutionEngine,
|
||||
legacy: LegacyBacktestExecutionEngine,
|
||||
repository: BacktestRunRepository,
|
||||
withoutReplay: Omit<BacktestExecutionEngine, 'runCanonical'>,
|
||||
withoutClaim: Omit<BacktestRunRepository, 'startCanonical'>,
|
||||
withoutDataset: Omit<BacktestRunRepository, 'loadCanonicalDataset'>,
|
||||
withoutCompletion: Omit<BacktestRunRepository, 'completeCanonical'>
|
||||
) {
|
||||
const logger = { error() {} };
|
||||
new BacktestRunner({ engine, repository, logger });
|
||||
// @ts-expect-error Canonical replay is mandatory; a legacy playback engine is insufficient.
|
||||
new BacktestRunner({ engine: legacy, repository, logger });
|
||||
// @ts-expect-error The current runner cannot be composed without canonical execution.
|
||||
new BacktestRunner({ engine: withoutReplay, repository, logger });
|
||||
// @ts-expect-error Canonical claim custody is mandatory.
|
||||
new BacktestRunner({ engine, repository: withoutClaim, logger });
|
||||
// @ts-expect-error Retained canonical dataset loading is mandatory.
|
||||
new BacktestRunner({ engine, repository: withoutDataset, logger });
|
||||
// @ts-expect-error Canonical completion persistence is mandatory.
|
||||
new BacktestRunner({ engine, repository: withoutCompletion, logger });
|
||||
// @ts-expect-error Current execution does not accept provider storage dependencies.
|
||||
new RustBacktestAdapter({ logger, storage: { getHistoricalBars: async () => [] } });
|
||||
// @ts-expect-error The canonical runner cannot select a competing engine by name.
|
||||
new BacktestRunner({ engine, repository, logger, engineName: 'typescript' });
|
||||
}
|
||||
|
||||
void canonicalDependencies;
|
||||
Loading…
Add table
Add a link
Reference in a new issue