Skip to main content

RateVolView

Struct RateVolView 

pub struct RateVolView<'a, R: Scalar> {
    data: &'a RateVolSurface,
    params: Cow<'a, [R]>,
}
Expand description

A surface lifted into mode R.

Fields§

§data: &'a RateVolSurface§params: Cow<'a, [R]>

Implementations§

§

impl<'a, R: Scalar> RateVolView<'a, R>

pub fn parameters(&self) -> &[R]

The lifted node vols, in parameter order.

pub fn convention(&self) -> VolConvention

The surface’s convention.

pub fn day_count(&self) -> DayCountFraction

The day count the surface’s expiry axis is measured on.

pub fn strikes(&self) -> Option<&[f64]>

The strike pillars, on the surface’s own strike axis, where it carries a smile.

pub fn strike_axis(&self) -> StrikeAxis

What the surface’s strike pillars measure.

fn row(&self, i: usize, strike: Option<f64>) -> Vec<R>

Row i of the lifted grid — one expiry’s vols across the tenors, with the strike axis collapsed at strike. None takes the first column, which is the whole grid where the surface carries no smile.

fn across_expiry(&self, col: &[R], expiry: f64) -> R

Collapses the expiry axis over the per-expiry column col at expiry: flat in vol beyond the edges, linear in total variance between pillars.

pub fn vol(&self, expiry_years: f64, tenor_years: f64) -> R

The at-the-money vol at (expiry_years, tenor_years): linear in vol across the tenor axis, linear in total variance across the expiry axis, flat beyond every edge. Both coordinates are passive — a swaption’s expiry and tenor are contract terms.

This is the read of a surface without a smile. A surface carrying one is read through vol_at_strike, and resolution keeps a smiled surface out of the registries whose reads name no strike.

pub fn vol_at_strike( &self, expiry_years: f64, tenor_years: f64, strike: f64, ) -> Result<R, RateVolError>

The vol at (expiry_years, tenor_years) and strike: the strike axis collapsed first — linear in vol between strikes, flat beyond both edges — then the tenor and expiry collapses of vol. A surface quoted at the money carries no strike axis and returns exactly what vol returns, whatever the strike.

§Errors

RateVolError::WrongStrikeAxis on a surface quoted at spreads to the forward: an absolute strike names no column of it, and the forward it would be measured against is the instrument’s to supply.

pub fn vol_at_spread( &self, expiry_years: f64, tenor_years: f64, spread: f64, ) -> Result<R, RateVolError>

The vol at (expiry_years, tenor_years) and spread — the read a swaption makes, its spread being strike − forward.

§Errors

RateVolError::WrongStrikeAxis on a surface whose strikes are absolute rates: a spread names no column of it.

fn read(&self, expiry_years: f64, tenor_years: f64, strike: Option<f64>) -> R

The three-axis collapse both reads share.

pub fn vol_at_tenor_in(&self, expiry_years: f64, tenor_years: R) -> R

vol with the tenor coordinate in the mode — the read a bond option makes at its forward modified duration, so the vol carries the duration’s adjoints through the interpolation weights. At the money, like vol: a bond option’s strike is a price, not a rate, so it names no column of a rate smile.

pub fn passive(&self) -> RateVolView<'a, f64>

The derivative-free projection.

Trait Implementations§

§

impl<'a, R: Clone + Scalar> Clone for RateVolView<'a, R>

§

fn clone(&self) -> RateVolView<'a, R>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl<'a, R: Debug + Scalar> Debug for RateVolView<'a, R>

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a, R> Freeze for RateVolView<'a, R>

§

impl<'a, R> RefUnwindSafe for RateVolView<'a, R>
where R: RefUnwindSafe,

§

impl<'a, R> Send for RateVolView<'a, R>

§

impl<'a, R> Sync for RateVolView<'a, R>

§

impl<'a, R> Unpin for RateVolView<'a, R>
where R: Unpin,

§

impl<'a, R> UnsafeUnpin for RateVolView<'a, R>

§

impl<'a, R> UnwindSafe for RateVolView<'a, R>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.