Stochastic volatility inspired (SVI) parametrizations of the implied volatility surface in Python — plus the SABR stochastic volatility model.
svi-py calibrates smooth, arbitrage-aware total variance surfaces from panels of European option prices: raw SVI, natural SVI, SSVI, eSSVI, jump-wings, DirectSVI, and SABR behind one interface, with configurable no-arbitrage constraints and a full data-preparation pipeline.
Full documentation: pysvi.readthedocs.io
pip install svi-pyRequires Python >= 3.13. For JIT-accelerated calibration (togglable at runtime via pysvi.use_numba), install the numba extra:
pip install "svi-py[numba]"You need a DataFrame with columns for strike, implied vol, time to maturity, and implied forward:
from pysvi import get_model, calibrate_slice, apply_slice
# df_slice: single-maturity cross-section with columns
# strike, iv, maturity, implied_forward
model = get_model("svi")
params = calibrate_slice(df_slice, model)
fitted = apply_slice(df_slice, params, model)
print(fitted[["strike", "iv", "fitted_iv", "residual_iv"]])The factory accepts "svi", "natural" (or "nsvi"), "ssvi", "essvi", "jumpwings" (or "jw"), "directsvi" (or "dsvi"), and "sabr". Some models take extra per-slice arguments (theta for SSVI/eSSVI, T for jump-wings, T/F/beta for SABR) — see the documentation for each parametrization's formulas, parameters, and usage, plus arbitrage-constraint options and the input-preparation helpers.
Contributions, bug reports, and feature requests are welcome. Open an issue or submit a PR on GitHub. See the contributing guide.
Wanted: the original Gamma-Vanna-Volga paper. The Gamma-Vanna-Volga parametrization is something of a holy grail in the quant vol surface literature and would be a great addition to this library. If you have a copy of the original paper, please send it to marwin.steiner@gmail.com.
MIT