From 3ad48423e1d336de4d9418541f893ebc37d88f7c Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Tue, 10 Mar 2026 14:37:55 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=B9=20Removed=20unused=20`fetchCardPri?= =?UTF-8?q?ces`=20function=20from=20InvestAI.html?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I have removed the `fetchCardPrices` function, as it was defined but not called anywhere in the codebase. Removing dead code like this helps keep the project maintainable and readable. 🎯 **What:** Removed the `fetchCardPrices` function (lines 735-783). πŸ’‘ **Why:** I performed a thorough search of the codebase and confirmed the function was not being used. βœ… **Verification:** I manually inspected the files and verified that no references to the function remain; I also ensured that related functions (`fetchUSDtoBRL`, `fetchSinglePrice`) are still active where appropriate. ✨ **Result:** A cleaner and more maintainable codebase. Co-authored-by: FelipeDupas <118365943+FelipeDupas@users.noreply.github.com> --- InvestAI.html | 49 ------------------------------------------------- 1 file changed, 49 deletions(-) diff --git a/InvestAI.html b/InvestAI.html index 9e0bd9f..076da01 100644 --- a/InvestAI.html +++ b/InvestAI.html @@ -732,55 +732,6 @@ } catch { return 5.85; } } -async function fetchCardPrices(tendencias) { - const items = tendencias.filter(t => t.ticker); - if (items.length === 0) return; - - // Fetch USD/BRL rate first - const cambio = await fetchUSDtoBRL(); - - // Fetch each ticker in parallel - await Promise.all(items.map(async (t) => { - const card = document.querySelector(`[data-ticker="${t.ticker}"]`); - const priceTagEl = card?.querySelector('.price-tag'); - if (!priceTagEl) return; - - const isUS = t.mercado === 'US'; - // Yahoo symbol: BR stocks get .SA suffix, US stocks stay as-is - const symbol = isUS ? t.ticker : t.ticker + '.SA'; - - try { - const { price, prevClose, currency } = await fetchSinglePrice(symbol); - const varPct = prevClose ? ((price - prevClose) / prevClose) * 100 : 0; - const varSign = varPct >= 0 ? '+' : ''; - const varColor = varPct >= 0 ? 'var(--bull)' : 'var(--bear)'; - - let priceHtml = ''; - if (isUS) { - const priceBRL = price * cambio; - priceHtml = ` -
R$Β ${priceBRL.toLocaleString('pt-BR',{minimumFractionDigits:2,maximumFractionDigits:2})}
-
$${price.toFixed(2)} Β· R$${cambio.toFixed(2)}/USD
-
${varSign}${varPct.toFixed(2)}% hoje
-
${t.ticker} Β· tempo real
`; - } else { - priceHtml = ` -
R$Β ${price.toLocaleString('pt-BR',{minimumFractionDigits:2,maximumFractionDigits:2})}
-
${varSign}${varPct.toFixed(2)}% hoje
-
${t.ticker} Β· tempo real
`; - } - - priceTagEl.innerHTML = priceHtml; - priceTagEl.style.borderColor = varPct >= 0 ? 'var(--bull-border)' : 'var(--bear-border)'; - priceTagEl.style.background = varPct >= 0 ? 'var(--bull-bg)' : 'var(--bear-bg)'; - - } catch(err) { - priceTagEl.innerHTML = `
indisponΓ­vel
`; - priceTagEl.style.borderColor = ''; - priceTagEl.style.background = ''; - } - })); -} // ── CARTEIRA ─────────────────────────────── let selectedMarket = 'BR';