bzhmacro.com

Macro analysis,
that springs to mind

Electoral models, macro-economic replications, and fixed-income trade structuring tools.

01

Elections

5 projects

A constituency-level electoral dashboard covering Germany's Bundestag and all 16 Landtage, built on the shared elections-core engine behind the UK, French and Italian sister sites. From the 299 Wahlkreise of the 2025 federal election (Bundeswahlleiterin open data) it runs a Sainte-Laguë seat projection off a live dawum.de poll-of-polls, and extends to per-Land detail, a Wahlkreis explorer with SVG choropleth and KNN statistical twins over Strukturdaten, all in a bilingual DE/EN interface. Beyond the vote it models the machinery of German federalism — a Bundeshaushalt 2026 budget builder with the reformed Schuldenbremse rule engine and Sondervermögen, Art. 106 tax splits and the Finanzkraftausgleich, and asylum distribution by Königsteiner Schlüssel.

Bundestag + 16 Landtage 299 Wahlkreise Sainte-Laguë projection dawum.de poll DB Schuldenbremse budget builder static · Vercel
  • Federal polls + Sainte-Laguë seat projection (BTW 2025)
  • State Elections hub — all 16 Landtage & Bundesrat stakes
  • Wahlkreis explorer: SVG choropleth + KNN statistical twins
  • Budget Builder: Bundeshaushalt 2026, Schuldenbremse & Sondervermögen
  • Federalism: Art. 106 tax splits, Finanzkraftausgleich, Bundesrat
  • Migration by Königsteiner Schlüssel · bilingual DE/EN

A voter-transition model and 2027 presidential forecast built from commune-level results across France's major national elections (2017–2024). The core is a transition probability matrix estimated by ecological inference — mapping how voters flow between political families across consecutive elections — combined with live Wikipedia poll data to project both rounds of the 2027 presidential election as a Sankey diagram.

~35,000 communes ecological inference 8 political families 2027 forecast data.gouv.fr static · Vercel
  • Live 2027 polling tracker (Wikipedia-sourced)
  • R1 → R2 Sankey vote-flow diagram
  • Transition matrix heatmap
  • Backtest panel (2017 & 2022 hindcasts)
  • Socio-electoral analysis: NMF archetypes, UMAP, spatial regressions
  • Interactive territorial k-NN map

A ward-level electoral analysis pipeline and interactive dashboard covering UK General Elections (2015–2024) and local council elections (2016–2026). Built from roughly 8,000 wards across England, Scotland, and Wales, it combines ONS 2021 Census demographics, the Index of Multiple Deprivation, and multi-cycle vote share data to explain and project electoral outcomes at the most granular level available.

ward-level · ~8,000 wards KNN similarity census + IMD 7-bloc taxonomy static · Vercel Python pipeline
  • Vote-flow Sankey & editable transition matrix
  • Live polling tracker for the next GE
  • Local & General results explorer (2015–2026)
  • Ward similarity lookup powered by KNN
  • Choropleth demographic map
  • Fully browser-based, no server required

A comune-level electoral analysis pipeline and dashboard for Italy's Camera & Senato general elections (2013, 2018, 2022), mirroring the UK ward-level project across roughly 7,900 comuni. At its core is a Rosatellum mixed-member seat simulator — ~37% FPTP collegi uninominali plus ~61% largest-remainder PR plurinominali — that reproduces the 2022 Parliament within a few seats per coalition and projects a live seat distribution from coalition vote shares via uniform national swing. Comune features combine ISTAT census, density and IVSM deprivation to drive a feature-space KNN and spatial-neighbour lookup, and a Wikipedia-sourced poll-of-polls refreshes server-side on the deployed site.

