stock-bot/apps/stock/orchestrator/examples/example-runtime.ts
2026-10-20 14:35:45 -04:00

33 lines
1.2 KiB
TypeScript

import { ServiceContainerBuilder } from '@stock-bot/di';
import { defined } from '@stock-bot/invariants';
import { registerOrchestratorServices } from '../src/container';
import type { OrchestratorServices } from '../src/types';
/** Offline examples explicitly opt into seeded synthetic data. No provider credentials are used. */
export async function createExampleRuntime() {
const di = await new ServiceContainerBuilder()
.withOptions({
enableCache: false,
enableQueue: false,
enableMongoDB: false,
enablePostgres: false,
enableQuestDB: false,
enableBrowser: false,
enableProxy: false,
})
.build();
await registerOrchestratorServices(di, {
initializeMode: false,
allowSyntheticData: true,
syntheticSeed: 42,
});
const container = di.resolve('serviceContainer') as OrchestratorServices;
return {
container,
storageService: defined(container.custom?.StorageService),
marketDataService: defined(container.custom?.MarketDataService),
executionService: defined(container.custom?.ExecutionService),
modeManager: defined(container.custom?.ModeManager),
strategyManager: defined(container.custom?.StrategyManager),
};
}