Skip to main content

CallableBond

Struct CallableBond 

pub struct CallableBond {
    pub bond: FixedRateBond,
    pub schedule: Vec<Callability>,
    pub collateral: CollateralSpec,
    pub issuer: Option<CreditCurveId>,
    pub security_spread: Option<String>,
    pub american: bool,
}
Expand description

A callable (or puttable) bond: a bullet host plus a schedule of exercise rights. Every field is passive contract data; an empty schedule is the bullet bond, and prices identically to it.

Fields§

§bond: FixedRateBond

The bullet host.

§schedule: Vec<Callability>

The exercise schedule, possibly empty.

§collateral: CollateralSpec

The discounting key the bond is priced under.

§issuer: Option<CreditCurveId>

The issuer, when the bond is valued risky: every promised flow is weighted by the entity’s survival and a recovery-of-face leg is added. Credit belongs on the bullet — a tagged bond with an exercisable schedule is refused rather than priced on the lattice.

§security_spread: Option<String>

A security-spread key composed onto the discounting, independent of (and stacking with) the survival weighting.

§american: bool

Whether each right runs continuously from its date to the next entry’s: see with_american_exercise.

Implementations§

§

impl CallableBond

pub fn new(bond: FixedRateBond, schedule: Vec<Callability>) -> Self

A callable bond discounted on its own currency’s cash collateral.

pub fn with_american_exercise(self) -> Self

This bond exercising American: each entry’s right runs from its date up to the slice before the next entry’s, exercisable on every lattice slice at the entry’s price plus that day’s accrued when the price is clean, and the last entry on its date alone. The default exercises on the dates alone.

pub fn issued_by(self, issuer: CreditCurveId) -> Self

Tags the bond to issuer’s credit.

pub fn spread_by(self, key: impl Into<String>) -> Self

Composes the security spread under key onto the discounting.

§

impl CallableBond

pub fn yield_to_call( &self, dirty: f64, entry: &Callability, settlement: NaiveDate, basis: YieldBasis, ) -> Result<f64, CallYieldError>

The yield to one exercise entry: the yield repricing the scenario that redeems on the entry’s date at its price, over basis.

§Errors

CallYieldError for a make-whole or past entry, or an unbracketable price.

pub fn yield_to_maturity_scenario( &self, dirty: f64, settlement: NaiveDate, basis: YieldBasis, ) -> Result<f64, YieldSolveError>

The yield of the redemption-at-par-on-maturity scenario over basis.

§Errors

YieldSolveError where the price cannot be bracketed.

pub fn yield_to_worst( &self, dirty: f64, settlement: NaiveDate, basis: YieldBasis, ) -> Result<(NaiveDate, f64), YieldSolveError>

The lowest yield over the maturity scenario and every exercise strictly after settlement, with the date attaining it.

§Errors

YieldSolveError where a scenario’s price cannot be bracketed.

§

impl CallableBond

pub fn effective_risk( &self, market: &MarketContext, oas: f64, ) -> Result<LatticeMoments, PricingError>

The price and its first two sensitivities to a parallel continuous shift of the discounting at oas, from one lattice pass — effective duration, convexity and DV01 read off one LatticeMoments.

§Errors

PricingError where the market lacks the bond’s curves or the Hull-White parameters.

fn has_exercisable(&self, cut: NaiveDate) -> bool

Whether any entry can actually exercise before maturity after cut — make-whole entries cannot, and neither can entries on or past maturity.

fn lattice_grid( &self, valuation: NaiveDate, flows: &[(NaiveDate, f64)], ) -> Result<TimeGrid, PricingError>

The grid every callable valuation runs on: the bond’s own flow dates and exercisable call dates as exact slices, at the default density.

flows are the bond’s remaining dated flows after valuation, built once by the caller and shared with assemble.

The grid runs to the last mandatory date, not to the maturity. Under a payment calendar the final payment can roll past the maturity — a bond maturing on a Saturday pays on the Monday — and TimeGrid::build_with_mandatory keeps only the anchors strictly inside its horizon, so a horizon at the maturity would drop that payment and assemble would then fail to find its slice. Where nothing rolls the last mandatory date is the maturity, so this changes no grid that was already being built.

Trait Implementations§

§

impl Clone for CallableBond

§

fn clone(&self) -> CallableBond

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 CallableBond

§

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

Formats the value using the given formatter. Read more
§

impl PartialEq for CallableBond

§

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

§

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

Present value against the resolved market view. Read more
§

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

The par rate — the fixed rate at which the product is worth nothing. Read more
§

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

The par (breakeven) floating-leg spread. Zero for a product with no floating leg. Read more
§

impl PricingRiskFactors for CallableBond

§

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

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

impl Product for CallableBond

§

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 CallableBond

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.