import { assertBacktestFeatureEnabled, assertBacktestMode } from './guards.js'; import { loadHistoricalData } from './data/loadHistoricalData.js'; import { runBacktestReplay } from './engine/BacktestRunner.js'; import type { BacktestRequest, BacktestResult } from './types.js'; export interface RunBacktestOptions { profileSettings?: any; } export const runBacktest = async ( request: BacktestRequest, options: RunBacktestOptions = {} ): Promise => { assertBacktestFeatureEnabled(); assertBacktestMode(request.mode); const historical = await loadHistoricalData(request); return runBacktestReplay({ request, dataset: historical.dataset, replayWindow: historical.window, dataSourceType: historical.source, profileSettings: options.profileSettings }); };