Money-market deposit
This page lists everything you need to book and value a money-market deposit: its arguments and defaults, how it's priced, and an example you can run. A deposit lends cash from one date to another at a simple rate, and it is also the first segment a recipe builds a curve from.
Quick example
The example reads its quotes from the desk sheets; load them once and it runs as shown.
This lends ten million for three months from spot at 4.00% on a SOFR market, reads the fair rate, and values a second deposit struck at that rate. The market comes from the USD SOFR close on the quote sheets and recipes.
use chrono::NaiveDate;
use helixio_docs_sheets::{SOFR_CLOSE_DATE, USD_SOFR_CLOSE};
use helixrs::{
AnyInstrument, AnyTemplate, CollateralSpec, MarketContext, MoneyMarketDeposit,
QuoteSheet, template,
};
type Outcome<T> = Result<T, Box<dyn std::error::Error>>;
fn date((year, month, day): (i32, u32, u32)) -> NaiveDate {
NaiveDate::from_ymd_opt(year, month, day).expect("a real calendar date")
}
fn deposit(rate: f64, lending: bool) -> Outcome<AnyInstrument> {
let AnyTemplate::Deposit(depos) = template("USD-SOFR-DEPO")? else {
unreachable!("a deposit template")
};
let mut deposit = MoneyMarketDeposit::new(
depos.currency.parse()?,
date((2026, 10, 5)),
date((2027, 1, 5)),
depos.day_count,
10_000_000.0,
rate,
);
if !lending {
deposit = deposit.borrower();
}
Ok(AnyInstrument::Deposit(deposit))
}
fn main() -> Outcome<()> {
let close = date(SOFR_CLOSE_DATE);
let market = MarketContext::as_of(close).with_recipe_quotes(
&CollateralSpec::Currency("USD".parse()?),
&QuoteSheet::from_rows(USD_SOFR_CLOSE.iter().copied())?,
)?;
// Lend ten million from spot for three months at 4.00%.
let lent = deposit(0.0400, true)?;
let fair = lent.par_rate(&market)?;
let npv = lent.npv(&market)?;
println!("fair rate {fair:.8}");
println!("npv {npv:.2}");
// At its fair rate, the deposit is worth nothing.
let at_fair = deposit(fair, true)?.npv(&market)?;
println!("npv at fair {at_fair:.6}");
Ok(())
}import datetime as dt
import helixio as hlx
from desk_sheets import SOFR_CLOSE_DATE, USD_SOFR_CLOSE
market = hlx.MarketContext(SOFR_CLOSE_DATE).with_recipe_quotes("USD", USD_SOFR_CLOSE)
depos = hlx.templates.get("USD-SOFR-DEPO")
START, MATURITY = dt.date(2026, 10, 5), dt.date(2027, 1, 5)
# Lend ten million from spot for three months at 4.00%.
deposit = depos.money_market_deposit(START, MATURITY, rate=0.0400, notional=10_000_000.0)
fair = deposit.par_rate(market)
npv = deposit.npv(market)
print(f"fair rate {fair:.8f}")
print(f"npv {npv:.2f}")
# At its fair rate, the deposit is worth nothing.
at_fair = depos.money_market_deposit(START, MATURITY, rate=fair, notional=10_000_000.0)
print(f"npv at fair {at_fair.npv(market):.6f}")fair rate 0.04020000
npv -505.69
npv at fair 0.000000
The fair rate equals the sheet's three-month quote: a three-month OIS from spot is one period, and over one period the compounded and the simple rate on the same curve agree. Lending below it gives value away.
How it's priced
A deposit of at rate from to , with accrual , is worth to the lender
The fair rate makes it worth nothing: . The borrower holds the other side. Where deposits sit on a curve is covered in how rates products work.
API
| Argument | Type | Default | Meaning |
|---|---|---|---|
start |
date |
required | when the cash moves |
maturity |
date |
required | when it is repaid with interest |
rate |
float |
required | the simple rate |
notional |
float |
required | the size |
lending |
bool |
True |
False books the borrower; Rust .borrower() on MoneyMarketDeposit::new(currency, start, maturity, day_count, notional, rate) |
issuer |
str |
None |
tags the deposit taker's credit; refused on an IRS template |
| Symbol | Meaning | Rust | Python |
|---|---|---|---|
| the trade | a deposit on its template | MoneyMarketDeposit::new with the template's currency and day count |
Template.money_market_deposit |
| borrower | the other side | MoneyMarketDeposit::borrower |
lending=False |
| the fair rate | AnyInstrument::par_rate |
Instrument.par_rate |
|
| its value | AnyInstrument::npv |
Instrument.npv |
Defaults and limits
- Side: a deposit is booked as the lender. Pass
lending=Falsein Python, or call.borrower()in Rust, to book the borrower. - Interest: simple interest on the market's money-market day count, paid with the principal at maturity. The template holds the currency and day count; see rates conventions.
- Dates: you give the start and maturity dates yourself; the deposit does not roll them.
See also
- Source:
crates/helixrs/src/instruments/rates.rs - Related pages:
- Curve helpers, for a deposit as a curve rung.
- Day counts, for the accrual.
From the 0.0 line at revision bf7f2e2. Every printed number is that revision's own output.