initial setup with operation tracker
This commit is contained in:
parent
d52cfe7de2
commit
736b86e66a
5 changed files with 92 additions and 89 deletions
|
|
@ -11,74 +11,80 @@ import type { QMOperationConfig } from './types';
|
|||
export const QM_OPERATIONS: QMOperationConfig[] = [
|
||||
// Price data operations
|
||||
{
|
||||
name: 'price_update',
|
||||
name: 'symbol_info',
|
||||
type: 'standard',
|
||||
description: 'Update daily price data',
|
||||
defaultStaleHours: 24
|
||||
},
|
||||
{
|
||||
name: 'intraday_bars',
|
||||
type: 'intraday_crawl',
|
||||
description: 'Crawl intraday price bars from today backwards',
|
||||
requiresFinishedFlag: true,
|
||||
defaultStaleHours: 1 // Check every hour for new data
|
||||
},
|
||||
|
||||
// Fundamental data operations
|
||||
{
|
||||
name: 'financials_update',
|
||||
type: 'standard',
|
||||
description: 'Update financial statements',
|
||||
description: 'Update symbol metadata',
|
||||
defaultStaleHours: 24 * 7 // Weekly
|
||||
},
|
||||
{
|
||||
name: 'earnings_update',
|
||||
type: 'standard',
|
||||
description: 'Update earnings data',
|
||||
defaultStaleHours: 24 * 7 // Weekly
|
||||
},
|
||||
{
|
||||
name: 'dividends_update',
|
||||
type: 'standard',
|
||||
description: 'Update dividend history',
|
||||
defaultStaleHours: 24 * 7 // Weekly
|
||||
},
|
||||
{
|
||||
name: 'splits_update',
|
||||
type: 'standard',
|
||||
description: 'Update stock split history',
|
||||
defaultStaleHours: 24 * 30 // Monthly
|
||||
},
|
||||
// {
|
||||
// name: 'price_update',
|
||||
// type: 'standard',
|
||||
// description: 'Update daily price data',
|
||||
// defaultStaleHours: 24
|
||||
// },
|
||||
// {
|
||||
// name: 'intraday_bars',
|
||||
// type: 'intraday_crawl',
|
||||
// description: 'Crawl intraday price bars from today backwards',
|
||||
// requiresFinishedFlag: true,
|
||||
// defaultStaleHours: 1 // Check every hour for new data
|
||||
// },
|
||||
|
||||
// News and filings
|
||||
{
|
||||
name: 'filings_update',
|
||||
type: 'standard',
|
||||
description: 'Update SEC filings',
|
||||
defaultStaleHours: 24 // Daily
|
||||
},
|
||||
{
|
||||
name: 'news_update',
|
||||
type: 'standard',
|
||||
description: 'Update news articles',
|
||||
defaultStaleHours: 6 // Every 6 hours
|
||||
},
|
||||
// // Fundamental data operations
|
||||
// {
|
||||
// name: 'financials_update',
|
||||
// type: 'standard',
|
||||
// description: 'Update financial statements',
|
||||
// defaultStaleHours: 24 * 7 // Weekly
|
||||
// },
|
||||
// {
|
||||
// name: 'earnings_update',-
|
||||
// type: 'standard',
|
||||
// description: 'Update earnings data',
|
||||
// defaultStaleHours: 24 * 7 // Weekly
|
||||
// },
|
||||
// {
|
||||
// name: 'dividends_update',
|
||||
// type: 'standard',
|
||||
// description: 'Update dividend history',
|
||||
// defaultStaleHours: 24 * 7 // Weekly
|
||||
// },
|
||||
// {
|
||||
// name: 'splits_update',
|
||||
// type: 'standard',
|
||||
// description: 'Update stock split history',
|
||||
// defaultStaleHours: 24 * 30 // Monthly
|
||||
// },
|
||||
|
||||
// Technical indicators
|
||||
{
|
||||
name: 'indicators_update',
|
||||
type: 'standard',
|
||||
description: 'Calculate technical indicators',
|
||||
defaultStaleHours: 24 // Daily
|
||||
},
|
||||
// // News and filings
|
||||
// {
|
||||
// name: 'filings_update',
|
||||
// type: 'standard',
|
||||
// description: 'Update SEC filings',
|
||||
// defaultStaleHours: 24 // Daily
|
||||
// },
|
||||
// {
|
||||
// name: 'news_update',
|
||||
// type: 'standard',
|
||||
// description: 'Update news articles',
|
||||
// defaultStaleHours: 6 // Every 6 hours
|
||||
// },
|
||||
|
||||
// Options data
|
||||
{
|
||||
name: 'options_chain',
|
||||
type: 'standard',
|
||||
description: 'Update options chain data',
|
||||
defaultStaleHours: 1 // Hourly during market hours
|
||||
}
|
||||
// // Technical indicators
|
||||
// {
|
||||
// name: 'indicators_update',
|
||||
// type: 'standard',
|
||||
// description: 'Calculate technical indicators',
|
||||
// defaultStaleHours: 24 // Daily
|
||||
// },
|
||||
|
||||
// // Options data
|
||||
// {
|
||||
// name: 'options_chain',
|
||||
// type: 'standard',
|
||||
// description: 'Update options chain data',
|
||||
// defaultStaleHours: 1 // Hourly during market hours
|
||||
// }
|
||||
];
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@
|
|||
* Supports dynamic operation registration with auto-indexing
|
||||
*/
|
||||
|
||||
import type { Logger } from '@stock-bot/types';
|
||||
import type { MongoDBClient } from '@stock-bot/mongodb';
|
||||
import type { Logger } from '@stock-bot/types';
|
||||
import type { IntradayCrawlSymbol, QMOperationConfig } from './types';
|
||||
|
||||
export class QMOperationTracker {
|
||||
|
|
@ -140,7 +140,7 @@ export class QMOperationTracker {
|
|||
};
|
||||
}>
|
||||
): Promise<void> {
|
||||
if (updates.length === 0) return;
|
||||
if (updates.length === 0) {return;}
|
||||
|
||||
const bulkOps = updates.map(({ symbol, operation, data }) => {
|
||||
const update: any = {
|
||||
|
|
@ -180,7 +180,7 @@ export class QMOperationTracker {
|
|||
this.logger.debug('Bulk updated symbol operations', {
|
||||
totalUpdates: updates.length,
|
||||
modified: result.modifiedCount,
|
||||
operations: [...new Set(updates.map(u => u.operation))]
|
||||
operations: Array.from(new Set(updates.map(u => u.operation)))
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue