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 { OperationContext } from '@stock-bot/utils';
import type { ServiceContainer } from '@stock-bot/connection-factory';
import { initializeQMResources } from './session.operations';
export async function fetchExchanges(): Promise<unknown[] | null> {
const ctx = OperationContext.create('qm', 'exchanges');
export async function fetchExchanges(container: ServiceContainer): Promise<unknown[] | null> {
const ctx = OperationContext.create('qm', 'exchanges', { container });
try {
// Ensure resources are initialized
@ -15,7 +16,7 @@ export async function fetchExchanges(): Promise<unknown[] | null> {
const sessionManager = QMSessionManager.getInstance();
if (!sessionManager.getInitialized()) {
await initializeQMResources();
await initializeQMResources(container);
}
ctx.logger.info('QM exchanges fetch - not implemented yet');
@ -37,5 +38,7 @@ export async function fetchExchanges(): Promise<unknown[] | null> {
} catch (error) {
ctx.logger.error('Failed to fetch QM exchanges', { error });
return null;
} finally {
await ctx.dispose();
}
}