fixed backtest i think

This commit is contained in:
Boki 2025-07-03 20:41:42 -04:00
parent 16ac28a565
commit 083dca500c
7 changed files with 663 additions and 56 deletions

View file

@ -11,6 +11,7 @@ import { AnalyticsService } from './services/AnalyticsService';
import { StorageService } from './services/StorageService';
import { StrategyManager } from './strategies/StrategyManager';
import { BacktestEngine } from './backtest/BacktestEngine';
import { RustBacktestAdapter } from './backtest/RustBacktestAdapter';
import { PaperTradingManager } from './paper/PaperTradingManager';
/**
@ -97,7 +98,15 @@ export async function createContainer(config: any): Promise<any> {
const executionService = new ExecutionService(services, storageService);
const analyticsService = new AnalyticsService(services, storageService);
const strategyManager = new StrategyManager(services);
const backtestEngine = new BacktestEngine(services, storageService, strategyManager);
// Add strategy manager to custom services early so RustBacktestAdapter can access it
services.custom.StrategyManager = strategyManager;
// Use Rust backtest engine if configured
const useRustEngine = config.services?.orchestrator?.backtesting?.useRustEngine !== false;
const backtestEngine = useRustEngine
? new RustBacktestAdapter(services)
: new BacktestEngine(services, storageService, strategyManager);
const paperTradingManager = new PaperTradingManager(
services,
storageService,
@ -111,7 +120,7 @@ export async function createContainer(config: any): Promise<any> {
storageService
);
// Store custom services
// Store custom services (before creating RustBacktestAdapter)
services.custom = {
StorageService: storageService,
MarketDataService: marketDataService,