feat(research): run retained strategies through durable canonical engine

This commit is contained in:
Boki 2026-10-23 21:59:09 -04:00
parent d929db707a
commit 618fb9e33c
58 changed files with 6596 additions and 779 deletions

View file

@ -290,6 +290,7 @@ export async function fixture(browser: Browser, native = false) {
'16-strategy-catalog.sql',
'17-research-retention.sql',
'18-backtest-strategy-versions.sql',
'19-canonical-research.sql',
]) {
await pool.query(
readFileSync(new URL(`../../database/postgres/init/${name}`, import.meta.url), 'utf8')
@ -331,8 +332,15 @@ export async function fixture(browser: Browser, native = false) {
maxAttempts: 3,
});
const controlled = new FixtureEngine();
const historicalDataReads: string[] = [];
const runStorage: Pick<StorageService, 'getHistoricalBars'> = {
async getHistoricalBars(...args) {
historicalDataReads.push(args[0]);
return storage.getHistoricalBars(...args);
},
};
const engine = native
? new RustBacktestAdapter({ logger, storage }, { timeoutMs: 15000 })
? new RustBacktestAdapter({ logger, storage: runStorage }, { timeoutMs: 15000 })
: controlled;
const runner = new BacktestRunner({
engine,
@ -560,6 +568,7 @@ export async function fixture(browser: Browser, native = false) {
login,
close,
unexpectedNetwork,
historicalDataReads,
seedCatalog: () => seedBuiltinCatalog(new StrategyCatalogService(container)),
};
} catch (error) {