~7,900 comuni Camera + Senato Rosatellum simulator 2013 · 2018 · 2022 ISTAT + IVSM static · Vercel
  • Rosatellum seat engine: FPTP collegi + largest-remainder PR
  • Reproduces 2022 Parliament; live projection from vote shares
  • Three elections × two chambers (2013–2022)
  • Comune similarity lookup powered by KNN
  • Live poll-of-polls tracker (Wikipedia-sourced)
  • Census, density & IVSM deprivation enrichment

A reproducible replication of the Borghesi–Raynal–Bouchaud (2012, PLoS ONE) diffusive-field model of election turnout, restricted to France and extended to 56 elections (1999–2026). The paper's claim: a commune's logarithmic turnout rate behaves like a physical field — an idiosyncratic part, a city-specific part, and a slow cultural field that diffuses between neighbours (correlation length ℓc ≈ 4.5 km) — producing the observed logarithmic decay of spatial turnout correlations. Over ~34,700 mainland communes the dashboard rebuilds every observable from open data (Ministère de l'Intérieur results + commune centroids) and checks it against the authors' numbers. A country-agnostic engine also wires in Italy, which independently reproduces its opposite-signed (negative) skewness and a clean North–South gradient.

Borghesi–Bouchaud field model 56 elections · 1999–2026 ~34,700 communes C(r) ~ −ln r ℓc ≈ 4.5 km diffusion static · Vercel
  • Size-detrended log-turnout field map (~34,700 communes)
  • Rescaled distribution P(u) vs a Gaussian
  • Size dependence m_N, σ_N by commune size
  • Spatial correlation C(r) + log fit + diffusive-field overlay
  • Cultural-field extraction β²σ_φ² & validation vs the paper
  • Country selector: France + Italy (opposite-signed skew)
02

Economy

6 projects

Two reproducible agent-based models of inflation in one browser app. Mark-0 is a faithful replication of Knicker, Naumann-Woleske, Bouchaud & Zamponi (2025) on post-COVID inflation — ~10,000 firms plus a household sector hit by calibrated demand, supply-chain and energy shocks — and reproduces the paper's central results, including anchored-CB peak inflation (8.8% paper vs 8.9% model) and the monetary-policy dilemma. firmnet reconstructs the UK firm-to-firm production network from public ONS data (104 CPA sectors, 2.73M firms, 0% lost), ranks systemically-critical sectors, and runs a stock-flow-consistent whole-economy ABM with credit and firm default. Both engines recompute live in the browser as parity-tested JS twins of the Python code.

Mark-0 replication ~10,000 firms + households UK network · 2.73M firms stock-flow-consistent ABM parity-tested JS twin static · Vercel
  • Post-COVID inflation: demand, supply & energy shocks
  • Monetary-policy dilemma: anchoring vs the rate level
  • UK production network rebuilt from ONS I-O + Business Counts
  • Systemic-risk (ESRI) ranking of critical sectors
  • Network ABM: energy shock → stagflation, demand → recession
  • Live in-browser recompute, parity-tested against Python

A live dashboard for water levels on Germany's federal waterways — Rhine, Elbe, Danube, Main, Mosel, Weser, Neckar and more — reading straight from PEGELONLINE, the open REST API of the Waterways and Shipping Administration (WSV), across ~660 gauges with no API key. Each gauge shows its current level colour-coded by status, a history chart (24h–31d) with the German characteristic reference marks (MW, MHW/MNW, GlW, HSW) and a dashed forecast overlay when PEGELONLINE publishes one. A one-click freight filter isolates the gauges that govern barge loading depth on the free-flowing rivers — with Kaub, the Rhine's binding bottleneck, carrying its draught thresholds (~full load at 250 cm, freight halts below ~40). A daily GitHub Action grows a seasonal archive so each gauge's year reads against its historical min–max / 10–90% / median spread.

~660 WSV gauges PEGELONLINE REST API freight · barge-draft MW · MHW · MNW · GlW seasonal bands static · Vercel
  • Live level per gauge, colour-coded low / normal / high / very high
  • History chart (24h–31d) with characteristic reference marks
  • Dashed forecast overlay when a WV series is published
  • Map view with ⚓ freight gauges highlighted
  • Freight filter + Kaub loading-depth draught thresholds
  • Seasonal mode vs multi-year daily spread (daily GitHub Action)

An interactive dashboard over the ONS CPI & RPI item indices and price quotes — the ~700 narrowly defined products beneath the UK CPI — with a heavy focus on time series, seasonality and calendar effects (bank holidays, Easter drift, school holidays, royal events, duty/cap changes, sales windows). Overlay up to 5 of 860+ chained item series on levels / 12-month % / m-o-m, rank seasonal amplitudes, and run event studies that flag abnormal month-on-month movers around curated events with confound warnings. A price-quotes view profiles the ~94k raw monthly quotes (n, p10/median/p90, CV, region × shop-type), and a replication playbook documents how to rebuild the ONS collection from scrapeable, API, vendor and open-data sources. Built as a static Vite/React site over ~1.4 MB of committed JSON, with a 254-file source manifest carrying SHA-256 checksums.

860+ item series ~700 CPI products seasonality + event studies ~94k price quotes OGL v3.0 · ONS Vite · React · Vercel
  • Item explorer: overlay up to 5 series, levels / YoY / m-o-m
  • Seasonality profiles, amplitude ranking & heatmap
  • Curated event calendar (royal, policy, sales, COVID)
  • Event studies: abnormal movers with confound warnings
  • Price-quote distributions by region × shop-type
  • Replication playbook + 254-file SHA-256 source manifest

Two from-scratch replications of the San Francisco Fed's inflation research in one browser app, switchable by a top-level Model toggle. The Momentum Index reproduces the Inflation Shock Momentum (ISM) index of Lansing & Shapiro (2026, FRBSF WP 2026-10): a 120-month rolling AR(1) benchmark per PCE category, a category counted as positive (or negative) momentum when its last k residuals all surprise the same way, aggregated to the expenditure-weighted net share S⁺ − S⁻ — correlating ~0.99 with the authors' series. The Supply/Demand page replicates Shapiro (2024, FRBSF WP 2022-18): a rolling reduced-form VAR of each category's price and quantity signs every category-month as demand- or supply-driven, aggregating to the supply- and demand-driven contributions to headline and core PCE inflation — and the same estimator ports to Canada, the UK, France, Germany and Japan via national-accounts data.

ISM momentum + supply/demand ~130 PCE categories rolling AR(1) & price-quantity VAR FRBSF WP 2026-10 · 2022-18 CA · UK · FR · DE · JP ports static · Vercel
  • Model toggle: Momentum Index ⇄ Supply/Demand decomposition
  • Momentum: expenditure-weighted runs S⁺ − S⁻ (~0.99 correlation)
  • Decomp: price-quantity VAR → demand- vs supply-driven inflation
  • Headline & core PCE, incl. FRBSF precision-cut "ambiguous" variant
  • Country ports: Canada, UK, France, Germany, Japan
  • Parity-tested browser twins · CSV export · local-projection tests

A storage, LNG and pipeline-flow monitor for Europe with seasonality analysis, refill feasibility and cold-winter stress tests — built in the wake of the 2026 Strait of Hormuz closure that took Qatari LNG (~12–14% of Europe's supply) off the market. It tracks each country's storage fill against full seasonal bands (min–max / 10–90% / median since 2011), models demand as an OLS of daily net withdrawal on heating degree-days, and projects storage through winter under preset severities (mild → 1-in-20, a strong-El Niño cold tilt), configurable cold snaps, Hormuz LNG cuts and arbitrary supply shocks — with an 80% band from model residuals. A Leaflet map plots every major LNG terminal, pipeline entry and interconnector with live flow/storage popups, and an external-corridor view (Norway, North Africa, TurkStream, TAP) marks the Hormuz closure. Built entirely from public data (GIE AGSI+/ALSI, ENTSOG, National Gas UK, Open-Meteo ERA5) with a daily GitHub Action refresh.

storage · LNG · pipeline flows seasonal bands since 2011 HDD demand · winter stress test Hormuz / El Niño scenarios GIE · ENTSOG · Open-Meteo static · Vercel
  • EU overview: fill %, seasonal deviation, projected 1 Nov & cold-winter min
  • Per-country storage vs full seasonal bands (min–max / 10–90% / median)
  • Winter stress test: preset severities, cold snaps, Hormuz cuts, shocks
  • Refill feasibility: required vs historical injection pace, ETAs
  • Leaflet map of LNG terminals, pipeline entries & interconnectors
  • External corridors (Norway, N. Africa, TurkStream, TAP) · daily refresh

A near-real-time monitor of China's external surplus and its spillovers, rebuilt from primary statistical sources to answer one standing question: is the imbalance still building, and where would it first turn? The analytical frame is Brad Setser's (CFR) — his charts, transforms and thresholds — but nothing is scraped from his figures: every series is fetched from the original agency and recomputed, reproducing his published numbers independently (a $1,183bn 2025 customs goods surplus, a $735.0bn current account ≈ 6.0% of GDP, a real yuan ~13.6% below trend). At its centre is a 0–100 pressure index across four blocks — surplus momentum, FX & capital-flow pressure, domestic demand & deflation, spillover & retaliation risk — scored as percentiles of each component's own history (not z-scores, which explode on trending levels), with a momentum reading beside it telling you which way things are moving. It adds 13 named trigger rules, each a single threshold encoding a specific Setser claim shown with its full firing history since 2015, and 38 charts reproducing his library. Proxies are labelled as proxies in the chart caption, and a daily GitHub Action refreshes the whole thing, failing loudly if a surplus- or FX-block fetch breaks.

Setser imbalance frame 0–100 pressure index 13 trigger rules · 38 charts percentile scoring GACC · SAFE · PBOC · BIS · Comtrade static · daily GitHub Action
  • Composite pressure index (0–100) + momentum across four blocks
  • 13 named trigger rules, each with firing history since 2015
  • 38 charts reproducing Setser's library, his transforms
  • Every series recomputed from the primary agency, validated to print
  • Percentile scoring so trending & mean-reverting series compare
  • Proxies labelled in-caption · daily refresh, fails loudly on outage
03

Trading

5 projects

A decision-support toolkit for structuring and sizing directional macro trades across three instruments: EUR interest-rate swaptions, EUR yield-curve spread strategies, and EUR/USD spot options. For a given directional view and risk budget, each module recommends an appropriate option structure, overlays the market-implied risk-neutral density against the user's subjective distribution, computes carry and vol risk premium, and sizes the position. All modules run fully in the browser against historical data panels going back to 2017.

swaption cube · 2017–present Breeden-Litzenberger Bachelier / Garman-Kohlhagen fractional Kelly sizing browser-only

A data pipeline, point-in-time forecasting engine and dashboard for the supply of UK government bonds — what has been issued, what was planned at any past moment, what is estimated to come, and the relative-value picture around it. Built entirely from public sources (DMO, HM Treasury, OBR, ONS, Bank of England), it stores remits and quarterly calendars as they stood at each announcement, so any historical as-of date reconstructs the remit in force, the issuance already done, and a pattern-based estimate of the residual programme.

issuance since 1981 point-in-time remits NSS curve fit weekly notional · DV01 DMO · OBR · ONS · BoE FastAPI · Vercel
  • As-of forecast slider: remit, done & residual by bucket
  • Forward timeline blending announced ops with estimates
  • Weekly supply & cashflow (issuance, QT, redemptions, coupons)
  • Interactive curve — yield/asset-swap × maturity/duration
  • Rich/cheap residuals & constant-maturity history
  • Auditable: source registry with per-file SHA-256 lineage

A scenario engine for how the EU Solvency II Review (in force 30 January 2027) reshapes euro-area insurer hedging demand at the long end of the curve. It pairs an EIOPA-validated discount-curve sandbox — the current Smith-Wilson extrapolation against the new alternative method, reproducing EIOPA's published numbers to ≤ 0.05 bp — with an adjustable flow model that turns the extrapolation change into a structural EUR ultra-long receiving / 20s50s flattener and a cash-over-swaps swap-spread tilt, sized bottom-up from a public-disclosure insurer dataset.

in force 30 Jan 2027 Smith-Wilson vs alt. extrapolation EIOPA-validated ≤ 0.05 bp 20s50s flattener · ~€201bn 40-group insurer dataset static · Vercel
  • Editable EUR discount-curve sandbox (current vs new)
  • Live α-taper 20s/50s flattening flow model
  • Cash-vs-CSSR swap-spread tilt module
  • Bottom-up sizing across the €5.2tn life market
  • Reproducible EIOPA curve pipeline (Python)
  • Transparent method & formulas — every input a slider

A self-refreshing tracker for every note issued under Single Platform Investment Repackaging Entity SA (SPIRE SA, LEI 635400AXHEAFQKFFNO47), built entirely from free public data. It lists each note (ISIN, FIGI, currency, notional, coupon, maturity, venue), flags its lifecycle status — outstanding, matured or redeemed early — and estimates the underlying government bond by maturity-matching each series against a sovereign repository (US, UK and ten Eurozone issuers). A daily GitHub Action regenerates the data and Vercel redeploys, so the notes and the sovereign repository stay current, with a freshness badge on the page.

SPIRE SA repacks ESMA FIRDS · TreasuryDirect OpenFIGI · spiresa.com underlying estimate daily refresh · no paid data static · Vercel
  • Full note list: ISIN, FIGI, currency, notional, coupon, maturity, venue
  • Lifecycle status — outstanding / matured / redeemed early
  • Estimated underlying sovereign via maturity-matching heuristic
  • Programme documents: base prospectuses, supplements, financials
  • Freshness badge (green ≤36h, orange ≤8d, red beyond)
  • Daily GitHub Action refresh — notes & sovereign repo, free sources only

A position-by-position rebuild of Japan's Government Pension Investment Fund — the world's largest pension fund, ¥293.6tn at FY2025-end — from its once-a-year full-holdings disclosures (保有全銘柄, FY2014→FY2025, ~183k security lines). The bond book's 15,154 ISINs are resolved to coupon, maturity and JGB issue number via an OpenFIGI join (10,536 ISINs mapped, 36 misses), and a par-assumption risk engine estimates per-line modified duration and DV01 — ¥105.7bn per basis point at FY2025-end, ≈¥1.06tn per 10bp move, covering 99.2% of domestic and 100% of foreign market value. Dashboards track twenty years of allocation against the policy portfolio and its three regime changes (Oct 2014, Apr 2020, Apr 2025), duration drift (domestic 9.5y → 8.6y, foreign 7.9y → 6.6y since FY2019), and country × maturity DV01 heatmaps. Security-level bond & equity explorers add per-issue ownership vs amount outstanding — MOF for JGBs, Treasury MSPD for USTs — and set the ¥71.0tn foreign equity sleeve against MSCI ACWI ex-Japan weights.

¥293.6tn AUM · FY2025-end 15,154 bond ISINs OpenFIGI security master DV01 ¥105.7bn per bp MOF · MSPD ownership joins static · Vercel
  • Allocation vs policy portfolio, FY2006→FY2025 — three regime changes
  • Country × maturity DV01 heatmap, incl. the JGB book via OpenFIGI
  • Duration & DV01 time series, FY2019→FY2025
  • Bond explorer: filters, heatmap drill-down, ownership column, CSV export
  • Equity explorer vs MSCI ACWI ex-Japan — country, sector, top-10
  • Per-issue ownership vs outstanding (MOF JGBs, Treasury MSPD USTs)