import type { BacktestRunner } from '../src/backtest/BacktestRunner'; import { BacktestConfigSchema, type BacktestConfig } from '../src/types'; /** * Call with the application's already-composed TypeScript runner and real historical range. * Importing this example starts no services, loads no model and submits no work. * The caller owns runner/service shutdown; the ordinary runner persists the actual result. */ export function runMultiStrategyBacktest( runner: Pick, range: Pick ) { const request = BacktestConfigSchema.parse({ symbols: range.symbols, startDate: range.startDate, endDate: range.endDate, mode: 'backtest', name: 'SMA and mean-reversion example', strategy: 'sma-crossover', initialCapital: 100000, dataFrequency: '1d', commission: 0.001, slippage: 0.0001, strategies: [ { name: 'sma-crossover', enabled: true, config: { fastPeriod: 5, slowPeriod: 15, positionFraction: 0.1 }, }, { name: 'mean-reversion', enabled: true, config: { lookbackPeriod: 20, entryThreshold: 2, exitZScore: 0.5 }, }, ], }); return runner.runBacktest(request); }