Struct MultiResetCoupon
pub struct MultiResetCoupon {Show 14 fields
pub accrual_start: NaiveDate,
pub accrual_end: NaiveDate,
pub payment_date: NaiveDate,
pub payment_ordinal: i32,
pub notional: f64,
pub gearing: f64,
pub spread: f64,
pub index: String,
pub day_count: DayCountFraction,
pub accrual: f64,
pub currency: Currency,
pub resets: Vec<Reset>,
pub method: ResetCompounding,
pub stub: Option<InterpolatedStub>,
}Expand description
A floating coupon that resets several times and pays once: each reset’s
term rate, geared, combined over the accrual under a ResetCompounding
method — the CAD, HKD or 3M-in-6M leg that pays less often than it fixes.
Each reset follows the one fixing rule
(FixingsView::observe) and otherwise projects the simple forward over
its own index window, as an IborCoupon does.
Fields§
§accrual_start: NaiveDateAccrual start.
accrual_end: NaiveDateAccrual end.
payment_date: NaiveDatePayment date.
payment_ordinal: i32The payment date as a proleptic-Gregorian day number.
notional: f64The notional the coupon accrues on.
gearing: f64Multiplicative gearing on each reset’s rate.
spread: f64Additive spread, as a decimal; how it enters is the method’s.
index: StringThe index the resets fix on.
day_count: DayCountFractionThe accrual day count.
accrual: f64Σ τᵢ over the resets — the accrual the coupon’s rate is quoted over.
currency: CurrencyThe coupon’s currency.
resets: Vec<Reset>The resets, in order, tiling the accrual.
method: ResetCompoundingHow the resets combine.
stub: Option<InterpolatedStub>The ISDA 2006 §8.3 blend the final reset reads, where the coupon was
built under StubRule::Interpolated
and its final sub-period is one the index’s own window does not fit;
None where every reset reads its own window.
Implementations§
§impl MultiResetCoupon
impl MultiResetCoupon
pub fn on_index(
index: &IborIndex,
accrual_start: NaiveDate,
accrual_end: NaiveDate,
payment_date: NaiveDate,
notional: f64,
day_count: DayCountFraction,
currency: Currency,
reset_tenor: Period,
gearing: f64,
spread: f64,
method: ResetCompounding,
stub: &StubRule,
) -> Result<Self, StubInterpolationError>
pub fn on_index( index: &IborIndex, accrual_start: NaiveDate, accrual_end: NaiveDate, payment_date: NaiveDate, notional: f64, day_count: DayCountFraction, currency: Currency, reset_tenor: Period, gearing: f64, spread: f64, method: ResetCompounding, stub: &StubRule, ) -> Result<Self, StubInterpolationError>
A coupon over [accrual_start, accrual_end) resetting every
reset_tenor on index: sub-periods advanced from the start on the
index’s calendar and convention and capped at the end, each fixing on
the index’s own lag and projecting over the index’s own window.
A final sub-period the index’s window does not fit — the reset tenor
does not divide the period — reads the index as stub says: its full
Designated Maturity (StubRule::IndexTenor),
its own sub-period (StubRule::OwnAccrual), or the ISDA 2006 §8.3
blend of two tenors (StubRule::Interpolated, see
interpolated_stub).
§Errors
StubInterpolationError where an interpolated final sub-period’s
tenors are out of order or do not bracket it.
pub fn rate<R: Scalar>(
&self,
fwd: Option<&dyn YieldCurve<R>>,
fixings: &FixingsView<'_, R>,
as_of: NaiveDate,
) -> Result<R, CashflowError>
pub fn rate<R: Scalar>( &self, fwd: Option<&dyn YieldCurve<R>>, fixings: &FixingsView<'_, R>, as_of: NaiveDate, ) -> Result<R, CashflowError>
The coupon’s effective rate in mode R: the combined amount per unit
notional, over the accrual, so that amount = N·rate·τ as for every
other coupon.
§Errors
CashflowError::MarketData for a missing historical fixing;
CashflowError::Curve for a curve query, or where a reset needs a
projection and no forward curve was supplied;
CashflowError::InterpolatedStubOnOneCurve for a coupon whose final
reset blends two tenors, which one curve cannot price.
pub fn rate_with<R: Scalar, C: CurveByIndex<R> + ?Sized>(
&self,
curves: &C,
fixings: &FixingsView<'_, R>,
as_of: NaiveDate,
) -> Result<R, CashflowError>
pub fn rate_with<R: Scalar, C: CurveByIndex<R> + ?Sized>( &self, curves: &C, fixings: &FixingsView<'_, R>, as_of: NaiveDate, ) -> Result<R, CashflowError>
The coupon’s rate with each index it reads priced off its own curve: every reset off the coupon’s index, and an interpolated final reset the ISDA 2006 §8.3 blend of its two tenors, each off its own.
§Errors
As rate, and CashflowError::NoCurveForIndex naming
an index whose curve curves does not hold.
pub fn reset_rates_with<R: Scalar, C: CurveByIndex<R> + ?Sized>(
&self,
curves: &C,
fixings: &FixingsView<'_, R>,
as_of: NaiveDate,
) -> Result<Vec<R>, CashflowError>
pub fn reset_rates_with<R: Scalar, C: CurveByIndex<R> + ?Sized>( &self, curves: &C, fixings: &FixingsView<'_, R>, as_of: NaiveDate, ) -> Result<Vec<R>, CashflowError>
fn index_rate_with<R: Scalar, C: CurveByIndex<R> + ?Sized>(
&self,
i: usize,
reset: &Reset,
curves: &C,
fixings: &FixingsView<'_, R>,
as_of: NaiveDate,
) -> Result<R, CashflowError>
fn index_rate_with<R: Scalar, C: CurveByIndex<R> + ?Sized>( &self, i: usize, reset: &Reset, curves: &C, fixings: &FixingsView<'_, R>, as_of: NaiveDate, ) -> Result<R, CashflowError>
Reset i’s index rate: the interpolated blend for a final stub reset,
otherwise the coupon’s index off its own curve.
fn combine<R: Scalar>(
&self,
index_rate: impl FnMut(usize, &Reset) -> Result<R, CashflowError>,
) -> Result<R, CashflowError>
fn combine<R: Scalar>( &self, index_rate: impl FnMut(usize, &Reset) -> Result<R, CashflowError>, ) -> Result<R, CashflowError>
The resets’ index rates, geared, combined under the coupon’s method into its effective rate: the one place the ISDA formulas are written.
fn reset_rate<R: Scalar>(
&self,
reset: &Reset,
fwd: Option<&dyn YieldCurve<R>>,
fixings: &FixingsView<'_, R>,
as_of: NaiveDate,
) -> Result<R, CashflowError>
fn reset_rate<R: Scalar>( &self, reset: &Reset, fwd: Option<&dyn YieldCurve<R>>, fixings: &FixingsView<'_, R>, as_of: NaiveDate, ) -> Result<R, CashflowError>
One reset’s index rate: observed where the fixing rule says so, else the simple forward over its window.
Trait Implementations§
§impl Clone for MultiResetCoupon
impl Clone for MultiResetCoupon
§fn clone(&self) -> MultiResetCoupon
fn clone(&self) -> MultiResetCoupon
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 MultiResetCoupon
impl Debug for MultiResetCoupon
§impl PartialEq for MultiResetCoupon
impl PartialEq for MultiResetCoupon
§fn eq(&self, other: &MultiResetCoupon) -> bool
fn eq(&self, other: &MultiResetCoupon) -> bool
self and other values to be equal, and is used by ==.