qm scaffolding done
This commit is contained in:
parent
736b86e66a
commit
c799962f05
11 changed files with 1693 additions and 336 deletions
|
|
@ -4,15 +4,35 @@ import {
|
|||
Operation,
|
||||
ScheduledOperation,
|
||||
} from '@stock-bot/handlers';
|
||||
import { checkSessions, createSession, searchSymbols, spiderSymbol } from './actions';
|
||||
import { getOperationStats } from './actions/price.action';
|
||||
import {
|
||||
checkSessions,
|
||||
createSession,
|
||||
searchSymbols,
|
||||
spiderSymbol,
|
||||
getOperationStats,
|
||||
updateSymbolInfo,
|
||||
scheduleSymbolInfoUpdates,
|
||||
updateFinancials,
|
||||
scheduleFinancialsUpdates,
|
||||
updateCorporateActions,
|
||||
scheduleCorporateActionsUpdates,
|
||||
updateFilings,
|
||||
scheduleFilingsUpdates,
|
||||
updatePrices,
|
||||
schedulePriceUpdates,
|
||||
updateIntradayBars,
|
||||
scheduleIntradayUpdates
|
||||
} from './actions';
|
||||
import { initializeQMOperations } from './shared/operation-registry';
|
||||
|
||||
@Handler('qm')
|
||||
export class QMHandler extends BaseHandler {
|
||||
constructor(services: any) {
|
||||
initializeQMOperations(services.mongodb, services.logger);
|
||||
super(services); // Handler name read from @Handler decorator
|
||||
// Initialize operations after super() so services are available
|
||||
initializeQMOperations(this.mongodb, this.logger).catch(error => {
|
||||
this.logger.error('Failed to initialize QM operations', { error });
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -41,22 +61,83 @@ export class QMHandler extends BaseHandler {
|
|||
@Operation('search-symbols')
|
||||
searchSymbols = searchSymbols;
|
||||
|
||||
// /**
|
||||
// * PRICE DATA
|
||||
// */
|
||||
// @ScheduledOperation('update-prices', '0 */6 * * *', {
|
||||
// priority: 5,
|
||||
// immediately: false,
|
||||
// description: 'Update daily prices every 6 hours'
|
||||
// })
|
||||
// updatePrices = updatePrices;
|
||||
/**
|
||||
* SYMBOL INFO
|
||||
*/
|
||||
@Operation('update-symbol-info')
|
||||
updateSymbolInfo = updateSymbolInfo;
|
||||
|
||||
// @ScheduledOperation('update-intraday-bars', '*/30 * * * *', {
|
||||
// priority: 6,
|
||||
// immediately: false,
|
||||
// description: 'Update intraday bars every 30 minutes during market hours'
|
||||
// })
|
||||
// updateIntradayBars = updateIntradayBars;
|
||||
@ScheduledOperation('schedule-symbol-info-updates', '0 */6 * * *', {
|
||||
priority: 7,
|
||||
immediately: false,
|
||||
description: 'Check for symbols needing info updates every 6 hours'
|
||||
})
|
||||
scheduleSymbolInfoUpdates = scheduleSymbolInfoUpdates;
|
||||
|
||||
/**
|
||||
* FINANCIALS
|
||||
*/
|
||||
@Operation('update-financials')
|
||||
updateFinancials = updateFinancials;
|
||||
|
||||
@ScheduledOperation('schedule-financials-updates', '0 2 * * *', {
|
||||
priority: 6,
|
||||
immediately: false,
|
||||
description: 'Check for symbols needing financials updates daily at 2 AM'
|
||||
})
|
||||
scheduleFinancialsUpdates = scheduleFinancialsUpdates;
|
||||
|
||||
/**
|
||||
* CORPORATE ACTIONS (Dividends, Splits, Earnings)
|
||||
*/
|
||||
@Operation('update-corporate-actions')
|
||||
updateCorporateActions = updateCorporateActions;
|
||||
|
||||
@ScheduledOperation('schedule-corporate-actions-updates', '0 3 * * *', {
|
||||
priority: 6,
|
||||
immediately: false,
|
||||
description: 'Check for symbols needing corporate actions updates daily at 3 AM'
|
||||
})
|
||||
scheduleCorporateActionsUpdates = scheduleCorporateActionsUpdates;
|
||||
|
||||
/**
|
||||
* FILINGS
|
||||
*/
|
||||
@Operation('update-filings')
|
||||
updateFilings = updateFilings;
|
||||
|
||||
@ScheduledOperation('schedule-filings-updates', '0 */8 * * *', {
|
||||
priority: 5,
|
||||
immediately: false,
|
||||
description: 'Check for symbols needing filings updates every 8 hours'
|
||||
})
|
||||
scheduleFilingsUpdates = scheduleFilingsUpdates;
|
||||
|
||||
/**
|
||||
* PRICE DATA
|
||||
*/
|
||||
@Operation('update-prices')
|
||||
updatePrices = updatePrices;
|
||||
|
||||
@ScheduledOperation('schedule-price-updates', '0 */6 * * *', {
|
||||
priority: 8,
|
||||
immediately: false,
|
||||
description: 'Check for symbols needing price updates every 6 hours'
|
||||
})
|
||||
schedulePriceUpdates = schedulePriceUpdates;
|
||||
|
||||
/**
|
||||
* INTRADAY DATA
|
||||
*/
|
||||
@Operation('update-intraday-bars')
|
||||
updateIntradayBars = updateIntradayBars;
|
||||
|
||||
@ScheduledOperation('schedule-intraday-updates', '*/30 * * * *', {
|
||||
priority: 9,
|
||||
immediately: false,
|
||||
description: 'Check for symbols needing intraday updates every 30 minutes'
|
||||
})
|
||||
scheduleIntradayUpdates = scheduleIntradayUpdates;
|
||||
|
||||
/**
|
||||
* MONITORING
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue