Skip to main content

Measure

Enum Measure 

#[non_exhaustive]
pub enum Measure { Npv, Delta { axis: RiskAxis, basis: Basis, aggregation: Aggregation, scale: Option<Scale>, }, Bumped(BumpedKind), }
Expand description

A quantity a report asks for. Names a number; says nothing about how it is computed, which is what keeps it mode-free.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Npv

Present value.

§

Delta

A first-order sensitivity on one risk axis, read against a basis, collapsed by an aggregation, and reported in a scale.

The variant carries the sensitivity’s order; the axis carries what it is a sensitivity to, the basis carries whose quote it is expressed against, the aggregation carries how many rows it comes back as, and the scale carries the unit each row is in. A vega is therefore a Delta on a vol axis rather than a variant of its own, and a par DV01 is a Delta at Basis::Par rather than a measure of its own.

Fields

§axis: RiskAxis

What the sensitivity is to.

§basis: Basis

Whose quote it is expressed against.

§aggregation: Aggregation

How it is collapsed for reporting.

§scale: Option<Scale>

The unit, where the caller stated one. None leaves it to the book’s Scales, then to the preset it was asked through, then to Scale::Unit — see Request.

§

Bumped(BumpedKind)

A sensitivity no single risk pass produces. Named so that the catalogue lists it beside its risk-pass sibling; report refuses it, naming the method that computes it.

Implementations§

§

impl Measure

pub fn sensitivity( axis: RiskAxis, basis: Basis, aggregation: Aggregation, scale: Option<Scale>, ) -> Self

A first-order sensitivity with every part stated: what the grammar spells delta:<axis>:<basis>:<aggregation>[:<scale>].

pub fn per_basis_point(self) -> Self

This measure read per basis point: the same rows, each × 1e-4.

pub fn delta(axis: RiskAxis) -> Self

The axis’s exposure at the curve-node basis, as one number — the reading a bare delta:<axis> names, and the one every earlier caller wrote.

pub fn par_ladder(axis: RiskAxis) -> Self

The axis’s exposure attributed to the instruments that calibrated it — one row per rung of each contributing curve’s ladder.

pub fn at(self, scale: Scale) -> Self

This measure reported in scale. A value and a bumped measure carry no scale and are returned as they are.

pub fn unscaled(self) -> Self

This measure with no stated scale — the point in measure space, which is what names it.

pub fn scale(self) -> Option<Scale>

The scale the caller stated, if any.

pub fn axis(self) -> Option<RiskAxis>

The axis the measure reads, or None for a value.

pub fn preset(self) -> Option<&'static Preset>

The preset naming this measure’s point, disregarding its scale.

pub fn name(self) -> String

What a report row is keyed by: the preset’s name where the measure is a preset, and its unscaled spelling otherwise. Unscaled, because a row states its scale in a column of its own — so rescaling a preset does not rename it.

Trait Implementations§

§

impl Clone for Measure

§

fn clone(&self) -> Measure

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl Copy for Measure

§

impl Debug for Measure

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
§

impl Display for Measure

The one spelling of a measure: npv, delta:<axis> in the axis’s own spelling with its basis, aggregation and stated scale, or a bumped measure’s catalogue name — what a caller writes.

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
§

impl Eq for Measure

§

impl From<Measure> for Request

§

fn from(measure: Measure) -> Self

Converts to this type from the input type.
§

impl FromStr for Measure

The inverse of Display, and a preset’s name besides.

§

type Err = MeasureParseError

The associated error which can be returned from parsing.
§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
§

impl Hash for Measure

§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
§

impl PartialEq for Measure

§

fn eq(&self, other: &Measure) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl StructuralPartialEq for Measure

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.