stock-bot/apps/stock/data-ingestion/src/handlers/ib/ib.handler.ts

33 lines
825 B
TypeScript

import {
BaseHandler,
Handler,
Operation,
ScheduledOperation,
type IServiceContainer,
} from '@stock-bot/handlers';
import { fetchExchanges, fetchExchangesAndSymbols, fetchSession, fetchSymbols } from './actions';
@Handler('ib')
export class IbHandler extends BaseHandler {
constructor(services: IServiceContainer) {
super(services);
}
@Operation('fetch-session')
fetchSession = fetchSession;
@Operation('fetch-exchanges')
fetchExchanges = fetchExchanges;
@Operation('fetch-symbols')
fetchSymbols = fetchSymbols;
@Operation('ib-exchanges-and-symbols')
@ScheduledOperation('ib-exchanges-and-symbols', '0 0 * * 0', {
priority: 5,
description: 'Fetch and update IB exchanges and symbols data',
immediately: false,
})
fetchExchangesAndSymbols = fetchExchangesAndSymbols;
}