Struct SabrVolSurface
pub struct SabrVolSurface {
expiries: Vec<f64>,
tenors: Vec<f64>,
formula: SabrFormula,
beta: f64,
shift: f64,
params: Vec<f64>,
fit: Option<Arc<SabrFitRecord>>,
}Expand description
A SABR rate smile surface over expiry × tenor, in years.
Fields§
§expiries: Vec<f64>§tenors: Vec<f64>§formula: SabrFormula§beta: f64§shift: f64§params: Vec<f64>[σ_ATM…, ρ…, ν…], each block expiry-major — the free parameters.
fit: Option<Arc<SabrFitRecord>>How the surface was fitted, where it was: what the par vega reading
maps its rows through. None on a surface built from parameters.
Implementations§
§impl SabrVolSurface
impl SabrVolSurface
pub fn new(
expiries: Vec<f64>,
tenors: Vec<f64>,
formula: SabrFormula,
beta: f64,
shift: f64,
atm_vols: &[Vec<f64>],
rhos: &[Vec<f64>],
nus: &[Vec<f64>],
) -> Result<Self, RateVolError>
pub fn new( expiries: Vec<f64>, tenors: Vec<f64>, formula: SabrFormula, beta: f64, shift: f64, atm_vols: &[Vec<f64>], rhos: &[Vec<f64>], nus: &[Vec<f64>], ) -> Result<Self, RateVolError>
A surface over ascending expiries × ascending tenors (years), one
row per expiry in each of atm_vols, rhos and nus, read under
formula with CEV exponent beta and displacement shift.
§Errors
RateVolError::Malformed on an empty or non-ascending axis, a ragged
block, a non-positive or non-finite ATM vol, |ρ| at or beyond the
model’s bound, a negative ν, a β outside [0, 1] (β and the shift are
not read under SabrFormula::NormalBetaZero), or a non-finite shift.
pub(crate) fn with_fit(self, fit: Arc<SabrFitRecord>) -> Self
pub(crate) fn with_fit(self, fit: Arc<SabrFitRecord>) -> Self
This surface carrying the record of the fit that built it.
pub fn fit(&self) -> Option<&Arc<SabrFitRecord>>
pub fn fit(&self) -> Option<&Arc<SabrFitRecord>>
The record of the fit that built the surface, where one did.
pub fn is_fitted(&self) -> bool
pub fn is_fitted(&self) -> bool
Whether the surface was fitted, carrying the quote Jacobian a par vega reads; one stated by its parameters was not.
pub fn formula(&self) -> SabrFormula
pub fn formula(&self) -> SabrFormula
The formula the smile is read under.
pub fn convention(&self) -> VolConvention
pub fn convention(&self) -> VolConvention
Whether the smile’s vols are Bachelier or Black vols.
fn nodes(&self) -> usize
pub fn parameters(&self) -> &[f64]
pub fn parameters(&self) -> &[f64]
The free parameters: [σ_ATM…, ρ…, ν…], each block expiry-major.
pub fn parameter_keys(&self) -> Vec<(f64, f64, SabrParameter)>
pub fn parameter_keys(&self) -> Vec<(f64, f64, SabrParameter)>
(expiry_years, tenor_years, parameter) per free parameter, in order.
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’s ATM vol replaced by f(expiry_years, atm_vol), ρ and ν
held — a vol scenario; None when an ATM vol leaves (0, ∞). The fit
record does not survive: the moved surface is not the one the quotes
built.
pub fn view<R: Scalar>(&self) -> SabrVolView<'_, R>
pub fn view<R: Scalar>(&self) -> SabrVolView<'_, R>
The surface at mode R.
pub fn view_with<'a, R: Scalar>(
&'a self,
params: &'a [R],
) -> Result<SabrVolView<'a, R>, RateVolError>
pub fn view_with<'a, R: Scalar>( &'a self, params: &'a [R], ) -> Result<SabrVolView<'a, R>, RateVolError>
The surface over a caller’s parameter vector.
§Errors
RateVolError::ParameterCountMismatch on the wrong length.
Trait Implementations§
§impl Clone for SabrVolSurface
impl Clone for SabrVolSurface
§fn clone(&self) -> SabrVolSurface
fn clone(&self) -> SabrVolSurface
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more