/* Company Stock Price — US ETFs & mutual funds via Finnhub (live API only). */ function RetCell({ v }) { if (v == null) return ; return = 0 ? 'var(--up)' : 'var(--down)' }}>{fmt.pct(v)}; } function FundsScreen() { const L = useLive(); const MD = useMarketData(); const [cat, setCat] = useState('All'); const [sort, setSort] = useState('nav'); const [region, setRegion] = useState('US'); const [globalFunds, setGlobalFunds] = useState([]); const [loading, setLoading] = useState(false); const [err, setErr] = useState(''); const [sel, setSel] = useState(null); const [detail, setDetail] = useState(null); const [detailBusy, setDetailBusy] = useState(false); const funds = region === 'US' ? globalFunds : []; const categories = ['All', ...[...new Set(globalFunds.map((f) => f.category))].sort()]; async function loadGlobal() { if (!L.hasKey) return; setLoading(true); setErr(''); try { setGlobalFunds(await L.market.getGlobalFunds()); L.refreshRateLimit(); } catch (e) { setErr(apiErrorMessage(e)); setGlobalFunds([]); } finally { setLoading(false); } } useEffect(() => { if (region === 'US' && L.hasKey) loadGlobal(); }, [region, L.hasKey]); async function openFund(f) { if (!f.live || !L.hasKey) { setSel(f); setDetail(null); return; } setSel(f); setDetailBusy(true); try { setDetail(await L.market.getFundDetails(f.symbol)); } catch (e) { setDetail(null); } finally { setDetailBusy(false); } } if (region === 'IN') { return (

Mutual Funds

setRegion('US')}>View US funds} />
); } if (loading && !funds.length) return ; if (!L.hasKey) { return (

Mutual Funds

Connect API} />
); } if (!funds.length) { return Retry} />; } let rows = cat === 'All' ? funds : funds.filter((f) => f.category === cat); rows = [...rows].sort((a, b) => (b[sort] || b.nav || 0) - (a[sort] || a.nav || 0)); return (

Mutual Funds

{region === 'US' && }
US ETFs & mutual funds · Finnhub profile, holdings & sector data
{region === 'US' && }
{err &&
{err}
}
{categories.map((c) => ( ))}
{region === 'IN' && <>} {rows.map((f) => ( openFund(f)} style={{ cursor: region === 'US' ? 'pointer' : 'default' }}> {region === 'IN' && <>} ))}
FundCategory{region === 'US' ? 'Price ($)' : 'NAV (₹)'}1D1Y3YAUMExpense{region === 'IN' ? 'Rating' : 'Risk'}
{f.initials}
{f.name}
{f.house}{f.symbol ? ' · ' + f.symbol : ''}
{f.category} {region === 'US' ? '$' : '₹'}{fmt.price(f.nav)} {f.aum != null ? (region === 'US' ? '$' + (f.aum >= 1e9 ? (f.aum / 1e9).toFixed(1) + 'B' : (f.aum / 1e6).toFixed(0) + 'M') : f.aum.toLocaleString('en-IN')) : '—'} {f.expense != null ? f.expense + '%' : '—'} {region === 'IN' ? (f.rating ? '★'.repeat(f.rating) : '—') : (f.risk || '—')}
{sel && region === 'US' && (

{sel.name} ({sel.symbol})

{sel.description &&

{sel.description}

} {detailBusy ?
Loading holdings…
: detail ? (
Holdings{detail.totalHoldings ? ` (${detail.totalHoldings})` : ''}
{detail.holdings.length ? detail.holdings.map((h) => (
{h.name} {h.percent != null ? h.percent.toFixed(2) + '%' : '—'}
)) :
No holdings data
}
Sector exposure
{detail.sectors.length ? detail.sectors.map((s) => (
{s.name} {s.pct != null ? (+s.pct).toFixed(1) + '%' : '—'}
)) :
No sector data
}
) :
Holdings unavailable for this symbol.
}
)}
); } Object.assign(window, { FundsScreen });