A React dashboard for the Vanguard FTSE All-World UCITS ETF (VWRA):
- Country composition — top 20 markets by weight (hardcoded from the latest factsheet) plus a "Rest of World" bucket.
- 1-year contribution — for any past trading day, shows each country's contribution to VWRA's 1-year return. Toggle between weighted and raw views.
npm install
npm run devOpen the URL printed by Vite (default http://localhost:5173).
No API key needed — all data comes from Yahoo Finance (proxied through Vite to avoid CORS).
npm run dev— start the Vite dev servernpm run build— type-check and build for productionnpm test— run the unit test suite (Vitest)
For a selected past date D:
- Fetch adjusted daily close prices for
D-370throughDfrom Yahoo Finance for VWRA and each top-20 country ETF (VTI, EWJ, EWU, …). - Find the nearest trading day
PtoD-365. - For each country:
rawReturn = adjclose[D] / adjclose[P] - 1,weightedContribution = weight × rawReturn. RoW = vwraReturn - sum(weightedContributions)— absorbs the ~3.6% of VWRA in countries 21+ plus proxy/timing mismatches.
Adjusted close handles dividends and splits, so the 1-year returns reflect total return.
src/
├── App.tsx
├── main.tsx
├── styles.css
├── data/composition.ts # hardcoded VWRA top-20 + ETF symbols
├── api/yahooFinance.ts # Yahoo Finance chart client (adjclose)
├── hooks/useDailyReturns.ts # date → returns state machine
├── lib/
│ ├── computeReturns.ts # pure return math
│ ├── cache.ts # localStorage (symbol, date) → close
│ └── dates.ts # date helpers
└── components/
├── Header.tsx
├── CompositionChart.tsx
└── ContributionChart.tsx