Skip to main content

ZeroCouponBond

Struct ZeroCouponBond 

pub struct ZeroCouponBond {
    pub currency: Currency,
    pub collateral: CollateralSpec,
    pub settlement: NaiveDate,
    pub maturity: NaiveDate,
    pub face: f64,
    pub discount_yield: f64,
    pub day_count: DayCountFraction,
    pub calc_method: u16,
    pub quote_method: YieldQuoteMethod,
    pub side: f64,
}
Expand description

A short-dated zero-coupon government security quoted on a discount basis.

It holds the discount yield, because that is what the contract is struck on; the price and the other two quotes are read off it.

Fields§

§currency: Currency

The zero’s currency.

§collateral: CollateralSpec

What the zero is discounted against. A zero names no index and no spread: this is the only curve it reads.

§settlement: NaiveDate

The date the quote is struck from — the settlement the discount accrues over.

§maturity: NaiveDate

The date the face is paid.

§face: f64

The face amount paid at maturity.

§discount_yield: f64

The discount yield, as a decimal, on the face.

§day_count: DayCountFraction

The accrual day count. Per-security data: the registered method for every discount row declines to impose one.

§calc_method: u16

The vendor calc-type code the conventions were resolved from, kept so a zero can say which row it books under.

§quote_method: YieldQuoteMethod

The quote convention, resolved from calc_method rather than supplied.

§side: f64

+1 holds the zero; −1 is short.

Implementations§

§

impl ZeroCouponBond

pub fn new( currency: Currency, calc_method: u16, settlement: NaiveDate, maturity: NaiveDate, face: f64, discount_yield: f64, day_count: DayCountFraction, ) -> Result<Self, CalcMethodError>

A zero booked under the registered calculation method calc_method.

§Errors

CalcMethodError if the code is not in the registry, or if it is a row that imposes a coupon basis — a zero has no coupon, so a method that books one is not a zero’s method, and the refusal names the code rather than pricing a note’s convention onto a discount security.

pub fn short(self) -> Self

The short side.

pub fn year_fraction(&self) -> f64

The year fraction the discount is taken over, on the zero’s own basis.

pub fn price(&self) -> f64

The price per unit of face: 1 − d·τ.

On the face, which is what makes a discount yield not a yield: the discount is subtracted from what is repaid, not earned on what is paid.

pub fn discount_yield_from_price(&self, price: f64) -> f64

The discount yield a price implies: (1 − P)/τ, on the face.

pub fn money_market_yield(&self) -> f64

The money-market yield at this zero’s price: (1 − P)/(P·τ).

On the price — what a lender of P earns — which is why it exceeds the discount yield at the same price whenever the zero trades below par. Computed through the crate’s own rate/discount-factor conversion rather than by writing the ratio out again.

pub fn money_market_yield_from_price(&self, price: f64) -> f64

The money-market yield a price implies.

pub fn price_from_money_market_yield(&self, rate: f64) -> f64

The price a money-market yield implies — the inverse of money_market_yield_from_price.

pub fn bond_equivalent_yield(&self) -> f64

The bond-equivalent yield: the semi-annually compounded ACT/365F yield that reprices the zero, so it stands beside a coupon note’s yield.

pub fn bond_equivalent_yield_from_price(&self, price: f64) -> f64

The bond-equivalent yield a price implies.

pub fn price_from_bond_equivalent_yield(&self, yield_: f64) -> f64

The price a bond-equivalent yield implies.

pub fn quoted_yield(&self) -> f64

The quoted yield under the registered convention: the money-market yield where the method quotes simple interest, the compounded yield where it quotes compound.

This is the number the market prints. It reads the method rather than a list written here, so a row whose convention is corrected in the registry changes this without anything in this file moving.

pub fn price_from_quoted_yield(&self, yield_: f64) -> f64

The price the quoted yield implies, under the same registered convention.

fn quote_convention(&self) -> RateConvention

The rate convention the registered method resolves to.

The three quote methods a discount row can carry map onto compounding; the two that describe a coupon bond’s own kernels are not reachable from a discount row and compound like the default rather than being turned away here, where a refusal would be about a row that cannot occur.

fn bond_equivalent_tau(&self) -> f64

The year fraction the bond-equivalent yield is annualised over — on its own ACT/365F basis, never the zero’s.

Trait Implementations§

§

impl Clone for ZeroCouponBond

§

fn clone(&self) -> ZeroCouponBond

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 ZeroCouponBond

§

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

Formats the value using the given formatter. Read more
§

impl PartialEq for ZeroCouponBond

§

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

§

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

side · N · (DF(maturity) − P·DF(settlement)), wholly off the discount curve, where P = 1 − d·τ is the quoted price per unit of face.

The deposit’s shape, and for the deposit’s reasons. A zero is a purchase: money out at settlement, the face back at maturity. Valuing it as the face alone would report a number that could not be zero and so admits no par rate; valuing it as the price discounted would report the present value of what was paid, which is not a position in anything.

Three datings, the middle one as the deposit’s: past the settlement the money has gone out and only the redemption is still owed; past the maturity there is nothing.

Nothing is read from the fixing store. A zero names no index; a published rate on its dates belongs to some other instrument.

§

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

The fair discount yield: (1 − DF(maturity)/DF(settlement))/τ, at which the zero is worth nothing.

The same expression the value is built from, solved for the rate rather than for the money — so the quote and the valuation cannot disagree about what par means. A rate on the face, like the quote it inverts.

§

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

Unsupported: a zero has no floating side for a margin to sit on, so a breakeven spread would be a number with no contract behind it — the money-market deposit refuses for the same reason.

§

impl PricingRiskFactors for ZeroCouponBond

§

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

The market data this product is priced against. Read more
§

impl Product for ZeroCouponBond

§

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_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 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 ZeroCouponBond

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.