Struct InterestRateCapFloor
pub struct InterestRateCapFloor {
pub leg: Leg,
pub strike: f64,
pub kind: CapFloorKind,
pub currency: Currency,
pub index: String,
pub tenor_years: f64,
pub collateral: CollateralSpec,
}Expand description
A strip of caplets or floorlets on a registered term index.
Fields§
§leg: LegThe index’s own coupons between the two dates, received.
strike: f64The strike rate every caplet is struck at.
kind: CapFloorKindCap or floor.
currency: CurrencyThe currency the strip pays in.
index: StringThe registry code of the index each coupon resets on.
tenor_years: f64The strip’s coupon frequency in years — the second axis the cap vol surface is read on. For a term index this is its tenor; for an overnight index it is the stated frequency, because a quarterly overnight cap reads a quarterly column and not a one-day one.
collateral: CollateralSpecThe discounting the strip is priced on.
Implementations§
§impl InterestRateCapFloor
impl InterestRateCapFloor
pub fn new(
index: &IborIndex,
effective: NaiveDate,
termination: NaiveDate,
notional: f64,
strike: f64,
kind: CapFloorKind,
) -> Result<Self, CapFloorError>
pub fn new( index: &IborIndex, effective: NaiveDate, termination: NaiveDate, notional: f64, strike: f64, kind: CapFloorKind, ) -> Result<Self, CapFloorError>
A kind strip on index from effective to termination, on
notional, struck at strike. The schedule and the coupons are the
index’s: its tenor, calendar, roll convention, end-of-month rule and
day count, with each coupon fixing on the index’s own lag and
projecting as every term coupon does — a regular period over the
index’s own window, a stub over its accrual — so a cap less a floor at
one strike is the swap on the same dates.
§Errors
CapFloorError::NonFiniteStrike for a NaN or infinite strike;
CapFloorError::EmptyStrip if no coupon accrues between the dates.
§Panics
If the index’s currency code is not an ISO code — a registered index always carries one.
pub fn on_overnight(
index: &OvernightIndex,
effective: NaiveDate,
termination: NaiveDate,
frequency: Period,
notional: f64,
strike: f64,
kind: CapFloorKind,
) -> Result<Self, CapFloorError>
pub fn on_overnight( index: &OvernightIndex, effective: NaiveDate, termination: NaiveDate, frequency: Period, notional: f64, strike: f64, kind: CapFloorKind, ) -> Result<Self, CapFloorError>
A kind strip on an overnight index from effective to
termination at frequency, on notional, struck at strike.
Each coupon compounds the index’s daily prints over its own accrual period — the observation strip an overnight swap leg builds, on the index’s publication calendar and day count. So the underlying of each caplet is a rate that is not known until its period ends, which is what the pricer reads off the coupon kind.
The surface’s second axis is frequency, not the index’s one-day
tenor.
§Errors
CapFloorError::NonFiniteStrike for a NaN or infinite strike;
CapFloorError::EmptyStrip if no coupon accrues between the dates.
§Panics
If the index’s currency code is not an ISO code — a registered index always carries one.
pub fn on_coupons(
coupons: Vec<AnyCoupon>,
strike: f64,
kind: CapFloorKind,
currency: Currency,
index: impl Into<String>,
tenor_years: f64,
collateral: CollateralSpec,
) -> Result<Self, CapFloorError>
pub fn on_coupons( coupons: Vec<AnyCoupon>, strike: f64, kind: CapFloorKind, currency: Currency, index: impl Into<String>, tenor_years: f64, collateral: CollateralSpec, ) -> Result<Self, CapFloorError>
A strip on coupons already compiled — a note’s own — struck at
strike: the term-index coupons among them, taken as they are. What a
capped or floored note prices its option on, so the two share every
fixing, accrual and payment date by construction.
§Errors
CapFloorError::NonFiniteStrike for a NaN or infinite strike;
CapFloorError::EmptyStrip if no term-index coupon is among them.
pub fn without_first_caplet(self) -> Result<Self, CapFloorError>
pub fn without_first_caplet(self) -> Result<Self, CapFloorError>
This strip without its first caplet — the market’s cap. A cap traded at spot has a first coupon whose rate is fixed at trade, so the market quotes and prices the strip from the second caplet on. A strip of one caplet excluded is empty, and is refused.
§Errors
CapFloorError::EmptyStrip if no caplet would remain.
§impl InterestRateCapFloor
impl InterestRateCapFloor
pub fn caplets(
&self,
view: &PricingView<'_, f64>,
) -> Result<Vec<Caplet>, PricingError>
pub fn caplets( &self, view: &PricingView<'_, f64>, ) -> Result<Vec<Caplet>, PricingError>
The strip’s caplets on the derivative-free projection, in payment order, coupons already paid omitted — the inputs a stripper prices with the kernel directly.
§Errors
As Priceable::npv, less the surface: no cap vol is read.
Trait Implementations§
§impl Clone for InterestRateCapFloor
impl Clone for InterestRateCapFloor
§fn clone(&self) -> InterestRateCapFloor
fn clone(&self) -> InterestRateCapFloor
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 InterestRateCapFloor
impl Debug for InterestRateCapFloor
§impl PartialEq for InterestRateCapFloor
impl PartialEq for InterestRateCapFloor
§fn eq(&self, other: &InterestRateCapFloor) -> bool
fn eq(&self, other: &InterestRateCapFloor) -> bool
self and other values to be equal, and is used by ==.§impl<R: Scalar> Priceable<R> for InterestRateCapFloor
impl<R: Scalar> Priceable<R> for InterestRateCapFloor
§fn npv(&self, view: &PricingView<'_, R>) -> Result<R, PricingError>
fn npv(&self, view: &PricingView<'_, R>) -> Result<R, PricingError>
Σ N·τᵢ·DF(payᵢ)·Black-or-Bachelier(Fᵢ, K, σ(Tᵢ, tenor, K), Tᵢ) over the
strip’s coupons, with Fᵢ each coupon’s own projected rate (a fixing
already observed reads the store), Tᵢ the year fraction to its
fixing — or, for a coupon compounding an overnight index, the accrual
end it is keyed on and the effective variance S + (E − S)/3 it accrues
over — the formula chosen by the surface’s convention and σ read at
the cap’s own strike in the mode so vega per node flows — a surface
quoted at the money answers every strike alike. A coupon fixed on or before the
valuation date takes T = 0, and both kernels return intrinsic at
zero variance.
§fn par_rate(&self, view: &PricingView<'_, R>) -> Result<R, PricingError>
fn par_rate(&self, view: &PricingView<'_, R>) -> Result<R, PricingError>
The strip’s at-the-money rate Σ N·τ·DF·F / Σ N·τ·DF — the strike at
which a cap and a floor are worth the same.
§fn par_spread(&self, _view: &PricingView<'_, R>) -> Result<R, PricingError>
fn par_spread(&self, _view: &PricingView<'_, R>) -> Result<R, PricingError>
§impl PricingRiskFactors for InterestRateCapFloor
impl PricingRiskFactors for InterestRateCapFloor
§fn risk_factors(&self) -> Result<RiskFactors<'_>, PricingError>
fn risk_factors(&self) -> Result<RiskFactors<'_>, PricingError>
Discounts on the strip’s collateral, projects its index and reads the currency’s cap vol surface.
§impl Product for InterestRateCapFloor
impl Product for InterestRateCapFloor
§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.