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
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
Bucket
A move at the pillars inside [from, to] and nothing outside — one
bucket of a key-rate ladder.
Fields
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.
Implementations§
§impl Shift
impl Shift
fn name(self) -> &'static str
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
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
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
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.