Research Toolkit — Derivatives Pricing

ASVS

Arbitrage-Free IV Surface Library
SVI fitted volatility surface

Research toolkit for constructing and analyzing arbitrage-free implied volatility surfaces. Combines SVI parameterization with rigorous no-arbitrage constraints, robust IV computation, static arbitrage detection, and fast Heston calibration via COS pricing.

Test Coverage
108 tests
IV Computation
12 ms / 100
Heston Calib.
1.2 s / 250
COS Pricing
0.8 ms / opt
01 — Design

Modular
Toolkit

ASVS provides independent, composable modules for IV surface research. Load option data, compute implied volatilities with Newton-Raphson + Brent fallback, validate against arbitrage constraints (put-call parity, butterfly spreads, calendar), fit smooth SVI smiles with Gatheral no-arbitrage enforcement, and calibrate Heston parameters via COS pricing.

Each component includes robust error handling: Jaeckel rational approximation for deep OTM/ITM initial guesses, configurable arbitrage tolerance bands, Feller condition enforcement on Heston parameters, and multi-start optimization. Use the fluent API to chain operations or work with individual modules independently.

01 ——
IV Solver
Newton-Raphson + Brent fallback. Jaeckel (2015) rational approximation initial guess. Converges in ≤3 iterations for standard options.
02 ——
Arbitrage Check
Put-call parity, butterfly spreads, calendar arbitrage. Configurable tolerance. Reports violations by expiry/moneyness band.
03 ——
SVI Fitting
L-BFGS-B least-squares optimization. Gatheral no-arbitrage constraints enforced. Per-expiry calibration with rolling covariance.
04 ——
Heston Calib.
COS method (N=128 terms, exponential convergence). Feller condition enforced. Global + local multi-start optimization.
02 — Theory

Core
Methods

The toolkit implements three complementary methodologies. Black-Scholes IV inversion solves for implied volatility from market option prices. SVI parameterization provides a parsimonious, arbitrage-free representation of the volatility smile. The Heston stochastic volatility model captures dynamics and Greeks via characteristic function methods.

1 — Implied Volatility (Newton-Raphson) Given market option price C_market, solve for σ in Black-Scholes:

  C_BS(S, K, T, r, σ) = C_market

Newton-Raphson iteration using vega as the derivative:
  σ_{n+1} = σ_n − (C_BS(σ_n) − C_market) / vega(σ_n)

Converges quadratically in ~3 iterations. Jaeckel (2015) rational approximation provides tight initial guess for deep OTM/ITM options.
2 — SVI Parameterization (Gatheral, 2014) Total implied variance as a function of log-moneyness k = log(K/F):

  w(k) = a + b(ρ(k − m) + √((k − m)² + σ²))

No-arbitrage conditions (Gatheral & Jacquier, 2014):
  • b ≥ 0   • |ρ| < 1   • σ > 0
  • a + bσ√(1 − ρ²) ≥ 0   • b(1 + |ρ|) ≤ 4
3 — Heston Stochastic Volatility Model Risk-neutral asset and variance dynamics:

  dS_t = rS_t dt + √(v_t)S_t dW¹_t
  dv_t = κ(θ − v_t)dt + ξ√(v_t) dW²_t

Feller condition (strict positivity): 2κθ > ξ²

COS pricing achieves O(e^−N) convergence:
  C(S, K, T) = e^−rT Σ Re(φ(kπ/(b−a)) · U_k · χ_k)
03 — Workflow

Analysis
Pipeline

ASVS provides a fluent API for end-to-end IV surface analysis. Chain operations from data ingestion through model fitting and visualization, or use individual modules as needed. All components are type-annotated, tested, and designed for research reproducibility.

01
Load Data
DataFrame with strike, expiry, option_type, price. Spot S, rate r.
02
Compute IVs
Newton-Raphson + Brent fallback. Intrinsic value floor.
03
Arbitrage Check
PCP, butterfly, calendar. Reports violations by band.
04
Fit SVI
L-BFGS-B, per-expiry, no-arb enforcement.
05
Calibrate Heston
COS pricing, Feller check, multi-start local/global.
06
Greeks & Analysis
Delta, vega, gamma surfaces. Finite diff or closed-form.
07
Visualize
3D surface, smile, term structure, Greeks heatmaps.
04 — Benchmarks

Performance
Profile

Typical runtimes on Intel i7 hardware. All components are vectorized and optimized for batch processing. COS pricing with N=128 terms achieves <10 μs per option.

Computation Time
IV compute (100 opts) 12 ms
SVI fit (50 × 5) 45 ms
Heston calib (250 opts) 1.2 s
COS pricing (1 option) 0.8 ms
Greeks (via finDiff) 6 ms
Test Coverage
Total Tests 108
Line Coverage 54%
IV Solver Tests 18
SVI Fitting Tests 24
Heston Calib Tests 22
05 — Analysis

Visual
Analysis

Volatility Smile — Market IV vs SVI Fit
Volatility smile
3D Volatility Surface — Strike × Expiry Grid
3D volatility surface
06 — Features & Tools

Comprehensive
Toolkit

ASVS includes a complete suite of tools for volatility surface analysis: robust IV computation with fallback methods, arbitrage violation detection, SVI calibration with no-arbitrage enforcement, Heston stochastic volatility calibration, Greeks computation, and publication-quality visualizations.

Component Method Feature Status
IV Solver Newton-Raphson Jaeckel initial guess + Brent fallback
Arbitrage Check Put-Call Parity PCP violations, butterfly spreads, calendar
SVI Fitting L-BFGS-B Per-expiry, Gatheral constraints, rolling covar
Heston Calib COS Method Global + local multi-start, Feller enforced
Greeks Finite Diff + Analytic Delta, gamma, vega, theta surfaces
Term Structure Interpolation ATM vol, skew, term structure curves
Visualization Matplotlib + Plotly 3D surface, smile, Greeks heatmaps, comparison
Model Compare RMSE / MAE Market vs SVI vs Heston error metrics

All components include comprehensive error handling, type annotations, and unit test coverage. COS pricing vectorized for batch operations.

07 — Example

Research
Workflow

Build analysis pipelines with a clean, composable API. All methods return self for chainability. Type-annotated for IDE support and research reproducibility.

Minimal Usage Example import pandas as pd
from vol_surface import VolatilitySurface

data = pd.DataFrame({
  'strike': [95, 100, 105, 110],
  'expiry': [0.25, 0.25, 0.25, 0.25],
  'option_type': ['call', 'call', 'call', 'call'],
  'price': [8.5, 5.2, 2.8, 1.1]
})

surface = VolatilitySurface(S=100, r=0.02)
surface.load_data(data) \
        .compute_ivs() \
        .check_arbitrage() \
        .fit_svi() \
        .calibrate_heston()

surface.plot_smile(expiry=0.25, include_svi=True)
surface.plot_surface_3d(model='heston')
surface.summary()

The library is open-source (MIT license) with comprehensive test coverage (108 tests). Designed for research, backtesting, and derivatives pricing applications. Includes example notebooks, API documentation, and benchmark scripts.