From d8e7449605649713c59775803ba4374c50583c54 Mon Sep 17 00:00:00 2001 From: Boki Date: Thu, 10 Jul 2025 08:50:07 -0400 Subject: [PATCH] finished up intraday EOD --- .../src/handlers/eod/actions/intraday.ts | 31 ++++++++++--------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/apps/stock/data-ingestion/src/handlers/eod/actions/intraday.ts b/apps/stock/data-ingestion/src/handlers/eod/actions/intraday.ts index 48e00c4..e704478 100644 --- a/apps/stock/data-ingestion/src/handlers/eod/actions/intraday.ts +++ b/apps/stock/data-ingestion/src/handlers/eod/actions/intraday.ts @@ -52,22 +52,23 @@ export async function scheduleIntradayCrawl( delisted: false }).toArray(); - // Filter out delisted symbols and ensure we get AAPL with US exchange - const activeSymbols = symbolsForInterval.filter(item => - item.symbol.delisted === false && - item.symbol.Code === 'AAPL' && - item.symbol.eodExchange === 'US' - ); - // Add interval info to each symbol - activeSymbols.forEach(item => { - allSymbolsForCrawl.push({ - symbol: item.symbol, - interval: interval, - operationName: operationName, - lastRun: item.lastRun, - lastSuccess: item.lastSuccess - }); + symbolsForInterval.forEach(symbol => { + // Check if this interval needs processing (not finished or needs new data) + const operationStatus = symbol.operations?.[operationName]; + const shouldProcess = !operationStatus || !operationStatus.finished || + (operationStatus.newestDateReached && + new Date(operationStatus.newestDateReached) < new Date(Date.now() - 24 * 60 * 60 * 1000)); // Check if newest date is more than 1 day old + + if (shouldProcess) { + allSymbolsForCrawl.push({ + symbol: symbol, + interval: interval, + operationName: operationName, + lastRun: operationStatus?.lastRunAt, + lastSuccess: operationStatus?.lastSuccessAt + }); + } }); }