Skip to main content

MoneyMarketDeposit

Struct MoneyMarketDeposit 

pub struct MoneyMarketDeposit {
    pub currency: Currency,
    pub collateral: CollateralSpec,
    pub start: NaiveDate,
    pub maturity: NaiveDate,
    pub day_count: DayCountFraction,
    pub notional: f64,
    pub rate: f64,
    pub side: f64,
    pub index: Option<String>,
    pub issuer: Option<CreditCurveId>,
}
Expand description

A money-market deposit: principal lent at the start, principal and one simple accrual returned at maturity.

The simplest instrument in the crate — two dates, one rate, no schedule, no leg — and the standard first pillar of a real short end.

It names no index and reads no fixing. That is the whole reason it can calibrate. An overnight deposit starting on the valuation date has, by construction, a published rate for its start date — that is what an overnight rate is. A contract that read it would have a value independent of the curve node it is meant to determine, so the ladder would report the pillar insensitive or leave it where it started.

Carrying no index at all is a stronger guarantee than a rule against consulting one: there is nothing here to look up.

Fields§

§currency: Currency

The deposit’s currency.

§collateral: CollateralSpec

What the deposit is collateralised against — a deposit is self-discounting, so this is the only curve it names.

§start: NaiveDate

The date principal is lent on.

§maturity: NaiveDate

The date principal and interest return.

§day_count: DayCountFraction

The accrual day count.

§notional: f64

The notional.

§rate: f64

The simple deposit rate, as a decimal.

§side: f64

+1 lends — principal paid at the start, principal and interest received at maturity; −1 borrows. The same orientation the forward-rate agreement’s side carries.

§index: Option<String>

The term index the deposit fixes on, by registry code, where it is one: both its flows then discount on that index’s projection curve, and the deposit pins that curve’s forward over its term. None is the plain self-discounting deposit.

§issuer: Option<CreditCurveId>

The deposit taker’s credit, when the maturity flow is valued risky: survival weights it, and default recovers on the principal. A deposit on a term index is a curve rung and carries none.

Implementations§

§

impl MoneyMarketDeposit

pub fn new( currency: Currency, start: NaiveDate, maturity: NaiveDate, day_count: DayCountFraction, notional: f64, rate: f64, ) -> Self

A deposit lent over [start, maturity], collateralised in its own currency.

pub fn on_index(self, index: impl Into<String>) -> Self

This deposit fixing on the term index (a registry code): valued on that index’s projection curve rather than its discount curve.

pub fn from_template( template: &DepositTemplate, start: NaiveDate, tenor: Period, notional: f64, rate: f64, ) -> Self

A deposit from its template: the currency and day count are the template’s, and the maturity is start advanced by tenor on the template’s calendar under its business-day convention.

A caller who already knows the exact maturity — a market pillar quoted to a date rather than to a tenor — builds through new with the template’s conventions instead, so no convention silently moves a date the caller gave.

pub fn borrower(self) -> Self

The side borrowing rather than lending.

pub fn issued_by(self, credit: CreditCurveId) -> Result<Self, &'static str>

Tags the deposit to its taker’s credit, whichever side books it.

§Errors

A deposit on a term index: it is a curve rung, with no counterparty.

pub fn year_fraction(&self) -> f64

The accrual year fraction.

§

impl MoneyMarketDeposit

fn curve<'v, 'a, R: Scalar>( &self, view: &'v PricingView<'a, R>, ) -> &'v ResolvedCurve<'a, R>

The curve both flows discount on: the index’s projection where the deposit fixes on one, the discount curve otherwise.

Trait Implementations§

§

impl Clone for MoneyMarketDeposit

§

fn clone(&self) -> MoneyMarketDeposit

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 MoneyMarketDeposit

§

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

Formats the value using the given formatter. Read more
§

impl PartialEq for MoneyMarketDeposit

§

fn eq(&self, other: &MoneyMarketDeposit) -> 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<R: Scalar> Priceable<R> for MoneyMarketDeposit

§

fn npv(&self, view: &PricingView<'_, R>) -> Result<R, PricingError>

side · N · (−DF(start) + (1 + r·τ)·DF(maturity)), wholly off the discount curve.

Nothing is read from the fixing store. An overnight deposit starting on the valuation date has a published rate for its start date by construction — that is what an overnight rate is — and a contract that read it would have a value independent of the curve node it exists to determine. The ladder would then report the pillar insensitive, or pin it.

Three datings, and the middle one is where a deposit parts company with a FRA. A FRA is worth nothing once its settlement date has passed, because it has cash-settled. A deposit past its start has not settled: the principal went out, and the maturity flow is still owed.

§

fn par_rate(&self, view: &PricingView<'_, R>) -> Result<R, PricingError>

The fair simple rate: (DF(start)/DF(maturity) − 1)/τ, at which the deposit is worth nothing.

This is the same expression the value is built from, evaluated for the rate rather than for the money — so the quote and the valuation cannot disagree about what par means.

§

fn par_spread(&self, view: &PricingView<'_, R>) -> Result<R, PricingError>

The par rate less the stated rate: zero for a deposit struck at par.

§

impl PricingRiskFactors for MoneyMarketDeposit

§

fn risk_factors(&self) -> Result<RiskFactors<'_>, PricingError>

A deposit is self-discounting: the same curve carries both principal flows, so it declares a discount key and no projection. It names no index, so there is none to project off.

§

impl Product for MoneyMarketDeposit

§

fn restruck_at_rate(&self, rate: f64) -> Option<AnyInstrument>

This product re-struck at the par rate 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 currency(&self) -> Currency

The currency the product pays in. An FX product values in its quote currency; a book converts.
§

fn contract_dates(&self) -> Vec<(&'static str, NaiveDate)>

The contract dates the product resolved to, as (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>>

The legs the product itself holds, in a declared order, or 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>

The date of the product’s final payment, where a calibration rung can be built on it; None for a product no ladder is built from.
§

fn restruck_at_spread(&self, _spread: f64) -> Option<AnyInstrument>

This product re-struck at the basis spread spread on its spread leg, or None for a product that quotes none.
§

impl StructuralPartialEq for MoneyMarketDeposit

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.