implied-vol-surfacelisted
Install: claude install-skill howard-lynn-ye/fin-skills
# Implied vol surface
A surface is three separate problems — **invert**, **fit**, **interpolate** — and each has a way
of being wrong that produces a number instead of an error.
Every figure below is printed by `scripts/vol_surface.py` (runs in **5.1 s**; vollib and QuantLib
are optional, imported inside functions). ✅ Measured means this file produced it on 2026-09-09
with QuantLib 1.43, vollib 1.0.11, numpy 2.2.6, scipy 1.13.0, Python 3.11.3. The synthetic truth
is a Heston surface, so the "right answer" at any strike and maturity is known.
> **The rule:** invert with a bracketed solver on a **relative** price tolerance that refuses
> sub-intrinsic prices; fit in **total variance**; run **g(k) ≥ 0** and **dw/dt ≥ 0** on every
> fit; and interpolate maturities in **total variance at fixed log-moneyness** — never in vol.
## 1. Inverting a price — the solver is the easy half
✅ **Round trip over 27 cases** (sigma ∈ {0.10, 0.30, 0.80} × K/S ∈ {0.7, 1.0, 1.3} × T ∈ {0.05,
1, 3}, OTM side): worst |recovered − true| = **3.1e-14**. ✅ **vollib** (Jaeckel's *Let's Be
Rational*) on the identical cases: worst |mine − vollib| = **3.2e-14**. Two independent methods,
agreement at the last bit — the inversion itself is a solved problem.
⚠️ **`py_vollib` is not installed here; `vollib` 1.0.11 is.** `py_vollib` is a deprecated shim —
see `../../../fin-libraries/skills/lib-vollib/SKILL.md`. The import used is
`vollib.black_scholes_merton.implied_volatility`, which takes `q`.
### 1a. 🚨 A