updated symbols

This commit is contained in:
Boki 2025-06-29 13:32:55 -04:00
parent 44fa3e8c0c
commit 11eb470e5f

View file

@ -73,10 +73,10 @@ export async function spiderSymbol(
// Extract and store unique exchanges // Extract and store unique exchanges
const exchanges: Exchange[] = []; const exchanges: Exchange[] = [];
for (const symbol of symbols) { 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({ exchanges.push({
exchange: symbol.exchangeCode, exchange: symbol.exchange,
exchangeName: symbol.exchangeShortName || '', exchangeName: symbol.exchangeName || '',
countryCode: symbol.countryCode || '', countryCode: symbol.countryCode || '',
source: 'qm', source: 'qm',
}); });
@ -186,11 +186,16 @@ export async function searchSymbols(
await sessionManager.incrementSuccessfulCalls(sessionId, session.uuid); await sessionManager.incrementSuccessfulCalls(sessionId, session.uuid);
// Process symbol data // Process symbol data
const processedSymbols = Array.isArray(symbols) ? symbols.map((symbol: any) => ({ const processedSymbols = Array.isArray(symbols) ? symbols.map((symbol: any) => {
...symbol, const { exchangeCode, exchangeShortName, ...rest } = symbol;
qmSearchCode: symbol.symbol || '', return {
symbol: (symbol.symbol as string)?.split(':')[0] || '', ...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}', { this.logger.debug('QM API returned symbols ${query} - ${processedSymbols.length}', {
query, query,