Struct PyRateVolSurface
pub struct PyRateVolSurface {
pub(crate) inner: RateVolSurface,
}Expand description
A rate volatility surface on an expiry × tenor grid — the swaption vols a swaption reads, and the yield vols a bond option reads — optionally carrying a smile in absolute rate strikes, which a cap reads.
Fields§
§inner: RateVolSurfaceImplementations§
§impl PyRateVolSurface
impl PyRateVolSurface
fn __repr__(&self) -> String
pub(crate) fn new(
expiries: Vec<f64>,
tenors: Vec<f64>,
vols: Vec<Vec<f64>>,
vol_convention: Named<VolConvention>,
day_count: Named<DayCountFraction>,
) -> PyResult<Self>
pub(crate) fn new( expiries: Vec<f64>, tenors: Vec<f64>, vols: Vec<Vec<f64>>, vol_convention: Named<VolConvention>, day_count: Named<DayCountFraction>, ) -> PyResult<Self>
A surface from ascending expiries and tenors, both in years, and
one row of vols per expiry in tenor order.
pub(crate) fn day_count(&self) -> &'static str
pub(crate) fn day_count(&self) -> &'static str
The day count the expiry axis is measured on — the years from
valuation to each fixing or expiry, for the read and for the
variance. ACT/365.FIXED unless the surface was built with another.
pub(crate) fn smile(
expiries: Vec<f64>,
tenor_years: f64,
strikes: Vec<f64>,
vols: Vec<Vec<f64>>,
vol_convention: Named<VolConvention>,
strike_axis: Named<StrikeAxis>,
) -> PyResult<Self>
pub(crate) fn smile( expiries: Vec<f64>, tenor_years: f64, strikes: Vec<f64>, vols: Vec<Vec<f64>>, vol_convention: Named<VolConvention>, strike_axis: Named<StrikeAxis>, ) -> PyResult<Self>
A surface carrying a smile: the cap market’s quote grid of ascending
expiries in years at one tenor_years across ascending strikes,
with one row of vols per expiry and one entry per strike. The strikes
are absolute rates unless strike_axis names spread_to_atm.
pub(crate) fn cube(
expiries: Vec<f64>,
tenors: Vec<f64>,
strikes: Vec<f64>,
vols: Vec<Vec<Vec<f64>>>,
vol_convention: Named<VolConvention>,
strike_axis: Named<StrikeAxis>,
) -> PyResult<Self>
pub(crate) fn cube( expiries: Vec<f64>, tenors: Vec<f64>, strikes: Vec<f64>, vols: Vec<Vec<Vec<f64>>>, vol_convention: Named<VolConvention>, strike_axis: Named<StrikeAxis>, ) -> PyResult<Self>
A surface over all three axes: ascending expiries and tenors, both
in years, ascending strikes, and one vol per triple —
vols[expiry][tenor][strike]. What a currency needs when two index
tenors both carry a skew. The swaption market quotes its cube against
the at-the-money forward, so name strike_axis as spread_to_atm
there; a cap cube stays on the default absolute axis.
pub(crate) fn strike_axis(&self) -> String
pub(crate) fn strike_axis(&self) -> String
What the strike pillars measure: absolute or spread_to_atm.
pub(crate) fn strikes(&self) -> Option<Vec<f64>>
pub(crate) fn strikes(&self) -> Option<Vec<f64>>
The strikes the smile is quoted on, where the surface carries one.
pub(crate) fn vol(
&self,
expiry_years: f64,
tenor_years: f64,
strike: Option<f64>,
) -> PyResult<f64>
pub(crate) fn vol( &self, expiry_years: f64, tenor_years: f64, strike: Option<f64>, ) -> PyResult<f64>
The vol at (expiry_years, tenor_years), both year fractions —
linear in vol across the tenor axis, linear in total variance across
the expiry axis, flat beyond every edge — and at strike where the
surface carries a smile, linear in vol between strikes and flat
beyond. A surface quoted at the money answers every strike alike; a
smiled one must be given a strike.
pub(crate) fn vol_convention(&self) -> String
pub(crate) fn vol_convention(&self) -> String
Whether the vols are normal or lognormal.
Spelled the same as the constructor’s keyword, so a value read out of one surface passes straight back into another without being renamed in the caller’s hands.
Trait Implementations§
§impl Clone for PyRateVolSurface
impl Clone for PyRateVolSurface
§fn clone(&self) -> PyRateVolSurface
fn clone(&self) -> PyRateVolSurface
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl DerefToPyAny for PyRateVolSurface
§impl From<&PyRateVolSurface> for RateSmileArg
impl From<&PyRateVolSurface> for RateSmileArg
§fn from(grid: &PyRateVolSurface) -> Self
fn from(grid: &PyRateVolSurface) -> Self
§impl IntoPy<Py<PyAny>> for PyRateVolSurface
impl IntoPy<Py<PyAny>> for PyRateVolSurface
§impl PyClass for PyRateVolSurface
impl PyClass for PyRateVolSurface
§impl PyClassImpl for PyRateVolSurface
impl PyClassImpl for PyRateVolSurface
§const IS_BASETYPE: bool = false
const IS_BASETYPE: bool = false
§const IS_SUBCLASS: bool = false
const IS_SUBCLASS: bool = false
§const IS_MAPPING: bool = false
const IS_MAPPING: bool = false
§const IS_SEQUENCE: bool = false
const IS_SEQUENCE: bool = false
§type ThreadChecker = SendablePyClass<PyRateVolSurface>
type ThreadChecker = SendablePyClass<PyRateVolSurface>
§type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::ImmutableChild
type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::ImmutableChild
§type BaseNativeType = PyAny
type BaseNativeType = PyAny
PyAny by default, and when you declare
#[pyclass(extends=PyDict)], it’s PyDict.fn items_iter() -> PyClassItemsIter
fn lazy_type_object() -> &'static LazyTypeObject<Self>
fn dict_offset() -> Option<isize>
fn weaklist_offset() -> Option<isize>
§impl PyClassNewTextSignature<PyRateVolSurface> for PyClassImplCollector<PyRateVolSurface>
impl PyClassNewTextSignature<PyRateVolSurface> for PyClassImplCollector<PyRateVolSurface>
fn new_text_signature(self) -> Option<&'static str>
§impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a PyRateVolSurface
impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a PyRateVolSurface
§impl PyMethods<PyRateVolSurface> for PyClassImplCollector<PyRateVolSurface>
impl PyMethods<PyRateVolSurface> for PyClassImplCollector<PyRateVolSurface>
fn py_methods(self) -> &'static PyClassItems
§impl PyTypeInfo for PyRateVolSurface
impl PyTypeInfo for PyRateVolSurface
§fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
§fn type_object_bound(py: Python<'_>) -> Bound<'_, PyType>
fn type_object_bound(py: Python<'_>) -> Bound<'_, PyType>
§fn is_type_of_bound(object: &Bound<'_, PyAny>) -> bool
fn is_type_of_bound(object: &Bound<'_, PyAny>) -> bool
object is an instance of this type or a subclass of this type.§fn is_exact_type_of_bound(object: &Bound<'_, PyAny>) -> bool
fn is_exact_type_of_bound(object: &Bound<'_, PyAny>) -> bool
object is an instance of this type.