Harry Markowitz's insight (1952): a portfolio's risk is not the average of its parts — when assets barely move together, blending them cancels risk out. This study applies that lens to two real ICE commodities and locates the mix that minimizes risk. It runs on a pipeline built end to end for the study, which reruns after every market close.
| date | coffee (KC) | Δ | cotton (CT) | Δ |
|---|---|---|---|---|
| 2026-10-06 | 303.20 | +3.64% | 80.92 | +4.91% |
| 2026-10-05 | 292.55 | +1.32% | 77.13 | +2.63% |
| 2026-10-02 | 288.75 | +0.17% | 75.15 | +1.51% |
| 2026-10-01 | 288.25 | -0.84% | 74.03 | -1.02% |
| 2026-09-30 | 290.70 | +0.43% | 74.79 | -5.40% |
| 2026-09-29 | 289.45 | +0.24% | 79.06 | +0.19% |
| 2026-09-28 | 288.75 | +3.64% | 78.91 | -0.75% |
| 2026-09-25 | 278.60 | +1.18% | 79.51 | +0.76% |
| 2026-09-24 | 275.35 | -0.20% | 78.91 | -0.98% |
| 2026-09-23 | 275.90 | +1.32% | 79.69 | -0.20% |
The higher-return, higher-risk asset — a sustained rally over the window, with the widest daily swings.
Traded sideways: minimal return over the period, but the lower-volatility series.
Effectively zero — the two markets move independently. This is the condition under which diversification reduces portfolio risk.
| Coffee | Cotton | Risk (vol p.a.) | Return p.a. |
|---|---|---|---|
| 0% | 100% | 23.1% | 0.3% |
| 5% | 95% | 22.1% | 1.9% |
| 10% | 90% | 21.3% | 3.5% |
| 15% | 85% | 20.7% | 5.0% |
| 20% | 80% | 20.3% | 6.6% |
| 25% | 75% | 20.2% | 8.2% |
| 30% | 70% | 20.3% | 9.8% |
| 35% | 65% | 20.6% | 11.3% |
| 40% | 60% | 21.2% | 12.9% |
| 45% | 55% | 22.0% | 14.5% |
| 50% | 50% | 23.0% | 16.1% |
| 55% | 45% | 24.1% | 17.7% |
| 60% | 40% | 25.4% | 19.2% |
| 65% | 35% | 26.8% | 20.8% |
| 70% | 30% | 28.4% | 22.4% |
| 75% | 25% | 30.0% | 24.0% |
| 80% | 20% | 31.6% | 25.6% |
| 85% | 15% | 33.4% | 27.2% |
| 90% | 10% | 35.2% | 28.7% |
| 95% | 5% | 37.0% | 30.3% |
| 100% | 0% | 38.9% | 31.9% |
Holding 25% coffee and 75% cotton carries 20.2% risk — below cotton on its own (23.1%) — while returning 8.3% versus cotton's 0.3%. Adding a slice of the riskier asset made the portfolio both safer and more profitable than the safe asset alone: because the two barely correlate (0.04), their day-to-day shocks offset. That is diversification, quantified on real market data.
End-to-end ETL (pipeline.py): extracts 3 years of daily ICE futures, computes returns, annualized volatility, drawdown, rolling correlation and the closed-form minimum-variance weights; renders this page as pure SVG (build_dashboard.py).
The pipeline loads prices, daily metrics and correlation into a relational store with an analytical view; queries.sql documents 10 production-style queries — joins, window functions, time aggregations, CASE logic.
Charts are rendered as SVG — server-side by build_dashboard.py for the initial paint, then enhanced with hand-written JS: a frontier explorer, a date-range filter and a hover crosshair. No chart library, no runtime dependency, and the frontier ships a table twin for accessibility.
A cron workflow runs the pipeline after every ICE close (weekdays), commits the refreshed data and redeploys this page via GitHub Pages — the study refreshes with no server to maintain.