Skip to main content

MultiResetCoupon

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: NaiveDate

Accrual start.

§accrual_end: NaiveDate

Accrual end.

§payment_date: NaiveDate

Payment date.

§payment_ordinal: i32

The payment date as a proleptic-Gregorian day number.

§notional: f64

The notional the coupon accrues on.

§gearing: f64

Multiplicative gearing on each reset’s rate.

§spread: f64

Additive spread, as a decimal; how it enters is the method’s.

§index: String

The index the resets fix on.

§day_count: DayCountFraction

The accrual day count.

§accrual: f64

Σ τᵢ over the resets — the accrual the coupon’s rate is quoted over.

§currency: Currency

The coupon’s currency.

§resets: Vec<Reset>

The resets, in order, tiling the accrual.

§method: ResetCompounding

How 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

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>

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>

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>

Each reset’s index rate, in order, before gearing and spread: the rates rate_with compounds, read off the same curves and fixings, so a report of the parts cannot drift from the whole.

§Errors

As rate_with.

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>

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>

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

§

fn clone(&self) -> MultiResetCoupon

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl Debug for MultiResetCoupon

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
§

impl PartialEq for MultiResetCoupon

§

fn eq(&self, other: &MultiResetCoupon) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl StructuralPartialEq for MultiResetCoupon

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.