Skip to main content

StructuredNote

Struct StructuredNote 

pub struct StructuredNote {
    pub currency: Currency,
    pub collateral: CollateralSpec,
    pub face: f64,
    pub maturity: NaiveDate,
    pub coupons: Leg,
    pub issuer: Option<CreditCurveId>,
    pub security_spread: Option<String>,
    indices: Vec<String>,
}
Expand description

A note paying a received leg of composed coupons and redeeming its face on the last payment date, discounted on its collateral.

Fields§

§currency: Currency

The note’s currency, its coupons’.

§collateral: CollateralSpec

The discounting key.

§face: f64

The face redeemed at maturity.

§maturity: NaiveDate

The maturity: the leg’s last payment date, where the face is redeemed.

§coupons: Leg

The coupons and the redemption, received.

§issuer: Option<CreditCurveId>

The issuer, when the note is valued risky: each flow weighted by its survival, recovery on the face paid within each coupon period.

§security_spread: Option<String>

A security-spread key composed onto the discounting — never onto the projection.

§indices: Vec<String>

Every index the coupons read, each once in the order read: the first two declared in the projection slots, the rest in the basket.

Implementations§

§

impl StructuredNote

pub fn new( coupons: &Leg, face: f64, collateral: CollateralSpec, ) -> Result<Self, StructuredNoteError>

A note paying coupons and redeeming face on their last payment date, discounted on collateral.

§Errors

StructuredNoteError for an empty, paid or accumulating leg, or a face that is not positive.

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

Tags the note to issuer’s credit: each promised flow pays only if the issuer survives to its date, and a default within a coupon period pays the market’s recovery on the face at the period’s midpoint.

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

Composes the security spread under key onto the note’s discounting. The coupons still project off the risk-free curves: the spread marks what the issuer’s promise is worth, not where its indices fix.

fn default_from(&self, as_of: NaiveDate) -> NaiveDate

Where the note’s default walk begins: the valuation date, or the first accrual start of a note that has not yet begun accruing.

fn projected_flows<R: Scalar>( &self, curves: &PricingView<'_, R>, as_of: NaiveDate, ) -> Result<Vec<(NaiveDate, R)>, PricingError>

Each unpaid flow, the redemption among them, projected through curves: the amount the leg walk would discount, collar and CMS convexity included.

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

The survival-weighted value: the flows at S(t)·DF(t), and recovery on the face over each coupon period [d₀, d₁] at R·F·(S(d₀) − S(d₁))·DF(midpoint), the first period starting at default_from.

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

The note’s value per 100 of face — its dirty price.

§Errors

As Priceable::npv.

Trait Implementations§

§

impl Clone for StructuredNote

§

fn clone(&self) -> StructuredNote

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 StructuredNote

§

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

Formats the value using the given formatter. Read more
§

impl PartialEq for StructuredNote

§

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

§

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

The leg, the redemption among its coupons, each coupon read through the view: its own index’s curve, and the vols its payoff reads. A spread-marked note discounts on the spread-composed curve and projects through the spread-free view; a tagged one is survival-weighted with recovery of face.

§

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 StructuredNote

§

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

Read off the coupons: the discount curve; every projection they read, the first two in their slots and the rest in the basket; the cap vols an optioned IBOR or overnight coupon or a range accrual reads; the swaption vols a CMS coupon reads, and the correlation of a CMS spread coupon on the market’s mark; the price index a CPI coupon reads.

§

impl Product for StructuredNote

§

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 StructuredNote

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.