Skip to main content

PyRiskFrame

Struct PyRiskFrame 

pub struct PyRiskFrame {
    pub(crate) npv: f64,
    pub(crate) risk: RiskVector,
    pub(crate) market: MarketContext,
}
Expand description

One risk pass and the market it was taken against: what a measure resolves against, read as many ways as a desk needs.

Fields§

§npv: f64§risk: RiskVector§market: MarketContext

Implementations§

§

impl PyRiskFrame

pub(crate) fn read( &self, axis: Named<RiskAxis>, basis: Named<Basis>, aggregation: Named<Aggregation>, scale: Named<Scale>, buckets: Option<Vec<Tenor>>, ) -> PyResult<PyRecords>

The reading on axis: label, curve, date, value per row. basis is zero (the curve nodes’ own quotes) or par (flipped through each curve’s ladder); aggregation is total, bucketed, by-curve or ladder; scale is unit, bp, pct, volpt or x<factor>. Each takes its class or its spelling.

buckets buckets the reading on the caller’s own edges (["18M", "3Y"], each a tenor or a Period) rather than the fixed ladder: a bucket up to each edge, labelled by it, then one past the last (3Y+). It is the bucketed aggregation on those edges, so any other aggregation beside it is refused, as are no edges, or edges not positive and rising.

pub(crate) fn npv(&self) -> f64

The book’s value in the pass this frame holds.

pub(crate) fn __repr__(&self) -> String

pub(crate) fn valuation_date(&self) -> Option<NaiveDate>

The valuation date of the market the pass was taken against.

pub(crate) fn risk(&self) -> PyRecords

The raw input sensitivities the pass produced: input, value.

Trait Implementations§

§

impl DerefToPyAny for PyRiskFrame

§

impl IntoPy<Py<PyAny>> for PyRiskFrame

§

fn into_py(self, py: Python<'_>) -> PyObject

Performs the conversion.
§

impl PyClass for PyRiskFrame

§

type Frozen = True

Whether the pyclass is frozen. Read more
§

impl PyClassImpl for PyRiskFrame

§

const IS_BASETYPE: bool = false

#[pyclass(subclass)]
§

const IS_SUBCLASS: bool = false

#[pyclass(extends=…)]
§

const IS_MAPPING: bool = false

#[pyclass(mapping)]
§

const IS_SEQUENCE: bool = false

#[pyclass(sequence)]
§

type BaseType = PyAny

Base class
§

type ThreadChecker = SendablePyClass<PyRiskFrame>

This handles following two situations: Read more
§

type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::ImmutableChild

Immutable or mutable
§

type Dict = PyClassDummySlot

Specify this class has #[pyclass(dict)] or not.
§

type WeakRef = PyClassDummySlot

Specify this class has #[pyclass(weakref)] or not.
§

type BaseNativeType = PyAny

The closest native ancestor. This is PyAny by default, and when you declare #[pyclass(extends=PyDict)], it’s PyDict.
§

fn items_iter() -> PyClassItemsIter

§

fn doc(py: Python<'_>) -> PyResult<&'static CStr>

Rendered class doc
§

fn lazy_type_object() -> &'static LazyTypeObject<Self>

§

fn dict_offset() -> Option<isize>

§

fn weaklist_offset() -> Option<isize>

§

impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a PyRiskFrame

§

type Holder = Option<PyRef<'py, PyRiskFrame>>

§

fn extract( obj: &'a Bound<'py, PyAny>, holder: &'a mut Self::Holder, ) -> PyResult<Self>

§

impl PyMethods<PyRiskFrame> for PyClassImplCollector<PyRiskFrame>

§

fn py_methods(self) -> &'static PyClassItems

§

impl PyTypeInfo for PyRiskFrame

§

const NAME: &'static str = "RiskFrame"

Class name.
§

const MODULE: Option<&'static str>

Module name, if any.
§

fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject

Returns the PyTypeObject instance for this type.
§

fn type_object_bound(py: Python<'_>) -> Bound<'_, PyType>

Returns the safe abstraction over the type object.
§

fn is_type_of_bound(object: &Bound<'_, PyAny>) -> bool

Checks if object is an instance of this type or a subclass of this type.
§

fn is_exact_type_of_bound(object: &Bound<'_, PyAny>) -> bool

Checks if object is an instance of this type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> PyErrArguments for T
where T: IntoPy<Py<PyAny>> + Send + Sync,

§

fn arguments(self, py: Python<'_>) -> Py<PyAny>

Arguments for exception
§

impl<T> PyTypeCheck for T
where T: PyTypeInfo,

§

const NAME: &'static str = <T as PyTypeInfo>::NAME

Name of self. This is used in error messages, for example.
§

fn type_check(object: &Bound<'_, PyAny>) -> bool

Checks if object is an instance of Self, which may include a subtype. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> Ungil for T
where T: Send,