Struct ShockedInflation
pub struct ShockedInflation {
base: Box<Inflation>,
knots: Vec<(NaiveDate, f64)>,
label: String,
}Expand description
A base inflation curve under a named move in its zero inflation rate.
The curve projects an index as I(T) = I(base)·(1 + z)^t — z the curve’s
annually compounded zero inflation rate, t the year fraction from its base
date — and a zero-coupon inflation swap is quoted in the same z. A
“breakeven +10bp” is z + 0.0010, so this reads the base’s level, recovers
its z, moves it by Δ(T) and projects again:
I'(T) = I(base)·((I(T)/I(base))^(1/t) + Δ(T))^t.
The base date is the base curve’s first node — its anchor, the level it
reproduces and seasonality is normalised against — and t runs on the
base’s own day count. A level at or before the base date is history and
does not move.
The move is stated data carrying a label, not a free parameter, as for the other families’ shocks: a shocked market lifts to the same vector as its base.
Fields§
§base: Box<Inflation>§knots: Vec<(NaiveDate, f64)>(date, Δ) knots, interpolated linearly and flat beyond either end —
one knot for a parallel move.
label: StringImplementations§
§impl ShockedInflation
impl ShockedInflation
pub fn parallel(base: Inflation, shift: f64, label: impl Into<String>) -> Self
pub fn parallel(base: Inflation, shift: f64, label: impl Into<String>) -> Self
base with its zero inflation rate moved by shift at every date,
reported under label.
pub fn dated(
base: Inflation,
knots: &[(NaiveDate, f64)],
label: impl Into<String>,
) -> Result<Self, CurveError>
pub fn dated( base: Inflation, knots: &[(NaiveDate, f64)], label: impl Into<String>, ) -> Result<Self, CurveError>
base with its zero inflation rate moved by Δ(T), linear between the
dated knots and flat beyond them, reported under label.
§Errors
CurveError::Malformed if there are no knots, or if their dates do
not strictly ascend; CurveError::NonFinite for a move that is not
finite.
pub fn view<R: Scalar>(&self) -> ShockedInflationView<'_, R>
pub fn view<R: Scalar>(&self) -> ShockedInflationView<'_, R>
This transform lifted into mode R.
pub(crate) fn view_with_slice<'a, R: Scalar>(
&'a self,
rest: &mut &'a [R],
) -> ShockedInflationView<'a, R>
pub(crate) fn view_with_slice<'a, R: Scalar>( &'a self, rest: &mut &'a [R], ) -> ShockedInflationView<'a, R>
One step of a substituted walk. Reaches the base only: the move is stated data, not a parameter.
pub(crate) fn view_seeding<R: Scalar + Seedable>(
&self,
seed: &mut Option<usize>,
) -> ShockedInflationView<'_, R>
pub(crate) fn view_seeding<R: Scalar + Seedable>( &self, seed: &mut Option<usize>, ) -> ShockedInflationView<'_, R>
One step of the seeded walk. The seed reaches the base only.
Trait Implementations§
§impl Clone for ShockedInflation
impl Clone for ShockedInflation
§fn clone(&self) -> ShockedInflation
fn clone(&self) -> ShockedInflation
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for ShockedInflation
impl Debug for ShockedInflation
§impl PartialEq for ShockedInflation
impl PartialEq for ShockedInflation
§fn eq(&self, other: &ShockedInflation) -> bool
fn eq(&self, other: &ShockedInflation) -> bool
self and other values to be equal, and is used by ==.