// AVANT MARKETS — Mi Portafolio screen // Donut chart for sector distribution function Donut({ slices }) { // slices: [{ pct, color }] const r = 60; const cx = 80, cy = 80; const circ = 2 * Math.PI * r; let offset = 0; return ( ); } function Sparkline({ values, positive }) { const d = sparkPath(values); return ( ); } function Portfolio({ onOpenTicker }) { const data = buildPortfolio(); // Sector distribution const sectorMap = {}; data.holdings.forEach(h => { const s = h.info.sector; sectorMap[s] = (sectorMap[s] || 0) + h.value; }); const sectorTotal = Object.values(sectorMap).reduce((a, b) => a + b, 0); const sectorColors = ["#c8ff1f", "#2bd8e6", "#9b5cff", "#ff8a3d", "#ff4d7a", "#5cffaa", "#ffd84d"]; const sectors = Object.entries(sectorMap) .map(([name, v], i) => ({ name, pct: (v / sectorTotal) * 100, color: sectorColors[i % sectorColors.length] })) .sort((a, b) => b.pct - a.pct); // Top movers across the market (all tickers) const movers = Object.values(TICKERS) .slice() .sort((a, b) => Math.abs(b.changePct) - Math.abs(a.changePct)) .slice(0, 6); return (
| Activo | Cantidad | Precio prom. | Precio actual | Valor | G/P total | Hoy | Peso | 7D |
|---|---|---|---|---|---|---|---|---|
|
{h.ticker.slice(0, 2)}
{h.ticker}
{h.info.name}
|
{h.qty} | {fmtMoney(h.avgCost)} | {fmtMoney(h.info.price)} | {fmtMoney(h.value)} | {fmtSigned(h.pl, 0)} ({fmtPct(h.plPct, 1)}) | {fmtPct(h.info.changePct)} | {h.weight.toFixed(1).replace(".", ",")}% |
|