fixed up backtest

This commit is contained in:
Boki 2025-07-04 13:05:08 -04:00
parent cbe8f0282c
commit 38a6e73ad5
5 changed files with 77 additions and 231 deletions

View file

@ -92,30 +92,8 @@ export class RustBacktestAdapter extends EventEmitter {
this.container.logger.info('First trade structure:', rustResult.trades[0]);
}
// Store OHLC data for each symbol
const ohlcData: Record<string, any[]> = {};
for (const symbol of config.symbols) {
const bars = await this.storageService.getHistoricalBars(
symbol,
new Date(config.startDate),
new Date(config.endDate),
config.dataFrequency || '1d'
);
ohlcData[symbol] = bars.map(bar => ({
timestamp: bar.timestamp.getTime(),
open: bar.open,
high: bar.high,
low: bar.low,
close: bar.close,
volume: bar.volume,
}));
}
// Rust result is already in the correct format, just add OHLC data
const result: BacktestResult = {
...rustResult,
ohlcData,
};
// Rust result already contains OHLC data from the engine
const result: BacktestResult = rustResult;
this.emit('complete', result);
return result;