diff --git a/apps/stock/data-ingestion/src/handlers/eod/actions/corporate-actions.ts b/apps/stock/data-ingestion/src/handlers/eod/actions/corporate-actions.ts index 6fd0994..e6fab3f 100644 --- a/apps/stock/data-ingestion/src/handlers/eod/actions/corporate-actions.ts +++ b/apps/stock/data-ingestion/src/handlers/eod/actions/corporate-actions.ts @@ -59,7 +59,7 @@ export async function scheduleFetchCorporateActions( // Schedule dividends fetch await this.scheduleOperation('fetch-corporate-actions', { symbol: symbol.Code, - exchange: symbol.Exchange, + exchange: symbol.eodExchange || symbol.Exchange, // Use eodExchange if available actionType: 'dividends', country: symbol.Country }, { @@ -75,7 +75,7 @@ export async function scheduleFetchCorporateActions( // Schedule splits fetch await this.scheduleOperation('fetch-corporate-actions', { symbol: symbol.Code, - exchange: symbol.Exchange, + exchange: symbol.eodExchange || symbol.Exchange, // Use eodExchange if available actionType: 'splits', country: symbol.Country }, { diff --git a/apps/stock/data-ingestion/src/handlers/eod/actions/fundamentals.ts b/apps/stock/data-ingestion/src/handlers/eod/actions/fundamentals.ts index e5daad1..8ac0378 100644 --- a/apps/stock/data-ingestion/src/handlers/eod/actions/fundamentals.ts +++ b/apps/stock/data-ingestion/src/handlers/eod/actions/fundamentals.ts @@ -70,7 +70,7 @@ export async function scheduleFetchFundamentals( const etf = etfs[i]; await this.scheduleOperation('fetch-single-fundamentals', { symbol: etf.Code, - exchange: etf.Exchange, + exchange: etf.eodExchange || etf.Exchange, // Use eodExchange if available country: etf.Country }, { attempts: 3, @@ -96,7 +96,7 @@ export async function scheduleFetchFundamentals( // Convert to array of {symbol, exchange, country} objects const symbolBatch = batch.map(s => ({ symbol: s.Code, - exchange: s.Exchange, + exchange: s.eodExchange || s.Exchange, // Use eodExchange if available country: s.Country })); 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 5f82ae2..af4b567 100644 --- a/apps/stock/data-ingestion/src/handlers/eod/actions/intraday.ts +++ b/apps/stock/data-ingestion/src/handlers/eod/actions/intraday.ts @@ -88,7 +88,7 @@ export async function scheduleIntradayCrawl( await this.scheduleOperation('crawl-intraday', { symbol: symbol.Code, - exchange: symbol.Exchange, + exchange: symbol.eodExchange || symbol.Exchange, // Use eodExchange if available interval, country: symbol.Country }, { diff --git a/apps/stock/data-ingestion/src/handlers/eod/actions/prices.ts b/apps/stock/data-ingestion/src/handlers/eod/actions/prices.ts index acb8b78..1a3dac9 100644 --- a/apps/stock/data-ingestion/src/handlers/eod/actions/prices.ts +++ b/apps/stock/data-ingestion/src/handlers/eod/actions/prices.ts @@ -57,7 +57,7 @@ export async function scheduleFetchPrices( await this.scheduleOperation('fetch-prices', { symbol: symbol.Code, - exchange: symbol.Exchange, + exchange: symbol.eodExchange || symbol.Exchange, // Use eodExchange if available country: symbol.Country }, { attempts: 3, diff --git a/apps/stock/data-ingestion/src/handlers/eod/actions/symbols.ts b/apps/stock/data-ingestion/src/handlers/eod/actions/symbols.ts index 2d64d08..b7741ae 100644 --- a/apps/stock/data-ingestion/src/handlers/eod/actions/symbols.ts +++ b/apps/stock/data-ingestion/src/handlers/eod/actions/symbols.ts @@ -128,7 +128,8 @@ export async function fetchSymbols( // Add metadata to each symbol const symbolsWithMetadata = symbols.map(symbol => ({ ...symbol, - Exchange: symbol.Exchange || exchangeCode, // Ensure Exchange is set + Exchange: symbol.Exchange || exchangeCode, // Keep the original exchange (might be wrong) + eodExchange: exchangeCode, // Store the correct exchange code used to fetch this symbol delisted: delisted, })); diff --git a/apps/stock/data-ingestion/src/handlers/te/te.handler.ts b/apps/stock/data-ingestion/src/handlers/te/te.handler.ts index 35d5559..cc29c5b 100644 --- a/apps/stock/data-ingestion/src/handlers/te/te.handler.ts +++ b/apps/stock/data-ingestion/src/handlers/te/te.handler.ts @@ -8,7 +8,7 @@ import type { DataIngestionServices } from '../../types'; import { fetchCountries, spiderUrl } from './actions'; @Handler('te') -// @Disabled() +@Disabled() export class TeHandler extends BaseHandler { constructor(services: any) { super(services); @@ -17,7 +17,7 @@ export class TeHandler extends BaseHandler { @ScheduledOperation('te-countries', '0 0 * * 0', { priority: 5, description: 'Fetch and update Trading Economics countries data', - immediately: true, + immediately: false, }) @Disabled() fetchCountries = fetchCountries; @@ -25,7 +25,7 @@ export class TeHandler extends BaseHandler { @ScheduledOperation('te-spider', '0 0 * * 0', { priority: 5, description: 'Fetch and update Trading Economics countries data', - immediately: true, + immediately: false, }) spiderUrlSchedule = spiderUrl; } \ No newline at end of file diff --git a/docs/todo.md b/docs/todo.md index f4479a8..dd3e8c8 100644 --- a/docs/todo.md +++ b/docs/todo.md @@ -11,11 +11,9 @@ Data Ingestion Servers Proxmox -- move gitlab to router server - set up monitoring solution Truenas -- switch truenas to RAIDz2 - set up frigate with coral - set up minio