Struct PyFxVolSurface
pub struct PyFxVolSurface {
pub(crate) inner: FxVolSurface,
}Expand description
An FX volatility surface: one smile per expiry.
Fields§
§inner: FxVolSurfaceImplementations§
§impl PyFxVolSurface
impl PyFxVolSurface
fn __repr__(&self) -> String
pub(crate) fn new(
base: &str,
quote: &str,
reference: NaiveDate,
smiles: Vec<PySmileInput>,
delta_convention: Named<DeltaConvention>,
day_count: Named<DayCountFraction>,
) -> PyResult<Self>
pub(crate) fn new( base: &str, quote: &str, reference: NaiveDate, smiles: Vec<PySmileInput>, delta_convention: Named<DeltaConvention>, day_count: Named<DayCountFraction>, ) -> PyResult<Self>
Builds a surface from one smile per expiry — (expiry, atm, risk_reversal, butterfly) quotes, or (expiry, FxVolSmile) — under
"spot", "forward", "spot_premium" or "forward_premium" deltas.
day_count is the measure the quoted vols are per unit of, used to
turn an expiry date into the total variance σ²τ. ACT/365 fixed unless
the market quotes otherwise.
pub(crate) fn day_count(&self) -> &'static str
pub(crate) fn day_count(&self) -> &'static str
The day count the surface’s total variance is measured in.
pub(crate) fn smile(&self, expiry: NaiveDate) -> Option<PyFxVolSmile>
pub(crate) fn smile(&self, expiry: NaiveDate) -> Option<PyFxVolSmile>
The smile stored at exactly expiry, or None — what was stored,
not an interpolation.
pub(crate) fn quotes(&self) -> Vec<String>
pub(crate) fn quotes(&self) -> Vec<String>
The quotes every smile carries, in smile order: puts, ATM, calls.
pub(crate) fn vol_at_quote(
&self,
expiry: NaiveDate,
quote: &str,
) -> PyResult<f64>
pub(crate) fn vol_at_quote( &self, expiry: NaiveDate, quote: &str, ) -> PyResult<f64>
The vol the surface holds for quote at expiry: the node itself at
a stored expiry, or its blend in total variance between the stored
expiries either side, flat beyond the ends. A node read, before any
strike is resolved.
pub(crate) fn vol_at_strike(
&self,
expiry: NaiveDate,
strike: f64,
forward: f64,
df_base: f64,
) -> PyResult<f64>
pub(crate) fn vol_at_strike( &self, expiry: NaiveDate, strike: f64, forward: f64, df_base: f64, ) -> PyResult<f64>
The vol at strike for an option expiring at expiry, given the
pair’s forward to delivery and the base currency’s discount factor
df_base: each node placed at the strike its quote resolves to, then
linear in log-moneyness between the adjacent node strikes and flat
beyond the wings; across expiries linear in total variance.
pub(crate) fn strike_at_delta(
&self,
expiry: NaiveDate,
delta: f64,
forward: f64,
df_base: f64,
) -> PyResult<f64>
pub(crate) fn strike_at_delta( &self, expiry: NaiveDate, delta: f64, forward: f64, df_base: f64, ) -> PyResult<f64>
The strike at which an option expiring at expiry has delta under
the smile’s own vol at that strike — the strike-vol fixed point a
delta-labelled trade resolves to — given the pair’s forward and the
base currency’s discount factor df_base, in the surface’s delta
convention. A positive delta is a call’s, a negative one a put’s.
Trait Implementations§
§impl Clone for PyFxVolSurface
impl Clone for PyFxVolSurface
§fn clone(&self) -> PyFxVolSurface
fn clone(&self) -> PyFxVolSurface
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 PyFxVolSurface
§impl IntoPy<Py<PyAny>> for PyFxVolSurface
impl IntoPy<Py<PyAny>> for PyFxVolSurface
§impl PyClass for PyFxVolSurface
impl PyClass for PyFxVolSurface
§impl PyClassImpl for PyFxVolSurface
impl PyClassImpl for PyFxVolSurface
§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<PyFxVolSurface>
type ThreadChecker = SendablePyClass<PyFxVolSurface>
§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<PyFxVolSurface> for PyClassImplCollector<PyFxVolSurface>
impl PyClassNewTextSignature<PyFxVolSurface> for PyClassImplCollector<PyFxVolSurface>
fn new_text_signature(self) -> Option<&'static str>
§impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a PyFxVolSurface
impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a PyFxVolSurface
§impl PyMethods<PyFxVolSurface> for PyClassImplCollector<PyFxVolSurface>
impl PyMethods<PyFxVolSurface> for PyClassImplCollector<PyFxVolSurface>
fn py_methods(self) -> &'static PyClassItems
§impl PyTypeInfo for PyFxVolSurface
impl PyTypeInfo for PyFxVolSurface
§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.