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
|
|
@ -9,21 +9,14 @@ import type { BacktestConfig } from '../types';
|
|||
import type { NativeBacktestResult } from './native-result';
|
||||
import type { BacktestResult } from './typescript-result';
|
||||
|
||||
/** The runner depends on execution capabilities, not backend implementations. */
|
||||
/** Capabilities required by the canonical durable runner. No provider loading or playback. */
|
||||
export interface BacktestExecutionEngine extends Pick<EventEmitter, 'on' | 'off'> {
|
||||
runBacktest(
|
||||
config: BacktestConfig,
|
||||
dataset?: DatasetResolver
|
||||
): Promise<BacktestResult | NativeBacktestResult>;
|
||||
runCanonical?(
|
||||
runCanonical(
|
||||
request: CanonicalRunRequest,
|
||||
resolveDataset: (signal: AbortSignal) => Promise<HistoricalDatasetV2>,
|
||||
controls?: { executionDeadlineAt?: number }
|
||||
): Promise<Pick<CanonicalRunResult, 'financial' | 'analytics'>>;
|
||||
stopBacktest(): Promise<void>;
|
||||
pauseBacktest(): Promise<void>;
|
||||
resumeBacktest(): Promise<void>;
|
||||
setSpeedMultiplier(speed: number | null): void;
|
||||
getStatus(): {
|
||||
isRunning: boolean;
|
||||
isPaused: boolean;
|
||||
|
|
@ -33,6 +26,18 @@ export interface BacktestExecutionEngine extends Pick<EventEmitter, 'on' | 'off'
|
|||
shutdown(): Promise<void>;
|
||||
}
|
||||
|
||||
/** Retained algorithm/playback examples only; cannot satisfy the durable runner contract. */
|
||||
export interface LegacyBacktestExecutionEngine
|
||||
extends Pick<BacktestExecutionEngine, 'on' | 'off' | 'stopBacktest' | 'getStatus' | 'shutdown'> {
|
||||
runBacktest(
|
||||
config: BacktestConfig,
|
||||
dataset?: DatasetResolver
|
||||
): Promise<BacktestResult | NativeBacktestResult>;
|
||||
pauseBacktest(): Promise<void>;
|
||||
resumeBacktest(): Promise<void>;
|
||||
setSpeedMultiplier(speed: number | null): void;
|
||||
}
|
||||
|
||||
/** Cancellation has no result when a native worker is forcibly stopped. */
|
||||
export class BacktestCancelledError extends Error {
|
||||
constructor() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue