Struct FutureOptionVolSurface
pub struct FutureOptionVolSurface {
reference: NaiveDate,
expiries: Vec<NaiveDate>,
strikes: Vec<f64>,
vols: Vec<f64>,
convention: VolConvention,
measure: DayCountFraction,
}Expand description
A listed future’s option vol surface.
Fields§
§reference: NaiveDate§expiries: Vec<NaiveDate>Ascending listed expiries; empty on a flat surface.
strikes: Vec<f64>Ascending strikes, per 100 face; empty on a flat surface.
vols: Vec<f64>Node vols, row-major by expiry — the free parameters.
convention: VolConvention§measure: DayCountFractionThe day count the vols are quoted per year of.
Implementations§
§impl FutureOptionVolSurface
impl FutureOptionVolSurface
pub fn new(
reference: NaiveDate,
expiries: Vec<NaiveDate>,
strikes: Vec<f64>,
rows: &[Vec<f64>],
convention: VolConvention,
) -> Result<Self, RateVolError>
pub fn new( reference: NaiveDate, expiries: Vec<NaiveDate>, strikes: Vec<f64>, rows: &[Vec<f64>], convention: VolConvention, ) -> Result<Self, RateVolError>
A surface marked on reference over ascending expiries × ascending
strikes (per 100 face), one row of vols per expiry.
§Errors
RateVolError::Malformed on an empty or non-ascending axis, an
expiry on or before reference, a grid that does not match the axes, a
non-finite or non-positive vol, or a non-positive strike under the
lognormal convention.
pub fn flat(
reference: NaiveDate,
vol: f64,
convention: VolConvention,
) -> Result<Self, RateVolError>
pub fn flat( reference: NaiveDate, vol: f64, convention: VolConvention, ) -> Result<Self, RateVolError>
One vol at every expiry and strike, marked on reference. One node,
one parameter.
§Errors
RateVolError::Malformed for a non-finite or non-positive vol.
pub fn with_day_count(self, day_count: DayCountFraction) -> Self
pub fn with_day_count(self, day_count: DayCountFraction) -> Self
This surface with its vols quoted per year of day_count rather than
ACT/365F — a guide’s Act/360, say. The node vols are unchanged; only
the time an option reads them over is.
pub fn day_count(&self) -> DayCountFraction
pub fn day_count(&self) -> DayCountFraction
The day count the vols are quoted per year of.
pub fn reference(&self) -> NaiveDate
pub fn reference(&self) -> NaiveDate
The date the surface was marked on — where its time is measured from.
pub fn convention(&self) -> VolConvention
pub fn convention(&self) -> VolConvention
The quoting convention: a Black-76 price vol, or a Bachelier price vol in points per year.
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<(Option<NaiveDate>, Option<f64>)>
pub fn parameter_keys(&self) -> Vec<(Option<NaiveDate>, Option<f64>)>
(expiry, strike) per parameter, in parameter order; both None 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), the years measured
from the reference date (a flat surface’s node reads at one year, as
the other flat vol surfaces do); None when a node leaves (0, ∞).
pub fn view<R: Scalar>(&self) -> FutureOptionVolView<'_, R>
pub fn view<R: Scalar>(&self) -> FutureOptionVolView<'_, R>
The surface at mode R: the passive lift borrows, every active mode
converts.
pub fn view_with<'a, R: Scalar>(
&'a self,
params: &'a [R],
) -> Result<FutureOptionVolView<'a, R>, RateVolError>
pub fn view_with<'a, R: Scalar>( &'a self, params: &'a [R], ) -> Result<FutureOptionVolView<'a, R>, RateVolError>
The surface over a caller’s parameter vector.
§Errors
RateVolError::ParameterCountMismatch on the wrong length.
Trait Implementations§
§impl Clone for FutureOptionVolSurface
impl Clone for FutureOptionVolSurface
§fn clone(&self) -> FutureOptionVolSurface
fn clone(&self) -> FutureOptionVolSurface
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for FutureOptionVolSurface
impl Debug for FutureOptionVolSurface
§impl PartialEq for FutureOptionVolSurface
impl PartialEq for FutureOptionVolSurface
§fn eq(&self, other: &FutureOptionVolSurface) -> bool
fn eq(&self, other: &FutureOptionVolSurface) -> bool
self and other values to be equal, and is used by ==.