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>
impl<'a, R: Scalar> FxVolView<'a, R>
pub fn parameters(&self) -> &[R]
pub fn parameters(&self) -> &[R]
The lifted node vols, in parameter order.
pub fn convention(&self) -> DeltaConvention
pub fn convention(&self) -> DeltaConvention
The surface’s convention.
pub fn year_fraction(&self, date: NaiveDate) -> f64
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
pub fn day_count(&self) -> DayCountFraction
The day count the surface’s total variance is measured in.
fn smile_vols(&self, k: usize) -> &[R]
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>
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>
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>
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>
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.