Skip to main content

OvernightCoupon

Struct OvernightCoupon 

pub struct OvernightCoupon {
Show 19 fields pub accrual_start: NaiveDate, pub accrual_end: NaiveDate, pub payment_date: NaiveDate, pub notional: f64, pub gearing: f64, pub spread: f64, pub day_count: DayCountFraction, pub accrual: f64, pub payment_ordinal: i32, pub currency: Currency, pub index: String, pub observations: Vec<Observation>, pub total_tau: f64, pub plain_weights: bool, pub contiguous: bool, pub accumulation: AccrualCompounding, pub payoff: Option<RatePayoff>, pub observation_cap: Option<f64>, pub observation_floor: Option<f64>,
}
Expand description

A compounded overnight (RFR) coupon.

The period rate is accumulate(rᵢ, τᵢ) / Στ, geared and spread, where the accumulation is the coupon’s own — ∏(1 + rᵢ·τᵢ) − 1 compounded, Σ rᵢ·τᵢ averaged. A day that has fixed contributes its realised rate; a day that has not contributes the projected overnight forward, so an in-progress period blends the two, whichever way they combine.

Fields§

§accrual_start: NaiveDate

Accrual start.

§accrual_end: NaiveDate

Accrual end.

§payment_date: NaiveDate

Payment date.

§notional: f64

The notional the coupon accrues on.

§gearing: f64

Multiplicative gearing on the compounded rate.

§spread: f64

Additive spread, as a decimal.

§day_count: DayCountFraction

The accrual day count.

§accrual: f64

The accrual year fraction under day_count, evaluated once at build.

§payment_ordinal: i32

The payment date as a proleptic-Gregorian day number, computed once at build. The observation strip carries dates; only the payment is queried by ordinal.

§currency: Currency

The coupon’s currency.

§index: String

The overnight index this coupon observes.

§observations: Vec<Observation>

The daily observations, in order.

§total_tau: f64

Σ weight over observations, summed once at build — the denominator of the rate, whichever way the observations combine.

§plain_weights: bool

Whether every observation’s weight equals its tau — no lookback or cut-off — decided once at build with total_tau.

§contiguous: bool

Whether each observation ends where the next starts, decided once at build with total_tau.

§accumulation: AccrualCompounding

How the daily observations combine into one coupon rate.

Compounded is the SOFR and ESTR convention, (Π(1 + rᵢ·τᵢ) − 1)/Στ; Simple is the Fed Funds and Prime one, Σ(rᵢ·τᵢ)/Στ. They share this coupon’s whole machinery — the strip, the fixings-first rule, the gearing and spread — and differ in nothing else, which is why this is a field and not a second variant.

Continuous is not admitted: no market accrues an overnight leg that way, and the number it would produce reconciles to nothing. See OvernightCoupon::new.

§payoff: Option<RatePayoff>

An option on the coupon’s compounded rate — a cap and floor, or a digital — or None for a plain coupon.

§observation_cap: Option<f64>

The cap on each daily rate before it accumulates, as a decimal.

§observation_floor: Option<f64>

The floor on each daily rate before it accumulates, as a decimal.

Implementations§

§

impl OvernightCoupon

pub fn new( accrual_start: NaiveDate, accrual_end: NaiveDate, payment_date: NaiveDate, notional: f64, gearing: f64, spread: f64, day_count: DayCountFraction, currency: Currency, index: &str, observations: Vec<Observation>, accumulation: AccrualCompounding, ) -> Result<Self, OvernightCouponError>

Builds one overnight coupon, deriving the three fields that are a function of the others — the accrual year fraction, the payment ordinal, and Στ — so no caller can set them inconsistently.

§Errors

OvernightCouponError::ContinuousAccumulation if accumulation is AccrualCompounding::Continuous. The vocabulary carries three compoundings and an overnight leg admits two of them; this is the seam where the third is turned away.

This is a checked constructor, not a gate: the struct’s fields are public, as every cashflow’s are, so a literal can still be written around it. The refusal that runs for every coupon however it was built is in AnyCoupon::rate, which errors rather than returning a number no market would recognise.

pub fn option_times(&self, as_of: NaiveDate) -> Option<(NaiveDate, f64, f64)>

The times an option on this coupon’s rate reads, as of as_of: the vol at the last fixing, and the variance over the first fixing plus a third of the fixings still ahead, measured on the fixing dates rather than the accrual dates. A period under way floors its first fixing at today. None for a coupon with no observations.

fn fully_fixed<R: Scalar>( &self, fixings: &FixingsView<'_, R>, as_of: NaiveDate, ) -> bool

Whether every observation has fixed as of as_of: the last is before today, or today and published.

fn optioned_rate<R: Scalar, C: CurveByIndex<R> + ?Sized>( &self, payoff: &RatePayoff, curves: &C, fixings: &FixingsView<'_, R>, as_of: NaiveDate, ) -> Result<R, CashflowError>

The rate an overnight coupon carrying an option on its rate is worth: once every observation has fixed, the payoff settled on the realised rate; before, the options priced off the cap vols over option_times.

§

impl OvernightCoupon

pub fn rate<R: Scalar>( &self, fwd: Option<&dyn YieldCurve<R>>, fixings: &FixingsView<'_, R>, as_of: NaiveDate, ) -> Result<R, CashflowError>

The coupon’s rate in mode R, as of as_of: its daily observations accumulated — realised days from fixings, today’s if it has printed, the rest projected off fwd — geared and spread.

The one place the strip becomes a rate, shared by the coupon and by a future settling on the same strip.

§Errors

CashflowError::MarketData for a missing historical fixing; CashflowError::Curve for a curve query, or where a day needs a projection and no forward curve was supplied.

Trait Implementations§

§

impl Clone for OvernightCoupon

§

fn clone(&self) -> OvernightCoupon

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 OvernightCoupon

§

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

Formats the value using the given formatter. Read more
§

impl PartialEq for OvernightCoupon

§

fn eq(&self, other: &OvernightCoupon) -> 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 OvernightCoupon

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.