Skip to main content

Product

Trait Product 

pub trait Product {
    // Required methods
    fn currency(&self) -> Currency;
    fn legs(&self) -> Option<Vec<&Leg>>;
    fn contract_dates(&self) -> Vec<(&'static str, NaiveDate)>;

    // Provided methods
    fn final_payment_date(&self) -> Option<NaiveDate> { ... }
    fn restruck_at_rate(&self, _rate: f64) -> Option<AnyInstrument> { ... }
    fn restruck_at_spread(&self, _spread: f64) -> Option<AnyInstrument> { ... }
}
Expand description

What every built-in product states about itself, beside how it is priced.

Each product answers in its own module, next to its struct, so a new product states these where it is defined rather than as a new arm in a match here. AnyInstrument forwards through dispatch!.

Required Methods§

fn currency(&self) -> Currency

The currency the product pays in. An FX product values in its quote currency; a book converts.

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 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.

Provided Methods§

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.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

§

impl<T: Product + ?Sized> Product for Box<T>

A boxed product states what the product inside it states, so the boxed variants forward like the rest.

§

fn currency(&self) -> Currency

§

fn legs(&self) -> Option<Vec<&Leg>>

§

fn contract_dates(&self) -> Vec<(&'static str, NaiveDate)>

§

fn final_payment_date(&self) -> Option<NaiveDate>

§

fn restruck_at_rate(&self, rate: f64) -> Option<AnyInstrument>

§

fn restruck_at_spread(&self, spread: f64) -> Option<AnyInstrument>

Implementors§

§

impl Product for AssetSwap

§

impl Product for BermudanSwaption

§

impl Product for BondForward

§

impl Product for BondFutureOption

§

impl Product for BondFuturePosition

§

impl Product for BondOption

§

impl Product for BondTotalReturnSwap

§

impl Product for CallableBond

§

impl Product for CallableLoan

§

impl Product for CallableSwap

§

impl Product for CdoTranche

§

impl Product for CmsSwap

§

impl Product for CreditDefaultSwap

§

impl Product for CreditDefaultSwapOption

§

impl Product for CreditLinkedNote

§

impl Product for CreditLinkedSwap

§

impl Product for CrossCurrencyAssetSwap

§

impl Product for CrossCurrencySwap

§

impl Product for CurvePin

§

impl Product for EquityOption

§

impl Product for EquityTotalReturnSwap

§

impl Product for EuropeanSwaption

§

impl Product for Fee

§

impl Product for FloatingRateNote

§

impl Product for ForwardRateAgreement

§

impl Product for FxForward

§

impl Product for FxOption

§

impl Product for FxSwap

§

impl Product for IndexCreditDefaultSwap

§

impl Product for InflationLinkedBond

§

impl Product for InterestRateCapFloor

§

impl Product for Loan

§

impl Product for MoneyMarketDeposit

§

impl Product for NthToDefaultSwap

§

impl Product for OpenRepo

§

impl Product for OvernightIndexedSwap

§

impl Product for PaymentInKindBond

§

impl Product for RateFuture

§

impl Product for RepackNote

§

impl Product for Repo

§

impl Product for SecuritiesLoan

§

impl Product for Straddle

§

impl Product for StructuredNote

§

impl Product for TenorBasisSwap

§

impl Product for TriPartyRepo

§

impl Product for VanillaSwap

§

impl Product for YoyInflationCapFloor

§

impl Product for YoyInflationSwap

§

impl Product for ZeroCouponBond

§

impl Product for ZeroCouponInflationCapFloor

§

impl Product for ZeroCouponInflationSwap

§

impl Product for ZeroCouponSwap