Skip to main content

Shift

Enum Shift 

#[non_exhaustive]
pub enum Shift { Parallel(f64), Slope { level: f64, per_year: f64, pivot_years: f64, }, Bucket { from: NaiveDate, to: NaiveDate, shift: f64, }, Tent { left: Option<NaiveDate>, peak: NaiveDate, right: Option<NaiveDate>, shift: f64, }, }
Expand description

How much a selected quote moves, and with what shape.

The amount is in the units the input is quoted in: a continuously compounded zero rate for a discount, projection, repo or security-spread curve, a hazard for a credit curve. Nothing here is expressed in the parameters a curve happens to store.

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

Parallel(f64)

The same move at every tenor.

§

Slope

level + per_year·(τ − pivot_years), τ in years from the curve’s own reference date — a steepener or a flattener.

Fields

§level: f64

The move at the pivot.

§per_year: f64

How much more the move is, per year beyond the pivot.

§pivot_years: f64

Where the slope pivots, in years.

§

Bucket

A move at the pillars inside [from, to] and nothing outside — one bucket of a key-rate ladder.

Fields

§from: NaiveDate

The first date the move reaches.

§to: NaiveDate

The last date the move reaches.

§shift: f64

The move inside the window.

§

Tent

shift at peak, falling linearly to nothing at left and at right and nothing beyond them; a missing corner holds shift flat on its side. One bucket of a triangular sensitivity ladder.

Fields

§left: Option<NaiveDate>

Where the move starts rising, or None to hold it flat before peak.

§peak: NaiveDate

Where the move is the whole of shift.

§right: Option<NaiveDate>

Where the move has fallen to nothing, or None to hold it flat after peak.

§shift: f64

The move at the peak.

Implementations§

§

impl Shift

fn name(self) -> &'static str

The shape’s name, for an error that has to say which one was asked for.

fn headline(self) -> f64

The amount a leg is written with: the parallel move, the slope’s move at its pivot, the bucket’s move inside its window.

fn at_expiry(self, expiry_years: f64, as_of: NaiveDate) -> f64

The move this shape asks for at a vol node expiring expiry_years after as_of, Act/365F: a bucket’s dates are measured the same way, so one rule places a node on every surface.

fn at_expiry_and_strike( self, expiry_years: f64, _strike: f64, as_of: NaiveDate, ) -> f64

The move this shape asks for at a surface node expiring expiry_years after as_of: a bucket’s dates are measured the same way; the strike is carried for the node identity, though no shape moves on it yet.

fn at(self, date: NaiveDate, tau: f64) -> f64

The move this shape asks for at date, tau years from the reference.

Trait Implementations§

§

impl Clone for Shift

§

fn clone(&self) -> Shift

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 Shift

§

impl Debug for Shift

§

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

Formats the value using the given formatter. Read more
§

impl PartialEq for Shift

§

fn eq(&self, other: &Shift) -> 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 Shift

Auto Trait Implementations§

§

impl Freeze for Shift

§

impl RefUnwindSafe for Shift

§

impl Send for Shift

§

impl Sync for Shift

§

impl Unpin for Shift

§

impl UnsafeUnpin for Shift

§

impl UnwindSafe for Shift

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.