49 lines
1.6 KiB
TypeScript
49 lines
1.6 KiB
TypeScript
import { BaseHandler, Disabled, Handler, Operation, ScheduledOperation } from '@stock-bot/handlers';
|
|
import type { IServiceContainer } from '@stock-bot/services';
|
|
import { resolveIngestionServices } from '../../types';
|
|
import type { DataIngestionServices } from '../../types';
|
|
import { getChannels, getPosts, getShorts, updateUniqueSymbols } from './actions';
|
|
|
|
@Handler('ceo')
|
|
@Disabled()
|
|
export class CeoHandler extends BaseHandler<DataIngestionServices> {
|
|
constructor(services: IServiceContainer) {
|
|
super(resolveIngestionServices(services, 'ceo')); // Handler name read from @Handler decorator
|
|
}
|
|
|
|
@ScheduledOperation('get-channels', '0 */15 * * *', {
|
|
priority: 7,
|
|
immediately: false,
|
|
description: 'Get all CEO symbols and exchanges',
|
|
})
|
|
getChannels = getChannels;
|
|
|
|
@ScheduledOperation('update-unique-symbols-posts', '30 * * * *', {
|
|
immediately: false,
|
|
description: 'Process unique CEO symbols and schedule individual jobs',
|
|
payload: { action: 'get-posts' },
|
|
batch: {
|
|
size: 100,
|
|
delayInHours: 0.5,
|
|
},
|
|
})
|
|
updateUniqueSymbolsPosts = updateUniqueSymbols;
|
|
|
|
@ScheduledOperation('update-unique-symbols-shorts', '0 0 * * *', {
|
|
immediately: false,
|
|
description: 'Process unique CEO symbols and schedule individual jobs',
|
|
payload: { action: 'get-shorts' },
|
|
batch: {
|
|
size: 50,
|
|
delayInHours: 2,
|
|
direct: true, // Use direct mode for shorts
|
|
},
|
|
})
|
|
updateUniqueSymbolsShorts = updateUniqueSymbols;
|
|
|
|
@Operation('get-posts')
|
|
getPosts = getPosts;
|
|
|
|
@Operation('get-shorts')
|
|
getShorts = getShorts;
|
|
}
|