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-07-30 | 324.50 | -0.40% | 81.10 | +3.95% |
| 2026-07-29 | 325.80 | -4.01% | 78.02 | -1.50% |
| 2026-07-28 | 339.40 | +4.58% | 79.21 | -0.16% |
| 2026-07-27 | 324.55 | +3.43% | 79.34 | +1.01% |
| 2026-07-24 | 313.80 | +1.42% | 78.55 | -1.62% |
| 2026-07-23 | 309.40 | -2.29% | 79.84 | -0.04% |
| 2026-07-22 | 316.65 | -4.61% | 79.87 | +1.15% |
| 2026-07-21 | 331.95 | -0.73% | 78.96 | +2.06% |
| 2026-07-20 | 334.40 | +1.81% | 77.37 | +0.39% |
| 2026-07-17 | 328.45 | +2.23% | 77.07 | -0.80% |
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% | 22.5% | 0.8% |
| 5% | 95% | 21.6% | 2.2% |
| 10% | 90% | 20.8% | 3.7% |
| 15% | 85% | 20.2% | 5.2% |
| 20% | 80% | 19.9% | 6.6% |
| 25% | 75% | 19.8% | 8.1% |
| 30% | 70% | 20.0% | 9.6% |
| 35% | 65% | 20.4% | 11.0% |
| 40% | 60% | 20.9% | 12.5% |
| 45% | 55% | 21.8% | 13.9% |
| 50% | 50% | 22.7% | 15.4% |
| 55% | 45% | 23.9% | 16.9% |
| 60% | 40% | 25.2% | 18.3% |
| 65% | 35% | 26.6% | 19.8% |
| 70% | 30% | 28.1% | 21.2% |
| 75% | 25% | 29.6% | 22.7% |
| 80% | 20% | 31.3% | 24.2% |
| 85% | 15% | 33.0% | 25.6% |
| 90% | 10% | 34.8% | 27.1% |
| 95% | 5% | 36.6% | 28.6% |
| 100% | 0% | 38.5% | 30.0% |
Holding 24% coffee and 76% cotton carries 19.8% risk — below cotton on its own (22.5%) — while returning 7.9% versus cotton's 0.8%. 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.05), 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.