Skip to main content

PredictedPnl

Struct PredictedPnl 

pub struct PredictedPnl {
    pub rows: Vec<(MarketInputId, f64)>,
    pub quadratic: f64,
    pub gamma: GammaTerms,
    pub resets: f64,
    pub before: f64,
    pub after: f64,
    pub residual: f64,
}
Expand description

A predicted explain: first order per input, second order along the move.

Fields§

§rows: Vec<(MarketInputId, f64)>

risk_i · Δ_i per input, in lift order.

§quadratic: f64

½ Δᵀ H Δ, from one directional second-order valuation.

§gamma: GammaTerms

The quadratic split by the axis groups that moved: own gamma per group, cross gamma per pair, and the closure of the split.

§resets: f64

The reset step: the exact revaluation from each new print’s forecast to the print, for the prints the ending market holds and the starting market does not. Zero when there are none. The first and second order are taken from the market with the prints, so resets + first_order + quadratic + residual is after − before.

§before: f64

The book’s value against the starting market — with each new print standing at the forecast it replaced, where there are any, since a market lacking a print the book has accrued does not value.

§after: f64

The book’s value against the ending market.

§residual: f64

after − before − resets − Σ rows − quadratic: what the reset step and the first and second order do not explain.

Implementations§

§

impl PredictedPnl

pub fn first_order(&self) -> f64

The first-order total.

pub fn actual(&self) -> f64

The actual P&L, after − before.

pub fn own_gamma(&self) -> &[(Option<RiskAxis>, f64)]

The quadratic’s own-gamma terms, one per moved group: GammaTerms::own.

pub fn cross_gamma(&self) -> &[(Option<RiskAxis>, Option<RiskAxis>, f64)]

The quadratic’s cross-gamma terms, one per moved pair: GammaTerms::cross.

pub fn gamma_closure(&self) -> f64

quadratic less the own and cross terms: GammaTerms::closure.

pub fn by_axis(&self) -> Vec<(Option<RiskAxis>, f64)>

The first-order rows rolled up by axis, None for inputs on no axis, in RiskAxis::ALL order followed by the off-axis total.

Trait Implementations§

§

impl Clone for PredictedPnl

§

fn clone(&self) -> PredictedPnl

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 Debug for PredictedPnl

§

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

Formats the value using the given formatter. Read more

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, 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.