pub struct VolSurface { /* private fields */ }Expand description
A canonical Black volatility surface anchored at reference_date.
Implementations§
Source§impl VolSurface
impl VolSurface
Sourcepub fn flat(
vol: f64,
reference_date: NaiveDate,
day_count: DayCountConvention,
) -> Result<Self, VolError>
pub fn flat( vol: f64, reference_date: NaiveDate, day_count: DayCountConvention, ) -> Result<Self, VolError>
Constant volatility for all strikes and expiries.
Sourcepub fn from_strike_grid(
expiries: &[Tenor],
strikes: &[f64],
vols: &[Vec<f64>],
reference_date: NaiveDate,
day_count: DayCountConvention,
) -> Result<Self, VolError>
pub fn from_strike_grid( expiries: &[Tenor], strikes: &[f64], vols: &[Vec<f64>], reference_date: NaiveDate, day_count: DayCountConvention, ) -> Result<Self, VolError>
Absolute strike x expiry grid.
Sourcepub fn from_moneyness_grid(
expiries: &[Tenor],
moneyness: &[f64],
vols: &[Vec<f64>],
reference_date: NaiveDate,
day_count: DayCountConvention,
) -> Result<Self, VolError>
pub fn from_moneyness_grid( expiries: &[Tenor], moneyness: &[f64], vols: &[Vec<f64>], reference_date: NaiveDate, day_count: DayCountConvention, ) -> Result<Self, VolError>
Forward moneyness (K/F) x expiry grid.
Sourcepub fn from_delta_grid(
expiries: &[Tenor],
deltas: &[f64],
vols: &[Vec<f64>],
reference_date: NaiveDate,
day_count: DayCountConvention,
) -> Result<Self, VolError>
pub fn from_delta_grid( expiries: &[Tenor], deltas: &[f64], vols: &[Vec<f64>], reference_date: NaiveDate, day_count: DayCountConvention, ) -> Result<Self, VolError>
Forward call delta x expiry grid (FX convention). Each pillar is
converted to log-moneyness with its own quoted vol:
ln(K/F) = 0.5*sigma^2*t - sigma*sqrt(t)*inv_N(delta).
Sourcepub fn from_strike_smiles(
expiries: &[Tenor],
smiles: &[Vec<(f64, f64)>],
reference_date: NaiveDate,
day_count: DayCountConvention,
) -> Result<Self, VolError>
pub fn from_strike_smiles( expiries: &[Tenor], smiles: &[Vec<(f64, f64)>], reference_date: NaiveDate, day_count: DayCountConvention, ) -> Result<Self, VolError>
Per-expiry smiles on absolute strikes, where each expiry may have its
own strike list (as quoted option chains do): smiles[i] is a list of
(strike, vol) points for expiries[i], sorted by strike.
Sourcepub fn from_input(
input: &VolInput,
reference_date: NaiveDate,
) -> Result<Self, VolError>
pub fn from_input( input: &VolInput, reference_date: NaiveDate, ) -> Result<Self, VolError>
Build from a deserialized VolInput, anchored at reference_date.
Sourcepub fn vol(&self, strike: f64, forward: f64, t: f64) -> f64
pub fn vol(&self, strike: f64, forward: f64, t: f64) -> f64
Black volatility for an option with the given absolute strike,
forward price of the underlying at expiry, and year fraction t.
Strike dimension: linear in vol, flat wings. Time dimension: linear in total variance at the fixed smile coordinate, flat vol before the first and after the last expiry pillar.
Sourcepub fn bumped(&self, shift: VolShift) -> Result<VolSurface, VolError>
pub fn bumped(&self, shift: VolShift) -> Result<VolSurface, VolError>
This surface with shift applied to every quoted vol — the smile
shape, coordinate system and expiry pillars are preserved. Errors
when any bumped vol would be non-positive (a shock that large is a
data problem, not a market).
pub fn reference_date(&self) -> NaiveDate
pub fn day_count(&self) -> DayCountConvention
Sourcepub fn expiry_times(&self) -> &[f64]
pub fn expiry_times(&self) -> &[f64]
Expiry pillar times (empty for a flat surface).
Trait Implementations§
Source§impl Clone for VolSurface
impl Clone for VolSurface
Source§fn clone(&self) -> VolSurface
fn clone(&self) -> VolSurface
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more