initial data-ingestion refactor

This commit is contained in:
Boki 2025-06-21 15:18:25 -04:00
parent 09d907a10c
commit 4f89affc2b
19 changed files with 309 additions and 549 deletions

View file

@ -3,11 +3,12 @@
*/
import { Browser } from '@stock-bot/browser';
import { OperationContext } from '@stock-bot/utils';
import type { ServiceContainer } from '@stock-bot/connection-factory';
import { IB_CONFIG } from '../shared/config';
export async function fetchSession(): Promise<Record<string, string> | undefined> {
const ctx = OperationContext.create('ib', 'session');
export async function fetchSession(container: ServiceContainer): Promise<Record<string, string> | undefined> {
const ctx = OperationContext.create('ib', 'session', { container });
try {
await Browser.initialize({
@ -84,5 +85,7 @@ export async function fetchSession(): Promise<Record<string, string> | undefined
} catch (error) {
ctx.logger.error('Failed to fetch IB symbol summary', { error });
return;
} finally {
await ctx.dispose();
}
}