diff --git a/dashboard/inject.mjs b/dashboard/inject.mjs index 962da19..1b067a7 100644 --- a/dashboard/inject.mjs +++ b/dashboard/inject.mjs @@ -571,6 +571,19 @@ export async function synthesize(data) { timestamp: yfData.summary?.timestamp || null, }; + const yfGold = yfQuotes['GC=F']; + const yfSilver = yfQuotes['SI=F']; + const metals = { + gold: yfGold?.price, + goldChange: yfGold?.change, + goldChangePct: yfGold?.changePct, + goldRecent: yfGold?.history?.map(h => h.close) || [], + silver: yfSilver?.price, + silverChange: yfSilver?.change, + silverChangePct: yfSilver?.changePct, + silverRecent: yfSilver?.history?.map(h => h.close) || [], + }; + // Override stale EIA prices with live Yahoo Finance data if available const yfWti = yfQuotes['CL=F']; const yfBrent = yfQuotes['BZ=F']; @@ -595,7 +608,7 @@ export async function synthesize(data) { }, sdr: { total: sdrNet.totalReceivers || 0, online: sdrNet.online || 0, zones: sdrZones }, tg: { posts: tgData.totalPosts || 0, urgent: tgUrgent, topPosts: tgTop }, - who, fred, energy, bls, treasury, gscpi, defense, noaa, epa, acled, gdelt, space, health, news, + who, fred, energy, metals, bls, treasury, gscpi, defense, noaa, epa, acled, gdelt, space, health, news, markets, // Live Yahoo Finance market data ideas: [], ideasSource: 'disabled', // newsFeed for ticker (merged RSS + GDELT + Telegram) diff --git a/dashboard/public/jarvis.html b/dashboard/public/jarvis.html index 0be7865..1d94c98 100644 --- a/dashboard/public/jarvis.html +++ b/dashboard/public/jarvis.html @@ -1344,6 +1344,7 @@ const payrolls=D.bls.find(b=>b.id==='CES0000000001'); const gscpi=D.gscpi; const mkt=D.markets||{}; + const metals=D.metals||{}; const wtiH = D.energy.wtiRecent||[]; const wtiMax=Math.max(...wtiH),wtiMin=Math.min(...wtiH); @@ -1365,11 +1366,15 @@ const vixFred = D.fred.find(f=>f.id==='VIXCLS'); const vixVal = vixLive?.value || vixFred?.value; const vixChg = vixLive?.changePct != null ? `${vixLive.changePct>=0?'+':''}${vixLive.changePct}%` : ''; + const fmtMarketPrice = (price) => price != null ? `$${price.toLocaleString(undefined,{maximumFractionDigits:2})}` : '--'; + const dayMove = (pct) => pct != null ? `${pct>=0?'+':''}${pct}% today` : ''; const metrics=[ {l:'WTI Crude',v:`$${D.energy.wti}`,s:'$/bbl',p:70}, {l:'Brent',v:`$${D.energy.brent}`,s:'$/bbl',p:75}, {l:'Nat Gas',v:`$${D.energy.natgas||'--'}`,s:'$/MMBtu',p:30}, + {l:'Gold',v:fmtMarketPrice(metals.gold),s:dayMove(metals.goldChangePct)||'COMEX proxy',p:58}, + {l:'Silver',v:fmtMarketPrice(metals.silver),s:dayMove(metals.silverChangePct)||'COMEX proxy',p:54}, {l:'VIX',v:vixVal?vixVal.toFixed(1):'--',s:vixChg||'volatility index',p:vixVal?Math.min(vixVal*2.5,100):30}, {l:'Fed Funds',v:ff?`${ff.value}%`:'--',s:ff?.date||'',p:36}, {l:'GSCPI',v:gscpi?gscpi.value.toFixed(2):'--',s:gscpi?.interpretation||'',p:49}, @@ -1383,6 +1388,8 @@ return f?.recent?.length > 1 ? {spark: f.recent, sparkUp: up} : {}; }; metrics[0] = {...metrics[0], spark: D.energy.wtiRecent, sparkUp: false}; + metrics[3] = {...metrics[3], spark: metals.goldRecent, sparkUp: (metals.goldChangePct ?? 0) >= 0}; + metrics[4] = {...metrics[4], spark: metals.silverRecent, sparkUp: (metals.silverChangePct ?? 0) >= 0}; // Build live market cards from Yahoo Finance const indexCards = (mkt.indexes||[]).map(mktCard).join(''); @@ -1456,7 +1463,7 @@