Struct ZeroCouponInflationSwap
pub struct ZeroCouponInflationSwap {Show 13 fields
pub currency: Currency,
pub index: String,
pub collateral: CollateralSpec,
pub base_date: NaiveDate,
pub maturity: NaiveDate,
pub notional: f64,
pub fixed_rate: f64,
pub fixed_day_count: DayCountFraction,
pub fixed_compounding: AccrualCompounding,
pub lag_months: u32,
pub side: f64,
pub base_index: Option<f64>,
pub interpolation: Option<IndexInterpolation>,
}Expand description
A zero-coupon inflation swap: one payment each side at maturity, the inflation side paying the index’s growth over the swap’s life and the fixed side the growth its rate implies.
It holds two dates, not a base level. A base index frozen onto the trade
would be a market observation stored as contract data — the same mistake
IborCoupon documents for a
published fixing — and it would put the swap’s ratio on a different footing
from the linker’s, which reads its observation from the view. Both dates are
observed through PricingView::observed_index_level, so a printed fixing
at either end displaces the curve on exactly the rule a linker applies.
Fields§
§currency: CurrencyThe swap’s currency.
index: StringThe price index, by registry code.
collateral: CollateralSpecWhat the swap is collateralised against.
base_date: NaiveDateThe base date: the flow date whose lagged observation is the denominator of the swap’s index ratio.
maturity: NaiveDateMaturity: the single payment date of both sides, and the flow date whose lagged observation is the numerator.
notional: f64The notional.
fixed_rate: f64The fixed rate, as a decimal.
fixed_day_count: DayCountFractionThe fixed side’s day count over the whole life.
fixed_compounding: AccrualCompoundingHow the fixed rate accrues over the life. Compounded is the quoted
convention: a ZCIS is quoted as an annually compounded rate.
lag_months: u32The indexation lag, in whole months — the same rule a linker’s is.
side: f64+1 pays the fixed rate and receives inflation; −1 the reverse.
base_index: Option<f64>An agreed base index level, the ratio’s denominator in place of the
observed base. None observes it.
interpolation: Option<IndexInterpolation>How each observation reads inside the month, where the trade states
its own convention. None reads the index’s registered one.
Implementations§
§impl ZeroCouponInflationSwap
impl ZeroCouponInflationSwap
pub fn new(
currency: Currency,
index: impl Into<String>,
base_date: NaiveDate,
maturity: NaiveDate,
notional: f64,
fixed_rate: f64,
lag_months: u32,
) -> Self
pub fn new( currency: Currency, index: impl Into<String>, base_date: NaiveDate, maturity: NaiveDate, notional: f64, fixed_rate: f64, lag_months: u32, ) -> Self
A payer of the fixed rate on index, from base_date to maturity.
pub fn with_base_index(self, level: f64) -> Self
pub fn with_base_index(self, level: f64) -> Self
This swap’s index ratio over the agreed base level level rather than
the level observed for its base date.
pub fn with_interpolation(self, interpolation: IndexInterpolation) -> Self
pub fn with_interpolation(self, interpolation: IndexInterpolation) -> Self
This swap observing its index under interpolation rather than the
index’s registered convention.
pub fn receiver(self) -> Self
pub fn receiver(self) -> Self
The side receiving the fixed rate and paying inflation.
pub fn with_fixed_rate(self, fixed_rate: f64) -> Self
pub fn with_fixed_rate(self, fixed_rate: f64) -> Self
Sets the fixed rate.
pub fn accruing(
self,
day_count: DayCountFraction,
compounding: AccrualCompounding,
) -> Self
pub fn accruing( self, day_count: DayCountFraction, compounding: AccrualCompounding, ) -> Self
Sets the fixed side’s day count and compounding.
pub fn fixed_year_fraction(&self) -> f64
pub fn fixed_year_fraction(&self) -> f64
The fixed side’s year fraction over the whole life.
§impl ZeroCouponInflationSwap
impl ZeroCouponInflationSwap
pub fn index_ratio<R: Scalar>(
&self,
view: &PricingView<'_, R>,
) -> Result<R, PricingError>
pub fn index_ratio<R: Scalar>( &self, view: &PricingView<'_, R>, ) -> Result<R, PricingError>
The index ratio the swap pays on: the level observed for maturity over the level observed for the base date, or over the agreed base level where the swap states one.
§Errors
The product error if the view carries no inflation curve and no fixing covers an observation; otherwise whatever the curve reports.
pub fn fixed_amount(&self, rate: f64) -> f64
pub fn fixed_amount(&self, rate: f64) -> f64
The fixed side’s terminal amount at rate: N · (growth − 1) under the
swap’s compounding over its whole life — the same shape a
ZeroCouponSwap’s fixed side takes.
Trait Implementations§
§impl Clone for ZeroCouponInflationSwap
impl Clone for ZeroCouponInflationSwap
§fn clone(&self) -> ZeroCouponInflationSwap
fn clone(&self) -> ZeroCouponInflationSwap
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 ZeroCouponInflationSwap
impl Debug for ZeroCouponInflationSwap
§impl PartialEq for ZeroCouponInflationSwap
impl PartialEq for ZeroCouponInflationSwap
§fn eq(&self, other: &ZeroCouponInflationSwap) -> bool
fn eq(&self, other: &ZeroCouponInflationSwap) -> bool
self and other values to be equal, and is used by ==.§impl<R: Scalar> Priceable<R> for ZeroCouponInflationSwap
impl<R: Scalar> Priceable<R> for ZeroCouponInflationSwap
§fn npv(&self, view: &PricingView<'_, R>) -> Result<R, PricingError>
fn npv(&self, view: &PricingView<'_, R>) -> Result<R, PricingError>
side · (N·(ratio − 1) − fixed) · DF(maturity); nothing once the
payment date has passed.
§fn par_rate(&self, view: &PricingView<'_, R>) -> Result<R, PricingError>
fn par_rate(&self, view: &PricingView<'_, R>) -> Result<R, PricingError>
The breakeven inflation rate: the fixed rate whose terminal accrual matches the index’s growth. Both sides pay on the same date, so the discount factor cancels and the inversion is closed-form.
§fn par_spread(&self, _view: &PricingView<'_, R>) -> Result<R, PricingError>
fn par_spread(&self, _view: &PricingView<'_, R>) -> Result<R, PricingError>
Unsupported: a zero-coupon inflation swap is quoted as a rate, and a margin over an index ratio is not a spread any contract carries.
§impl PricingRiskFactors for ZeroCouponInflationSwap
impl PricingRiskFactors for ZeroCouponInflationSwap
§fn risk_factors(&self) -> Result<RiskFactors<'_>, PricingError>
fn risk_factors(&self) -> Result<RiskFactors<'_>, PricingError>
§impl Product for ZeroCouponInflationSwap
impl Product for ZeroCouponInflationSwap
§fn currency(&self) -> Currency
fn currency(&self) -> Currency
§fn contract_dates(&self) -> Vec<(&'static str, NaiveDate)>
fn contract_dates(&self) -> Vec<(&'static str, NaiveDate)>
(name, date) pairs —
exactly the dates its stated constructor takes, so a product built
through a derived form can be read back and rebuilt through the stated
one. Empty for a product with no stated form. No default: every
product states which it is — see AnyInstrument::contract_dates.§fn legs(&self) -> Option<Vec<&Leg>>
fn legs(&self) -> Option<Vec<&Leg>>
None
for a product that holds none — see AnyInstrument::legs. No
default: every product states which it is.§fn final_payment_date(&self) -> Option<NaiveDate>
fn final_payment_date(&self) -> Option<NaiveDate>
None for a product no ladder is built from.§fn restruck_at_rate(&self, _rate: f64) -> Option<AnyInstrument>
fn restruck_at_rate(&self, _rate: f64) -> Option<AnyInstrument>
rate — the scalar a par
calibration rung on it is quoted in — or None for a product that
carries no such scalar. What a quote scenario moves a rung to.§fn restruck_at_spread(&self, _spread: f64) -> Option<AnyInstrument>
fn restruck_at_spread(&self, _spread: f64) -> Option<AnyInstrument>
spread on its spread
leg, or None for a product that quotes none.