Skip to main content

Crate volsurf

Crate volsurf 

Source
Expand description

§volsurf

Production-ready volatility surface library for derivatives pricing.

Provides the full pipeline: raw option quotes → implied vol extraction → parametric surface fitting → arbitrage-free enforcement → local vol / pricing engine input.

§Architecture

  • implied — Implied volatility extraction (Black, Bachelier, displaced diffusion)
  • smile — Single-tenor smile models (SVI, SABR, cubic spline)
  • surface — Multi-tenor surface construction (SSVI, eSSVI, piecewise)
  • local_vol — Dupire local volatility extraction

§Design

  • Newtypes for inputs and outputs. Vol, Variance wrap return values to prevent accidental mixing. Strike, Tenor wrap inputs for compile-time parameter-swap safety — e.g., black_vol(Tenor(0.5), Strike(100.0)) cannot be transposed.
  • No panics. Every fallible operation returns Result. Library code never calls unwrap() or expect().
  • Immutable surfaces. Once constructed, a surface cannot be modified. No interior mutability, no observer pattern.
  • Thread-safe. All traits require Send + Sync. Surfaces can be shared via Arc<dyn VolSurface> across pricing threads.
  • Serializable. All value types and model structs implement Serde Serialize / Deserialize with validation on deserialization where invariants exist (SVI, SABR, SSVI, eSSVI parameters).

Modules§

calibration
Calibration configuration types shared across smile models.
conventions
Market conventions for volatility surfaces.
error
Error types for the volsurf library.
implied
Implied volatility extraction from option prices.
local_vol
Local volatility extraction from implied volatility surfaces.
smile
Single-tenor volatility smile models.
surface
Multi-tenor volatility surface construction.
types
Core domain types for volatility surface construction.

Structs§

DataFilter
Pre-calibration data filter for strike/vol cleaning.
Strike
Strike price K of an option contract.
Tenor
Time to expiry T in years (annualized).
Variance
Total variance σ²T or instantaneous variance σ².
Vol
Implied volatility σ, measured as annualized standard deviation.

Enums§

OptionType
Option type: call or put.
VolSurfError
Errors that can occur during volatility surface construction and queries.
WeightingScheme
Weighting scheme for calibration objective function.

Traits§

LocalVol
Local volatility surface: σ_loc(T, K).
SmileSection
A single-tenor volatility smile.
VolSurface
A full volatility surface: (expiry, strike) → vol.

Functions§

apply_filter
Filter (strike, vol) pairs by log-moneyness and minimum vol.

Type Aliases§

Result
Convenience type alias for results in this crate.