Skip to main content

FxVolView

Struct FxVolView 

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

A surface lifted into mode R.

Fields§

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

Implementations§

§

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

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

The lifted node vols, in parameter order.

pub fn convention(&self) -> DeltaConvention

The surface’s convention.

pub fn year_fraction(&self, date: NaiveDate) -> f64

The year fraction from the surface’s reference date to date, in the measure the surface’s quotes are per unit of.

A pricer asks for this rather than counting the option’s life for itself. A volatility is a quote per unit of time, so the measure is half the quote: a caller that counts its own time is pricing under a convention nobody stated, and the surface’s own would then reach the interpolation between expiries and nothing else.

pub fn day_count(&self) -> DayCountFraction

The day count the surface’s total variance is measured in.

fn smile_vols(&self, k: usize) -> &[R]

The node vols of smile k, in the mode.

fn smile_at(&self, expiry: NaiveDate) -> Result<Cow<'_, [R]>, FxVolError>

The smile at expiry: each quote’s vol linear in total variance between the neighbouring stored smiles, flat in vol beyond the ends, a stored expiry’s own vols exactly.

§Errors

FxVolError::Malformed if expiry is on or before the reference.

pub fn vol_at_quote( &self, expiry: NaiveDate, quote: DeltaQuote, ) -> Result<R, FxVolError>

The vol the surface holds for quote at expiry, in the mode: the node itself, or its blend in total variance between the neighbouring stored expiries. A node read, not a strike read — the vol a market quote names before any strike is resolved.

§Errors

FxVolError::UnknownQuote if the surface does not carry the quote; FxVolError::Malformed if expiry is on or before the reference.

pub fn vol_at_strike( &self, expiry: NaiveDate, strike: f64, forward: R, df_base: R, ) -> Result<R, FxVolError>

The vol at strike for an option expiring at expiry, in the mode: the smile at expiry placed on the strike axis at forward and df_base, then linear in log-moneyness between the adjacent node strikes and flat beyond the wings. A node’s own strike reads back the node’s vol exactly.

The forward and the discount factor are in the mode, so the vol carries their adjoints as well as the nodes’ — sticky delta: a curve move shifts where the strike sits on the smile.

§Errors

FxVolError::Malformed if expiry is on or before the reference; FxVolError::UnreachableDelta if a node’s delta has no strike at these inputs; FxVolError::NodeStrikesNotOrdered if the nodes do not resolve to increasing strikes.

pub fn strike_at_delta( &self, expiry: NaiveDate, delta: f64, forward: f64, df_base: f64, ) -> Result<f64, FxVolError>

The strike at which an option expiring at expiry has the signed delta — calls positive, puts negative — against this smile: the strike↔vol fixed point, on passive values, since a delta-labelled trade is booked at the strike it resolves to and that strike is then a contract term.

§Errors

FxVolError::UnreachableDelta if no strike has the delta; FxVolError::DeltaLabelDidNotConverge after the iteration budget; otherwise as vol_at_strike.

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

The derivative-free projection.

Trait Implementations§

§

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

§

fn clone(&self) -> FxVolView<'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 FxVolView<'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 FxVolView<'a, R>

§

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

§

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

§

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

§

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

§

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

§

impl<'a, R> UnwindSafe for FxVolView<'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.