Skip to main content

SwaptionVolatilityStructure

Trait SwaptionVolatilityStructure 

Source
pub trait SwaptionVolatilityStructure: VolatilityTermStructure {
Show 18 methods // Required methods fn volatility_impl( &self, option_time: Time, swap_length: Time, strike: Rate, ) -> QlResult<Volatility>; fn max_swap_tenor(&self) -> Period; // Provided methods fn volatility_type(&self) -> VolatilityType { ... } fn shift_impl( &self, _option_time: Time, _swap_length: Time, ) -> QlResult<Real> { ... } fn discrete_grid(&self) -> QlResult<SwaptionVolatilityGrid> { ... } fn max_swap_length(&self) -> QlResult<Time> { ... } fn swap_length_tenor(&self, swap_tenor: Period) -> QlResult<Time> { ... } fn swap_length(&self, start: Date, end: Date) -> QlResult<Time> { ... } fn check_swap_tenor( &self, swap_tenor: Period, extrapolate: bool, ) -> QlResult<()> { ... } fn check_swap_length( &self, swap_length: Time, extrapolate: bool, ) -> QlResult<()> { ... } fn volatility( &self, option_date: Date, swap_length: Time, strike: Rate, extrapolate: bool, ) -> QlResult<Volatility> { ... } fn volatility_time( &self, option_time: Time, swap_length: Time, strike: Rate, extrapolate: bool, ) -> QlResult<Volatility> { ... } fn volatility_tenors( &self, option_tenor: Period, swap_tenor: Period, strike: Rate, extrapolate: bool, ) -> QlResult<Volatility> { ... } fn black_variance( &self, option_date: Date, swap_length: Time, strike: Rate, extrapolate: bool, ) -> QlResult<Real> { ... } fn black_variance_time( &self, option_time: Time, swap_length: Time, strike: Rate, extrapolate: bool, ) -> QlResult<Real> { ... } fn black_variance_tenors( &self, option_tenor: Period, swap_tenor: Period, strike: Rate, extrapolate: bool, ) -> QlResult<Real> { ... } fn shift( &self, option_date: Date, swap_length: Time, extrapolate: bool, ) -> QlResult<Real> { ... } fn shift_time( &self, option_time: Time, swap_length: Time, extrapolate: bool, ) -> QlResult<Real> { ... }
}
Expand description

Swaption volatility structure.

Mirrors QuantLib’s SwaptionVolatilityStructure: concrete surfaces implement volatility_impl; the provided queries run the swap, range and strike checks and dispatch to it, deriving the Black variance as volatility^2 * time. Volatilities are expressed on an annual basis.

Required Methods§

Source

fn volatility_impl( &self, option_time: Time, swap_length: Time, strike: Rate, ) -> QlResult<Volatility>

Volatility calculation hook; swap, range and strike checks have already run.

Source

fn max_swap_tenor(&self) -> Period

The largest swap tenor for which the surface can return vols.

Provided Methods§

Source

fn volatility_type(&self) -> VolatilityType

The pricing model the quoted volatilities are expressed in.

Source

fn shift_impl(&self, _option_time: Time, _swap_length: Time) -> QlResult<Real>

Shift calculation hook. The default enforces that a shift only makes sense for lognormal volatilities and returns 0.0.

Source

fn discrete_grid(&self) -> QlResult<SwaptionVolatilityGrid>

The structure’s own discrete option/swap grid, for a consumer that needs to read the node set (the SABR cube’s dense ATM-calibration fill). The default returns Err: only a grid-backed structure (one built on SwaptionVolatilityDiscrete, such as SwaptionVolatilityMatrix) can answer. This stands in for QuantLib’s dynamic_pointer_cast<SwaptionVolatilityDiscrete>(*atmVol_), surfacing an Err exactly where the C++ cast would null-deref.

Source

fn max_swap_length(&self) -> QlResult<Time>

The largest swap length (in time) for which the surface can return vols.

Source

fn swap_length_tenor(&self, swap_tenor: Period) -> QlResult<Time>

Conversion between a swap tenor and its swap length in years. Only month- and year-denominated tenors are meaningful.

Source

fn swap_length(&self, start: Date, end: Date) -> QlResult<Time>

Conversion between swap start and end dates and swap length in years, rounded to whole months as QuantLib does with ClosestRounding(0).

Source

fn check_swap_tenor( &self, swap_tenor: Period, extrapolate: bool, ) -> QlResult<()>

Swap-tenor range check: swap_tenor must be positive and, unless extrapolation applies, no longer than max_swap_tenor.

Source

fn check_swap_length( &self, swap_length: Time, extrapolate: bool, ) -> QlResult<()>

Swap-length range check: swap_length must be positive and, unless extrapolation applies, no longer than max_swap_length.

Source

fn volatility( &self, option_date: Date, swap_length: Time, strike: Rate, extrapolate: bool, ) -> QlResult<Volatility>

Volatility for a given option date, swap length and strike rate.

Source

fn volatility_time( &self, option_time: Time, swap_length: Time, strike: Rate, extrapolate: bool, ) -> QlResult<Volatility>

Volatility for a given option time, swap length and strike rate.

Source

fn volatility_tenors( &self, option_tenor: Period, swap_tenor: Period, strike: Rate, extrapolate: bool, ) -> QlResult<Volatility>

Volatility for a given option tenor, swap tenor and strike rate.

Source

fn black_variance( &self, option_date: Date, swap_length: Time, strike: Rate, extrapolate: bool, ) -> QlResult<Real>

Black variance for a given option date, swap length and strike rate.

Source

fn black_variance_time( &self, option_time: Time, swap_length: Time, strike: Rate, extrapolate: bool, ) -> QlResult<Real>

Black variance for a given option time, swap length and strike rate.

Source

fn black_variance_tenors( &self, option_tenor: Period, swap_tenor: Period, strike: Rate, extrapolate: bool, ) -> QlResult<Real>

Black variance for a given option tenor, swap tenor and strike rate.

Source

fn shift( &self, option_date: Date, swap_length: Time, extrapolate: bool, ) -> QlResult<Real>

Lognormal shift for a given option date and swap length.

Source

fn shift_time( &self, option_time: Time, swap_length: Time, extrapolate: bool, ) -> QlResult<Real>

Lognormal shift for a given option time and swap length.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§