stock-bot/apps/stock/data-ingestion/src/handlers/ib/ib.handler.ts
2026-10-20 14:35:45 -04:00

36 lines
1.1 KiB
TypeScript

import { BaseHandler, Disabled, Handler, Operation, ScheduledOperation } from '@stock-bot/handlers';
import type { IServiceContainer } from '@stock-bot/services';
import { resolveIngestionServices } from '../../types';
import { fetchExchanges, fetchExchangesAndSymbols, fetchSession, fetchSymbols } from './actions';
@Handler('ib')
@Disabled()
export class IbHandler extends BaseHandler {
constructor(services: IServiceContainer) {
super(resolveIngestionServices(services, 'ib'));
}
@Operation('fetch-session')
async fetchSession(): Promise<Record<string, string> | undefined> {
return fetchSession(this);
}
@Operation('fetch-exchanges')
async fetchExchanges(): Promise<unknown[] | null> {
return fetchExchanges(this);
}
@Operation('fetch-symbols')
async fetchSymbols(): Promise<unknown[] | null> {
return fetchSymbols(this);
}
@ScheduledOperation('ib-exchanges-and-symbols', '0 0 * * 0', {
priority: 5,
description: 'Fetch and update IB exchanges and symbols data',
immediately: false,
})
async fetchExchangesAndSymbols(): Promise<unknown> {
return fetchExchangesAndSymbols(this);
}
}