A quantitative research project that constructs, calibrates, and validates an arbitrage-free implied volatility surface for equity index options, investigates the variance risk premium, and simulates a delta-hedged short variance strategy.
We construct and calibrate an implied volatility surface for S&P 500 options using both per-slice SVI (Gatheral, 2004) and global SSVI (Gatheral & Jacquier, 2014) parameterisations, enforcing static no-arbitrage conditions (butterfly, calendar spread, vertical spread). We calibrate the Heston (1993) stochastic volatility model via Fourier-cosine pricing (Fang & Oosterlee, 2008) and compare its implied surface against the market. We then test whether implied variance systematically overestimates realised variance — the variance risk premium (VRP) — using the Mincer-Zarnowitz regression with Newey-West HAC standard errors. Finally, we simulate a delta-hedged short ATM straddle strategy and decompose its P&L into theta, gamma, and vega components.
cd vol_surface_engine
pip install -r requirements.txt
# Run unit tests (17 tests covering BS, SVI, SSVI, Heston)
python -m pytest tests/ -v
# Run the full pipeline
python run_pipeline.pyOutput:
output/plots/— 8 publication-quality figuresoutput/results/results_summary.json— all numerical resultsoutput/results/svi_calibration.csv— per-slice SVI parameters and diagnosticsoutput/data/— cleaned chain and underlying data
vol_surface_engine/
├── config.py # All parameters, thresholds, paths
├── run_pipeline.py # End-to-end orchestration (13 steps)
├── requirements.txt
├── data/
│ ├── download.py # Data acquisition (yfinance + synthetic fallback)
│ ├── clean.py # Cleaning pipeline with per-step statistics
│ └── rates.py # Risk-free rate interpolation, dividend extraction
├── models/
│ ├── black_scholes.py # BS pricing, Greeks, IV extraction (Newton-Raphson + Brent)
│ ├── svi.py # Raw SVI parameterisation + butterfly density
│ ├── ssvi.py # Surface SVI with G&J no-arb conditions
│ └── heston.py # Heston characteristic function + COS method pricing
├── calibration/
│ ├── svi_calibration.py # Per-slice SVI fitting (multi-start L-BFGS-B)
│ ├── ssvi_calibration.py # Global SSVI fitting (η, γ, ρ)
│ └── heston_calibration.py # Heston model calibration
├── arbitrage/
│ └── checks.py # Butterfly, calendar, vertical spread checks
├── analysis/
│ └── vrp.py # RV estimators, Mincer-Zarnowitz, regime analysis
├── strategy/
│ └── delta_hedge.py # Short variance simulation + P&L attribution
├── plots/
│ └── figures.py # All publication-quality visualisations
└── tests/
└── test_core.py # 17 unit tests for mathematical core
Newton-Raphson with Brenner-Subrahmanyam (1988) initial guess, Brent's method fallback. Convergence tolerance: 1e-12. For production: replace with Jäckel's Let's Be Rational (2017) for machine-precision in ~2 iterations.
- Raw SVI (5 params per slice):
w(x) = a + b·[ρ(x-m) + √((x-m)² + σ²)] - SSVI (3 global params):
w(x,θ) = (θ/2)·[1 + ρφ(θ)x + √((φ(θ)x + ρ)² + (1-ρ²))] - Butterfly no-arb checked via density function g(x) ≥ 0
- Calendar no-arb checked via θ monotonicity + SSVI conditions (Theorem 4.2, G&J 2014)
COS method (Fang & Oosterlee, 2008) with "little Heston trap" formulation (Albrecher et al., 2007) for numerical stability. Feller condition checked.
Mincer-Zarnowitz regression: RV = α + β·IV² + ε with Newey-West HAC standard errors (critical for overlapping windows). Term structure across tenors. VIX-regime splitting.
- Gatheral, J. (2004). A parsimonious arbitrage-free implied volatility parameterization.
- Gatheral, J. & Jacquier, A. (2014). Arbitrage-free SVI volatility surfaces. QF, 14(1), 59–71.
- Heston, S. (1993). A closed-form solution for options with stochastic volatility. RFS, 6(2), 327–343.
- Fang, F. & Oosterlee, C.W. (2008). A novel pricing method for European options based on Fourier-cosine series expansions. SIAM J. Sci. Comput., 31(2), 826–848.
- Bakshi, G. & Kapadia, N. (2003). Delta-hedged gains and the negative market volatility risk premium. RFS, 16(2), 527–566.
- Carr, P. & Wu, L. (2009). Variance risk premiums. RFS, 22(3), 1311–1341.
- Bollerslev, T., Tauchen, G. & Zhou, H. (2009). Expected stock returns and variance risk premia. RFS, 22(11), 4463–4492.
- Albrecher, H. et al. (2007). The little Heston trap. Wilmott Magazine, Jan, 83–92.
This implementation includes a synthetic data generator for pipeline validation. For real research results, replace with CBOE DataShop, WRDS OptionMetrics, Polygon.io, or equivalent SPX option chain data. The code is structured so that swapping data sources requires changes only in data/download.py.
Research project — educational use.