diff --git a/apps/stock/data-ingestion/src/handlers/qm/actions/symbol.action.ts b/apps/stock/data-ingestion/src/handlers/qm/actions/symbol.action.ts index 3741526..1a3330d 100644 --- a/apps/stock/data-ingestion/src/handlers/qm/actions/symbol.action.ts +++ b/apps/stock/data-ingestion/src/handlers/qm/actions/symbol.action.ts @@ -73,10 +73,10 @@ export async function spiderSymbol( // Extract and store unique exchanges const exchanges: Exchange[] = []; for (const symbol of symbols) { - if (symbol.exchangeCode && !exchanges.some(ex => ex.exchange === symbol.exchangeCode)) { + if (symbol.exchange && !exchanges.some(ex => ex.exchange === symbol.exchange)) { exchanges.push({ - exchange: symbol.exchangeCode, - exchangeName: symbol.exchangeShortName || '', + exchange: symbol.exchange, + exchangeName: symbol.exchangeName || '', countryCode: symbol.countryCode || '', source: 'qm', }); @@ -186,11 +186,16 @@ export async function searchSymbols( await sessionManager.incrementSuccessfulCalls(sessionId, session.uuid); // Process symbol data - const processedSymbols = Array.isArray(symbols) ? symbols.map((symbol: any) => ({ - ...symbol, - qmSearchCode: symbol.symbol || '', - symbol: (symbol.symbol as string)?.split(':')[0] || '', - })) : []; + const processedSymbols = Array.isArray(symbols) ? symbols.map((symbol: any) => { + const { exchangeCode, exchangeShortName, ...rest } = symbol; + return { + ...rest, + exchange: exchangeCode, + exchangeName: exchangeShortName, + qmSearchCode: symbol.symbol, + symbol: (symbol.symbol as string)?.split(':')[0], + }; + }) : []; this.logger.debug('QM API returned symbols ${query} - ${processedSymbols.length}', { query,