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: NaiveDateAccrual start.
accrual_end: NaiveDateAccrual end.
payment_date: NaiveDatePayment date.
notional: f64The notional the coupon accrues on.
gearing: f64Multiplicative gearing on the compounded rate.
spread: f64Additive spread, as a decimal.
day_count: DayCountFractionThe accrual day count.
accrual: f64The accrual year fraction under day_count, evaluated once at build.
payment_ordinal: i32The 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: CurrencyThe coupon’s currency.
index: StringThe 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: boolWhether every observation’s weight equals its tau — no lookback or
cut-off — decided once at build with total_tau.
contiguous: boolWhether each observation ends where the next starts, decided once at
build with total_tau.
accumulation: AccrualCompoundingHow 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
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>
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)>
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
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>
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
impl OvernightCoupon
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 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
impl Clone for OvernightCoupon
§fn clone(&self) -> OvernightCoupon
fn clone(&self) -> OvernightCoupon
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more