Struct YoyVolSurface
pub struct YoyVolSurface {
grid: RateVolSurface,
displacement: f64,
}Expand description
A year-on-year inflation optionlet vol surface over expiry × strike.
Fields§
§grid: RateVolSurface§displacement: f64Implementations§
§impl YoyVolSurface
impl YoyVolSurface
pub fn new(
expiries: Vec<f64>,
strikes: Vec<f64>,
rows: &[Vec<f64>],
convention: VolConvention,
) -> Result<Self, RateVolError>
pub fn new( expiries: Vec<f64>, strikes: Vec<f64>, rows: &[Vec<f64>], convention: VolConvention, ) -> Result<Self, RateVolError>
A surface over ascending expiries (years) × ascending absolute YoY
rate strikes, one row of vols per expiry, one entry per strike.
§Errors
RateVolError::Malformed on an empty or non-ascending axis, a grid
that does not match the axes, or a non-finite or non-positive vol.
pub fn flat(vol: f64, convention: VolConvention) -> Result<Self, RateVolError>
pub fn flat(vol: f64, convention: VolConvention) -> Result<Self, RateVolError>
One vol at every expiry and strike. One node, one parameter.
§Errors
RateVolError::Malformed for a non-finite or non-positive vol.
pub fn with_displacement(self, displacement: f64) -> Result<Self, RateVolError>
pub fn with_displacement(self, displacement: f64) -> Result<Self, RateVolError>
This lognormal surface displaced by displacement: Black on F + d
and K + d. One is the unit-displaced Black.
§Errors
RateVolError::Malformed on a normal surface, which has nothing to
displace, or a displacement that is negative or not finite.
pub fn convention(&self) -> VolConvention
pub fn convention(&self) -> VolConvention
The quoting convention.
pub fn displacement(&self) -> f64
pub fn displacement(&self) -> f64
The lognormal displacement; zero on a normal or plain Black surface.
pub fn strikes(&self) -> Option<&[f64]>
pub fn strikes(&self) -> Option<&[f64]>
The strike pillars, where the surface carries a smile; None on a
flat one.
pub fn parameters(&self) -> &[f64]
pub fn parameters(&self) -> &[f64]
The free parameters — every node vol, row-major by expiry.
pub fn parameter_keys(&self) -> Vec<(f64, Option<f64>)>
pub fn parameter_keys(&self) -> Vec<(f64, Option<f64>)>
(expiry_years, strike) per parameter, in parameter order, with no
strike on a flat surface.
pub fn scaled(&self, factor: f64) -> Self
pub fn scaled(&self, factor: f64) -> Self
Every node vol multiplied by factor — a relative vol shock.
pub fn mapped(&self, f: impl Fn(f64, f64) -> f64) -> Option<Self>
pub fn mapped(&self, f: impl Fn(f64, f64) -> f64) -> Option<Self>
Each node vol replaced by f(expiry_years, vol); None when a node
leaves (0, ∞).
pub fn view<R: Scalar>(&self) -> InflationVolView<'_, R>
pub fn view<R: Scalar>(&self) -> InflationVolView<'_, R>
The surface at mode R.
pub fn view_with<'a, R: Scalar>(
&'a self,
params: &'a [R],
) -> Result<InflationVolView<'a, R>, RateVolError>
pub fn view_with<'a, R: Scalar>( &'a self, params: &'a [R], ) -> Result<InflationVolView<'a, R>, RateVolError>
The surface over a caller’s parameter vector.
§Errors
RateVolError::ParameterCountMismatch on the wrong length.
Trait Implementations§
§impl Clone for YoyVolSurface
impl Clone for YoyVolSurface
§fn clone(&self) -> YoyVolSurface
fn clone(&self) -> YoyVolSurface
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more