← Back to live globe
UC21 · Financial Globe

Stock Market & Financial Globe

GDP choropleth by country (World Bank), live FX exchange rates (Frankfurter/ECB), stock exchange markers, and animated capital-flow arcs — all rendered on an interactive WebGL globe powered by globe.gl and Three.js.

180+

Countries with GDP data

30+

Currencies tracked

12

Stock exchanges mapped

12

Capital flow pairs

NY.GDP.MKTP.CD

World Bank indicator

1 hr

FX rate refresh

$94T+

Total market cap tracked

World Bank

GDP data freshness

Data Pipeline

🏦
01

World Bank GDP API

The World Bank Open Data API exposes macroeconomic indicators for every country without an API key. The NY.GDP.MKTP.CD indicator (GDP at market prices, current USD) is fetched with mrv=1 to retrieve only the most recent value per country — typically one or two years old due to national statistics lag. The response covers ~180 economies including small island states and territories.

World Bank Open Data APIIndicator: NY.GDP.MKTP.CDper_page=300, mrv=1No API key requiredFree, no rate limit
💱
02

Frankfurter FX Rates

Frankfurter is a free, open-source exchange rate API maintained by Apilayer. It serves data from the European Central Bank (ECB) reference rates, updated daily on business days. The /v2/rates endpoint returns ~30 major currencies priced in a base currency — here USD. Rates for EUR/USD, GBP/USD, USD/JPY, USD/CNY, and AUD/USD are displayed in the sidebar with conventional quote direction.

Frankfurter API (ECB data)Base: USD30+ currency pairsDaily ECB updateNo API key required
🌍
03

GDP Choropleth — globe.gl Polygons

Country outlines come from the Natural Earth 110m dataset via the world-atlas npm package (TopoJSON format). topojson-client converts them to GeoJSON features at runtime. Each polygon's cap colour is computed via a logarithmic scale mapping raw GDP (in USD) to an amber/gold gradient — log scale prevents the USA/China from swamping every other country. Polygons are rendered with globe.gl's native polygonsData() API at 0.5% altitude above the surface.

world-atlas@2 (Natural Earth 110m)topojson-client GeoJSON conversionglobe.gl polygonsData()Log-scale choroplethISO A2/A3 join to World Bank data
📍
04

Stock Exchange Markers

Twelve major global stock exchanges are stored as static GeoJSON-style objects with precise lat/lng coordinates, index name, indicative index value, and estimated market cap. They are rendered as gold-coloured points at a slight altitude (0.015) using globe.gl's pointsData() API. Clicking a marker shows a detail panel with the exchange name, city, country, headline index, and total market capitalisation.

Static GeoJSON point dataglobe.gl pointsData()12 exchanges (NYSE, NASDAQ, LSE, TSE, SSE, HKEX, NSE, ASX, TSX, Euronext, Xetra, DFM)Click-to-detail panelPer-exchange accent colours
05

Animated Capital Flow Arcs

Twelve major cross-border capital flow corridors are visualised as dashed animated arcs using globe.gl's arcsData() API. The arc paths are great-circle routes between source and destination financial hubs, rendered at 0.3 altitude (30% of globe radius) to arc cleanly above the surface. Each arc animates with a 2.5-second loop, colour-coded by source region. Flow values (USD billions) are indicative estimates based on BIS and IMF cross-border statistics.

globe.gl arcsData()arcDashAnimateTime: 2500msGreat-circle arc paths0.3 altitude arcing12 corridors (USA↔UK, China↔HK, Japan↔USA, etc.)Indicative BIS/IMF flow estimates
🔄
06

Next.js API Route — Server-side Aggregation

A single Next.js Route Handler at /api/financial-data fetches GDP and FX in parallel via Promise.allSettled(), so a failure in one upstream API does not block the response. The route uses Next.js ISR revalidation (revalidate=3600) so the server only hits the upstream APIs once per hour — all page loads within that window get the cached response instantly. The static exchange and flow data is embedded in the route file and returned verbatim.

Next.js Route HandlerPromise.allSettled() parallel fetchISR revalidate=3600Cache-Control: max-age=3600, stale-while-revalidate=7200Graceful partial fallback on API failure

Design Notes

Why a log scale for GDP?

The US GDP (~$27T) is roughly 300× the GDP of small economies (~$100M). A linear colour scale would render almost every country identically dark. A log₁₀ scale compresses the range so that the gradient usefully distinguishes low-income, middle-income, and high-income economies while still making the USA and China visibly brighter.

No Alpha Vantage required

Alpha Vantage's free tier is limited to 25 requests/day — far too restrictive for a live globe. Rather than gating the entire page behind an API key, the stock index values are stored as indicative figures alongside the exchange metadata. These represent end-2024 levels and are clearly labelled 'indicative' in the UI. The FX rates from Frankfurter are genuinely live (ECB daily rates).

Capital flow data sources

The capital flow arcs use indicative annual values derived from BIS Locational Banking Statistics and IMF Balance of Payments data. They represent the approximate scale of cross-border portfolio and banking flows between major financial centres. The animation direction follows net-flow direction for the dominant flow in each corridor.

Globe performance

globe.gl is dynamically imported (no SSR) to prevent Three.js from being included in the server bundle. The choropleth polygon join happens client-side: country ISO codes from world-atlas are matched against World Bank ISO A2/A3 codes. The topojson-client conversion and polygon rendering are deferred until after the globe canvas mounts, keeping the initial page paint fast.

Tech Stack

🌐

Globe renderer

globe.gl + Three.js WebGL

🌍

Earth texture

NASA Blue Marble Night (unpkg CDN)

📊

GDP data

World Bank Open Data (NY.GDP.MKTP.CD)

💱

FX data

Frankfurter API (ECB reference rates)

📐

Country geometry

Natural Earth 110m via world-atlas + topojson-client

🗺

Choropleth scale

Log-scale amber/gold gradient (low → high GDP)

Arcs

globe.gl arcsData — animated dashed great-circle arcs

📍

Exchange markers

globe.gl pointsData — 12 exchanges with click detail

🔄

Cache strategy

Next.js ISR 1 hr + CDN stale-while-revalidate 2 hr

📐

Framework

Next.js App Router — dynamic import (no SSR)

Data Attribution

  • World Bank Open Data: GDP at market prices (NY.GDP.MKTP.CD). Free API, no key required. Data typically lags 1–2 years due to national statistics collection cycles.
  • Frankfurter / European Central Bank: Official ECB reference exchange rates published on business days. Free, no registration. Rates used: EUR, GBP, JPY, CNY, CAD, AUD vs USD.
  • Natural Earth / world-atlas: Country boundary polygons at 110m resolution. Public domain. Served as TopoJSON and converted client-side via topojson-client.
  • Stock exchange data: Index values and market cap figures are indicative estimates as of end-2024. Not sourced from a live feed. Clearly labelled in the UI.
  • Capital flow data: Annual cross-border flow values are indicative, derived from BIS Locational Banking Statistics and IMF BOP data. For visualisation purposes only.