feat(commodity): gold layer enhancements#2464
Conversation
Enrich the commodity variant with learnings from Yazan-Abuawwad/gold-monitor fork: - Add 10 missing gold mines to MINING_SITES: Muruntau (world's largest open-pit gold mine), Kibali (DRC), Sukhoi Log (Russia, development), Ahafo (Ghana), Loulo-Gounkoto (Mali), South Deep (SA), Kumtor (Kyrgyzstan), Yanacocha (Peru), Cerro Negro (Argentina), Tropicana (Australia). Covers ~40% of top-20 global mines previously absent. - Add XAUUSD=X spot gold and 9 FX pairs (EUR, GBP, JPY, CNY, INR, AUD, CHF, CAD, TRY) to shared/commodities.json. All =X symbols auto-seeded via existing seedCommodityQuotes() — no new seeder needed. Registered in YAHOO_ONLY_SYMBOLS in both _shared.ts and ais-relay.cjs. - Add XAU/FX tab to CommoditiesPanel showing gold priced in 10 currencies. Computed live from GC=F * FX rates. Commodity variant only. - Fix InsightsPanel brief title: commodity variant now shows "⛏️ COMMODITY BRIEF" instead of "🌍 WORLD BRIEF". - Route commodity variant daily market brief to commodity feed categories (commodity-news, gold-silver, mining-news, energy, critical-minerals) via new newsCategories option on BuildDailyMarketBriefOptions. - Add Gold Silver Worlds + FX Empire Gold direct RSS feeds to gold-silver panel (9 sources total, up from 7).
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Preview deployment for your docs. Learn more about Mintlify Previews.
|
Greptile SummaryThis PR enriches WorldMonitor's commodity variant with four additive improvements reviewed from the Key observations:
Confidence Score: 5/5Safe to merge — all findings are P2 quality-of-life improvements; no correctness, data-integrity, or security issues introduced. All four feature phases are implemented correctly and fully isolated to the commodity variant. The FX arithmetic, symbol formats, type usage, and seeder wiring are all correct. Two P2 observations remain (unused XAUUSD=X seeding, missing empty-state in XAU grid), but neither constitutes a present defect that affects users. src/components/MarketPanel.ts and scripts/shared/commodities.json — the unused XAUUSD=X symbol and missing empty-state for the XAU grid are worth a follow-up, but neither blocks merge. Important Files Changed
Sequence DiagramsequenceDiagram
participant Relay as ais-relay.cjs
participant Yahoo as Yahoo Finance
participant Redis as Redis<br/>(market:commodities-bootstrap:v1)
participant DL as DataLoaderManager
participant CP as CommoditiesPanel
participant IP as InsightsPanel
Relay->>Yahoo: fetchYahooQuotesBatch([GC=F, XAUUSD=X, EURUSD=X … 9 FX pairs])
Yahoo-->>Relay: quotes[]
Relay->>Redis: SET market:commodities-bootstrap:v1 (TTL 2h)
DL->>Redis: GET commodityQuotes (hydration)
Redis-->>DL: quotes[] incl. GC=F + FX pairs
DL->>DL: mapCommodity() → adds symbol field
DL->>CP: renderCommodities([{symbol,display,price,…}])
Note over CP: Metals tab: filters out =X symbols<br/>XAU/FX tab: computes XAU_FC = GC=F price × or ÷ FX rate
DL->>IP: buildDailyMarketBrief({ newsCategories: ['commodity-news','gold-silver',…] })
IP->>IP: geoContext = 'You are generating a commodities market brief…'
IP-->>IP: render "⛏️ COMMODITY BRIEF"
Reviews (1): Last reviewed commit: "feat(commodity): add gold layer enhancem..." | Re-trigger Greptile |
| { "symbol": "^VIX", "name": "VIX", "display": "VIX" }, | ||
| { "symbol": "GC=F", "name": "Gold", "display": "GOLD" }, | ||
| { "symbol": "XAUUSD=X", "name": "Gold Spot", "display": "XAU SPOT" }, | ||
| { "symbol": "SI=F", "name": "Silver", "display": "SILVER" }, |
There was a problem hiding this comment.
XAUUSD=X seeded but never rendered
XAUUSD=X is added to both commodities.json files and YAHOO_ONLY_SYMBOLS in _shared.ts, meaning it is fetched every 5-minute seed cycle. However, it is never actually displayed anywhere in the current implementation: _renderXau() in MarketPanel.ts uses GC=F (futures) as the base gold price, and the metals grid explicitly excludes all =X symbols via:
const validData = this._commodityData.filter(
(d) => d.price !== null && !d.symbol?.endsWith('=X'),
);The plan mentions enabling a future "futures vs spot basis spread" display, which is a good motivation — but as shipped, XAUUSD=X consumes one of the ~49 safe Yahoo Finance API slots per cycle with no user-facing benefit. Consider either wiring the spot/futures spread into _renderXau() now, or deferring the symbol addition until it is actually used.
- Fix USDCHF=X multiply direction: was true (wrong), now false (USD/CHF is USD-per-CHF convention) - Fix newsCategories augments BRIEF_NEWS_CATEGORIES instead of replacing (preserves macro/Fed context in commodity brief) - Add goldsilverworlds.com + www.fxempire.com to RSS allowlist (api + shared + scripts/shared) - Rename "Metals" tab label conditionally: commodity variant gets "Metals", others keep "Commodities" - Reset _tab to "commodities" when hasXau becomes false (prevent stale XAU tab re-activation) - Add Number.isFinite() guard in _renderXau() before computing xauPrice - Narrow fxMap filter to =X symbols only - Collapse redundant two-branch number formatter to Math.round().toLocaleString() - Remove XAUUSD=X from shared/commodities.json: seeded but never displayed (saves 150ms/cycle)
…, restore dep overrides
XAU widget uses GC=F as base price, not XAUUSD=X. Symbol was never seeded (not in commodities.json) and never referenced in the UI.
Summary
gold-silverpanel (Gold Silver Worlds + FX Empire Gold)shared/commodities.jsonfor auto-seeding (EURUSD, GBPUSD, USDJPY, USDCNY, USDINR, AUDUSD, USDCHF, USDCAD, USDTRY)CommoditiesPanelshowing live gold price in EUR, GBP, JPY, CNY, INR, AUD, CHF, CAD, TRY (computed from existingGC=F+ the 9 new FX pairs)Motivation
Reviewed
Yazan-Abuawwad/gold-monitorfork (independent Angular/Spring Boot gold layer). Identified 4 concrete gaps vs our commodity variant: missing mines, missing feeds, generic brief title/categories, no cross-currency gold pricing. All changes are additive and commodity-variant-isolated.Gold Standard Compliance
seedCommodityQuotes()5-min cycle=Xforex symbols added toYAHOO_ONLY_SYMBOLSin bothserver/worldmonitor/market/v1/_shared.tsandais-relay.cjsMARKET_SEED_TTL = 7200(2h, 24x the 5-min interval)market:commodities-bootstrap:v1keyTesting
npm run typecheck+npm run typecheck:apicleannpm run test:datapasses (84/84, including bootstrap key parity check)Post-Deploy Monitoring & Validation
[Yahoo] EURUSD=Xetc. on next seed cycle (~5min after deploy)market:commodities-bootstrap:v1should contain 32 symbols vs previous 23=Xsymbols return non-null prices; relay logs show no consecutive failure runsfetchYahooQuotesBatch(). If triggered, FX symbols return null and XAU widget shows--. Rollback: remove FX symbols fromshared/commodities.jsonSITE_VARIANT === 'commodity'guardedPlan
docs/plans/2026-03-29-001-feat-gold-layer-commodity-variant-plan.md🤖 Generated with Claude Sonnet 4.6 via Claude Code (https://claude.ai/claude-code) + Compound Engineering v2.40.0
Co-Authored-By: Claude Sonnet 4.6 noreply@anthropic.com