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: CurrencyThe deposit’s currency.
collateral: CollateralSpecWhat the deposit is collateralised against — a deposit is self-discounting, so this is the only curve it names.
start: NaiveDateThe date principal is lent on.
maturity: NaiveDateThe date principal and interest return.
day_count: DayCountFractionThe accrual day count.
notional: f64The notional.
rate: f64The 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
impl MoneyMarketDeposit
pub fn new(
currency: Currency,
start: NaiveDate,
maturity: NaiveDate,
day_count: DayCountFraction,
notional: f64,
rate: f64,
) -> Self
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
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
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
pub fn borrower(self) -> Self
The side borrowing rather than lending.
pub fn issued_by(self, credit: CreditCurveId) -> Result<Self, &'static str>
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
pub fn year_fraction(&self) -> f64
The accrual year fraction.
§impl MoneyMarketDeposit
impl MoneyMarketDeposit
fn curve<'v, 'a, R: Scalar>(
&self,
view: &'v PricingView<'a, R>,
) -> &'v ResolvedCurve<'a, R>
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
impl Clone for MoneyMarketDeposit
§fn clone(&self) -> MoneyMarketDeposit
fn clone(&self) -> MoneyMarketDeposit
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 MoneyMarketDeposit
impl Debug for MoneyMarketDeposit
§impl PartialEq for MoneyMarketDeposit
impl PartialEq for MoneyMarketDeposit
§fn eq(&self, other: &MoneyMarketDeposit) -> bool
fn eq(&self, other: &MoneyMarketDeposit) -> bool
self and other values to be equal, and is used by ==.§impl<R: Scalar> Priceable<R> for MoneyMarketDeposit
impl<R: Scalar> Priceable<R> for MoneyMarketDeposit
§fn npv(&self, view: &PricingView<'_, R>) -> Result<R, PricingError>
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>
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>
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
impl PricingRiskFactors for MoneyMarketDeposit
§fn risk_factors(&self) -> Result<RiskFactors<'_>, PricingError>
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
impl Product for MoneyMarketDeposit
§fn restruck_at_rate(&self, rate: f64) -> Option<AnyInstrument>
fn restruck_at_rate(&self, rate: f64) -> Option<AnyInstrument>
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
fn currency(&self) -> Currency
§fn contract_dates(&self) -> Vec<(&'static str, NaiveDate)>
fn contract_dates(&self) -> Vec<(&'static str, NaiveDate)>
(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>>
fn legs(&self) -> Option<Vec<&Leg>>
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>
fn final_payment_date(&self) -> Option<NaiveDate>
None for a product no ladder is built from.§fn restruck_at_spread(&self, _spread: f64) -> Option<AnyInstrument>
fn restruck_at_spread(&self, _spread: f64) -> Option<AnyInstrument>
spread on its spread
leg, or None for a product that quotes none.