From f78558224fb35df17a9c6b95335850d6625c033e Mon Sep 17 00:00:00 2001 From: Boki Date: Mon, 30 Jun 2025 08:30:55 -0400 Subject: [PATCH] fixes up financials --- .../handlers/qm/actions/financials.action.ts | 10 +++++----- .../src/handlers/qm/shared/config.ts | 20 ------------------- 2 files changed, 5 insertions(+), 25 deletions(-) diff --git a/apps/stock/data-ingestion/src/handlers/qm/actions/financials.action.ts b/apps/stock/data-ingestion/src/handlers/qm/actions/financials.action.ts index fb62fd5..d1395a6 100644 --- a/apps/stock/data-ingestion/src/handlers/qm/actions/financials.action.ts +++ b/apps/stock/data-ingestion/src/handlers/qm/actions/financials.action.ts @@ -106,7 +106,7 @@ export async function updateFinancials( // Update symbol to track last financials update const tracker = await getOperationTracker(this); - await tracker.updateSymbolOperation(qmSearchCode, 'financials_update', { + await tracker.updateSymbolOperation(qmSearchCode, `financials_${reportType === 'Q'? 'quarterly' : 'annual'}_update`, { status: 'success', lastRecordDate: new Date(), recordCount: reports.length @@ -179,11 +179,11 @@ export async function scheduleFinancialsUpdates( try { // Get symbols that need updating for both quarterly and annual - const staleSymbolsQ = await tracker.getStaleSymbols('financials_update_quarterly', { + const staleSymbolsQ = await tracker.getStaleSymbols('financials_quarterly_update', { minHoursSinceRun: forceUpdate ? 0 : 24 * 7, // Weekly by default limit }); - const staleSymbolsA = await tracker.getStaleSymbols('financials_update_annual', { + const staleSymbolsA = await tracker.getStaleSymbols('financials_annual_update', { minHoursSinceRun: forceUpdate ? 0 : 24 * 7, // Weekly by default limit }); @@ -225,7 +225,7 @@ export async function scheduleFinancialsUpdates( lastRecordDate: doc.operations?.price_update?.lastRecordDate, }, { priority: 4, - delay: queued * 200 // 1 second between jobs + delay: queued // 1 second between jobs }); queued++; @@ -246,7 +246,7 @@ export async function scheduleFinancialsUpdates( lastRecordDate: doc.operations?.price_update?.lastRecordDate, }, { priority: 4, - delay: queued * 200 // 1 second between jobs + delay: queued // 1 second between jobs }); queued++; diff --git a/apps/stock/data-ingestion/src/handlers/qm/shared/config.ts b/apps/stock/data-ingestion/src/handlers/qm/shared/config.ts index 7f6c135..62626c3 100644 --- a/apps/stock/data-ingestion/src/handlers/qm/shared/config.ts +++ b/apps/stock/data-ingestion/src/handlers/qm/shared/config.ts @@ -58,23 +58,3 @@ export function getQmHeaders(): Record { Referer: 'https://www.quotemedia.com/', }; } - - -curl 'https://app.quotemedia.com/datatool/getFinancialsEnhancedBySymbol.json?currency=true&lang=en&latestfiscaldate=true&numberOfReports=300&pathName=%2Fdemo%2Fportal%2Fcompany-research.php&qmodTool=Financials&reportType=Q&symbol=AAPL&webmasterId=500' \ - -H 'accept: */*' \ - -H 'accept-language: en' \ - -H 'cache-control: no-cache' \ - -b 'JSESSIONID=4960DF4F7AFADB62E678C6128553FAA3' \ - -H 'datatool-token: 0401d87a798899b5185fd0dae4d6829c3d1db7c15f44571637556a606b5a4474' \ - -H 'origin: https://client.quotemedia.com' \ - -H 'pragma: no-cache' \ - -H 'priority: u=1, i' \ - -H 'referer: https://client.quotemedia.com/' \ - -H 'sec-ch-ua: "Google Chrome";v="137", "Chromium";v="137", "Not/A)Brand";v="24"' \ - -H 'sec-ch-ua-mobile: ?0' \ - -H 'sec-ch-ua-platform: "Linux"' \ - -H 'sec-fetch-dest: empty' \ - -H 'sec-fetch-mode: cors' \ - -H 'sec-fetch-site: same-site' \ - -H 'user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36' \ - -o 'test.json' \ No newline at end of file