Skip to content

SPX Volatility Surface

Build an implied volatility surface for the S&P 500 index from a Yahoo Finance option chain, then calibrate a two-factor BNS model to it.

The Yahoo client fetches the full chain for a ticker. To keep this tutorial offline and reproducible we load a snapshot from a gzipped JSON fixture, but the code is identical to what you would run against the live endpoint.

Loading the chain

Yahoo.loader_from_chain turns the raw chain dictionary into a VolSurfaceLoader. SPX options are non-inverse (quoted in USD) and Yahoo does not provide forwards, so each maturity's forward is recovered from put-call parity inside the loader.

Once the loader has the data, surface() builds the VolSurface, bs() inverts each bid and ask through Black-Scholes, and disable_outliers() drops strikes with unrealistic implied vols.

3D surface

plot3d() renders the converged implied vols against moneyness and time to maturity.

SPX implied volatility surface