Expand description
Volatility surface cache for storing and querying implied volatility data.
This module provides an efficient cache for volatility surface data with:
- O(1) lookups for exact (strike, expiry) matches
- Bilinear interpolation for points between grid nodes
- Strike quantization to avoid floating-point comparison issues
StructsΒ§
- Bilinear
Point π - Delta
Curve Export - Exported delta curve for a single expiry.
- Delta
IvExport - Exported delta-IV pair for API responses.
- Delta
IvPoint π - A delta-IV pair on the vol smile for a single expiry.
- VolPoint
- A single point on the volatility surface.
- Volatility
Surface - Volatility surface for a single underlying.
ConstantsΒ§
- IV_EPS π
- Minimum IV change worth writing back after solving (avoids flapping).
- IV_
FLOOR π - IV floor used during bisection; below this the option is effectively intrinsic.
- PRICE_
EPS π - Tolerance for declaring a call-price arb violation (quote-unit dollars).
FunctionsΒ§
- bs_call π
- find_
bracketing_ πsorted - Find bracketing values in a sorted slice.
- interpolate_
curve π - Linear interpolation on a sorted delta-IV curve.
- normal_
cdf π - Normal CDF approximation (Abramowitz & Stegun 26.2.17).
- solve_
call_ πiv - Find Ο in [IV_FLOOR, iv_hint] such that BS call price β target. BS call is monotone increasing in Ο, so bisection converges. If the lower boundβs price already exceeds target (target below intrinsic), returns IV_FLOOR.