pub struct VolSurface { /* private fields */ }Expand description
A volatility surface built from a collection of VolPoints.
Internally stores a sorted grid of unique strikes and expiries, with bilinear interpolation for queries inside the grid.
Implementations§
Source§impl VolSurface
impl VolSurface
Sourcepub fn from_points(points: Vec<VolPoint>) -> Self
pub fn from_points(points: Vec<VolPoint>) -> Self
Build a VolSurface from a collection of VolPoints.
Duplicate (strike, expiry) pairs are averaged. Gaps in the grid are filled with the nearest known value (nearest-neighbour fallback).
Sourcepub fn interpolate(&self, strike: f64, expiry: f64) -> Option<f64>
pub fn interpolate(&self, strike: f64, expiry: f64) -> Option<f64>
Bilinear interpolation for (strike, expiry).
Returns None if the query is outside the grid boundaries.
Sourcepub fn atm_vol(&self, expiry: f64) -> Option<f64>
pub fn atm_vol(&self, expiry: f64) -> Option<f64>
Implied vol at-the-money (spot = strike) for a given expiry.
Uses interpolation across the strike axis at the nearest available
expiry (or interpolates between expiries). Returns None outside grid.
For a pure ATM query the surface must contain strikes that bracket
the spot level; this implementation takes ATM as the midpoint of the
strike range at the given expiry as a proxy when no spot is provided.
Use interpolate with strike = spot for a proper ATM vol lookup.
Sourcepub fn term_structure(&self) -> Vec<(f64, f64)>
pub fn term_structure(&self) -> Vec<(f64, f64)>
Returns (expiry, atm_vol) pairs for all grid expiries, sorted by expiry.