renamed corporate-actions to events and finished intial work on it
This commit is contained in:
parent
bb16a52bf7
commit
d3850f9eaf
6 changed files with 200 additions and 200 deletions
|
|
@ -38,6 +38,7 @@ export const QM_CONFIG = {
|
|||
LOOKUP_URL: 'https://app.quotemedia.com/datatool/lookup.json',
|
||||
SYMBOL_URL: 'https://app.quotemedia.com/datatool/getProfiles.json',
|
||||
PRICES_URL: 'https://app.quotemedia.com/datatool/getEnhancedChartData.json',
|
||||
EVENTS_URL: 'https://app.quotemedia.com/datatool/getIndicatorsBySymbol.json'
|
||||
} as const;
|
||||
|
||||
// Session management settings
|
||||
|
|
|
|||
|
|
@ -1,112 +1,104 @@
|
|||
/**
|
||||
* QM Operation Registry - Define and register all QM operations
|
||||
*/
|
||||
|
||||
import type { MongoDBClient, Logger } from '@stock-bot/types';
|
||||
import { QMOperationTracker } from './operation-tracker';
|
||||
import type { QMOperationConfig } from './types';
|
||||
|
||||
// Define all QM operations
|
||||
export const QM_OPERATIONS: QMOperationConfig[] = [
|
||||
// Price data operations
|
||||
{
|
||||
name: 'symbol_info',
|
||||
type: 'standard',
|
||||
description: 'Update symbol metadata',
|
||||
defaultStaleHours: 24 * 7 // Weekly
|
||||
},
|
||||
{
|
||||
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
|
||||
},
|
||||
|
||||
// Fundamental data operations
|
||||
{
|
||||
name: 'financials_update',
|
||||
type: 'standard',
|
||||
description: 'Update financial statements',
|
||||
defaultStaleHours: 24 * 7 // Weekly
|
||||
},
|
||||
// Corporate actions - fetched together in one API call
|
||||
{
|
||||
name: 'corporate_actions_update',
|
||||
type: 'standard',
|
||||
description: 'Update corporate actions (earnings, dividends, splits)',
|
||||
defaultStaleHours: 24 * 7 // Weekly
|
||||
},
|
||||
|
||||
// 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
|
||||
// },
|
||||
|
||||
// // 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
|
||||
// }
|
||||
];
|
||||
|
||||
/**
|
||||
* Initialize operation tracker with all registered operations
|
||||
*/
|
||||
export async function initializeQMOperations(
|
||||
mongodb: MongoDBClient,
|
||||
logger: Logger
|
||||
): Promise<QMOperationTracker> {
|
||||
logger.info('Initializing QM operations tracker');
|
||||
|
||||
const tracker = new QMOperationTracker(mongodb, logger);
|
||||
|
||||
// Register all operations
|
||||
for (const operation of QM_OPERATIONS) {
|
||||
try {
|
||||
await tracker.registerOperation(operation);
|
||||
logger.debug(`Registered operation: ${operation.name}`);
|
||||
} catch (error) {
|
||||
logger.error(`Failed to register operation: ${operation.name}`, { error });
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
logger.info('QM operations tracker initialized', {
|
||||
operationCount: QM_OPERATIONS.length
|
||||
});
|
||||
|
||||
return tracker;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get operation configuration by name
|
||||
*/
|
||||
export function getOperationConfig(name: string): QMOperationConfig | undefined {
|
||||
return QM_OPERATIONS.find(op => op.name === name);
|
||||
/**
|
||||
* QM Operation Registry - Define and register all QM operations
|
||||
*/
|
||||
|
||||
import type { Logger, MongoDBClient } from '@stock-bot/types';
|
||||
import { QMOperationTracker } from './operation-tracker';
|
||||
import type { QMOperationConfig } from './types';
|
||||
|
||||
// Define all QM operations
|
||||
export const QM_OPERATIONS: QMOperationConfig[] = [
|
||||
// Price data operations
|
||||
{
|
||||
name: 'symbol_info',
|
||||
type: 'standard',
|
||||
description: 'Update symbol metadata',
|
||||
defaultStaleHours: 24 * 7 // Weekly
|
||||
},
|
||||
{
|
||||
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
|
||||
},
|
||||
|
||||
// Fundamental data operations
|
||||
{
|
||||
name: 'financials_update',
|
||||
type: 'standard',
|
||||
description: 'Update financial statements',
|
||||
defaultStaleHours: 24 * 7 // Weekly
|
||||
},
|
||||
// Corporate actions - fetched together in one API call
|
||||
{
|
||||
name: 'events_update',
|
||||
type: 'standard',
|
||||
description: 'Update events (earnings, dividends, splits)',
|
||||
defaultStaleHours: 24 * 7 // Weekly
|
||||
},
|
||||
|
||||
// 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
|
||||
// }
|
||||
];
|
||||
|
||||
/**
|
||||
* Initialize operation tracker with all registered operations
|
||||
*/
|
||||
export async function initializeQMOperations(
|
||||
mongodb: MongoDBClient,
|
||||
logger: Logger
|
||||
): Promise<QMOperationTracker> {
|
||||
logger.info('Initializing QM operations tracker');
|
||||
|
||||
const tracker = new QMOperationTracker(mongodb, logger);
|
||||
|
||||
// Register all operations
|
||||
for (const operation of QM_OPERATIONS) {
|
||||
try {
|
||||
await tracker.registerOperation(operation);
|
||||
logger.debug(`Registered operation: ${operation.name}`);
|
||||
} catch (error) {
|
||||
logger.error(`Failed to register operation: ${operation.name}`, { error });
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
logger.info('QM operations tracker initialized', {
|
||||
operationCount: QM_OPERATIONS.length
|
||||
});
|
||||
|
||||
return tracker;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get operation configuration by name
|
||||
*/
|
||||
export function getOperationConfig(name: string): QMOperationConfig | undefined {
|
||||
return QM_OPERATIONS.find(op => op.name === name);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue