diff --git a/backend/src/services/apiServer.ts b/backend/src/services/apiServer.ts index d483c2c..cc8d161 100644 --- a/backend/src/services/apiServer.ts +++ b/backend/src/services/apiServer.ts @@ -2873,7 +2873,7 @@ RULES: const symbol = String(req.query.symbol || '').trim().toUpperCase(); if (!symbol) return res.status(400).json({ error: 'symbol required' }); const apiKey = await getUserFmpApiKey(authUserId); - const url = `https://financialmodelingprep.com/api/v3/profile/${symbol}?apikey=${apiKey}`; + const url = `https://financialmodelingprep.com/stable/profile?symbol=${encodeURIComponent(symbol)}&apikey=${apiKey}`; const data = await fetchFmpJson(url) as any; res.json(Array.isArray(data) ? data[0] ?? {} : data); } catch (error: any) { @@ -2895,7 +2895,7 @@ RULES: const symbol = String(req.query.symbol || '').trim().toUpperCase(); if (!symbol) return res.status(400).json({ error: 'symbol required' }); const apiKey = await getUserFmpApiKey(authUserId); - const url = `https://financialmodelingprep.com/api/v3/key-metrics/${symbol}?limit=4&apikey=${apiKey}`; + const url = `https://financialmodelingprep.com/stable/key-metrics?symbol=${encodeURIComponent(symbol)}&limit=4&apikey=${apiKey}`; const data = await fetchFmpJson(url) as any; res.json(Array.isArray(data) ? data[0] ?? {} : data); } catch (error: any) { @@ -2917,7 +2917,7 @@ RULES: const symbol = String(req.query.symbol || '').trim().toUpperCase(); if (!symbol) return res.status(400).json({ error: 'symbol required' }); const apiKey = await getUserFmpApiKey(authUserId); - const url = `https://financialmodelingprep.com/api/v3/historical/earning_calendar/${symbol}?limit=8&apikey=${apiKey}`; + const url = `https://financialmodelingprep.com/stable/earnings-calendar?symbol=${encodeURIComponent(symbol)}&limit=8&apikey=${apiKey}`; const data = await fetchFmpJson(url) as any; res.json({ earnings: Array.isArray(data) ? data : [] }); } catch (error: any) { @@ -2954,7 +2954,7 @@ RULES: qs.set('limit', String(Math.min(100, Number(req.query.limit) || 50))); qs.set('apikey', apiKey); qs.set('isEtf', 'false'); - const url = `https://financialmodelingprep.com/api/v3/stock-screener?${qs.toString()}`; + const url = `https://financialmodelingprep.com/stable/company-screener?${qs.toString()}`; const data = await fetchFmpJson(url) as any; res.json({ results: Array.isArray(data) ? data : [] }); } catch (error: any) {