Skip to content

OpenStock is an open-source alternative to expensive market platforms. Track real-time prices, set personalized alerts, and explore detailed company insights — built openly, for everyone, forever free.

Refine search exchange label fallback

keshav-00580454b914118
diff --git a/lib/actions/finnhub.actions.ts b/lib/actions/finnhub.actions.ts
index 9262448..0c9fcb7 100644
--- a/lib/actions/finnhub.actions.ts
+++ b/lib/actions/finnhub.actions.ts
@@ -50,7 +50,7 @@ export { fetchJSON };
function getExchangeLabel(symbol: string, exchange?: string) {
if (exchange?.trim()) {
- return exchange;
+ return exchange.trim();
}
const parts = symbol.split('.');
@@ -60,11 +60,7 @@ function getExchangeLabel(symbol: string, exchange?: string) {
return 'US';
}
- if (FINNHUB_EXCHANGE_SUFFIXES.has(suffix) || suffix.length >= 2) {
- return suffix;
- }
-
- return 'US';
+ return FINNHUB_EXCHANGE_SUFFIXES.has(suffix) ? suffix : 'US';
}
export async function getQuote(symbol: string) {