Options Density Lab
Option prices hold the market's own odds for where a price will end up. This recovers that probability distribution from a chain of option quotes: it cleans the quotes, fits a smooth volatility smile that rules out arbitrage, and reads the distribution off with the Breeden-Litzenberger identity.
Every quote comes from a model whose true distribution is known, so each step can be graded against the right answer. Across 10 test chains, the recovered distribution's median error is between 0.8% and 1.9%.

View the code (opens in a new tab)Read the README (opens in a new tab)
The problem
Recover the probability distribution that option prices imply, and show the method gets it right.
What I built
A pipeline that drops unusable quotes, estimates the forward price from put-call parity, fits an SVI or spline smile with no-arbitrage penalties, and differentiates call prices to get the density.
What it produces
Densities and cumulative distributions by expiry, no-arbitrage checks, error against the known truth and a demo that grades itself.
A public version of one building block of my OpenK research, run on synthetic quotes.
Every quote is generated from a seeded Heston model. No market or vendor data is used.
In pictures
How it works
- Generate. A seeded option chain with realistic spreads, stale quotes and crossed quotes.
- Clean. Drops unusable quotes and estimates the forward from put-call parity.
- Fit. A smooth volatility smile with no-arbitrage penalties.
- Recover. Density and cumulative distribution from second differences of call prices.
- Check. Butterfly, calendar, positivity and total-probability checks.
- Validate. Error against the known truth and a pass or fail self-check.
Where to look in the code
README sections
- Overview (opens in a new tab) The problem and what the lab does
- Breeden-Litzenberger: density from prices (opens in a new tab) The core identity, explained
- A smooth, arbitrage-aware smile (opens in a new tab) How the smile is fitted
- Validation against the known truth (opens in a new tab) How the recovery is graded
- Quickstart (opens in a new tab) Run the demo yourself
- Limitations (opens in a new tab) What it does not do
Files
- src/options_density_lab/smile.py (opens in a new tab) Smile fitting
- src/options_density_lab/density.py (opens in a new tab) Density recovery
- src/options_density_lab/checks.py (opens in a new tab) No-arbitrage checks
- tests (opens in a new tab) Test suite
- Automated checks (opens in a new tab) lint, type checks and tests on every push