stock-bot/apps/stock/orchestrator/src/backtest/native-strategies.ts

12 lines
526 B
TypeScript

import type { BacktestConfig } from '../types';
import { backtestStrategies } from './strategy-plan';
/** Resolve and validate before fetching data, and validate again in the isolated worker. */
export function resolveNativeStrategies(config: BacktestConfig) {
return backtestStrategies(config, 'native').map(({ name, kind, parameters, index }) => {
if (!kind) {
throw new Error('Unknown native strategy: ' + name);
}
return { strategy: kind, name, id: 'backtest-strategy-' + index, parameters };
});
}