Skip to main content

TenorBasisSwap

Struct TenorBasisSwap 

pub struct TenorBasisSwap {
    pub currency: Currency,
    pub collateral: CollateralSpec,
    pub spread_index: String,
    pub base_index: String,
    pub spread_leg: Leg,
    pub base_leg: Leg,
    pub spread: f64,
}
Expand description

A single-currency tenor basis swap: a spread leg on one index, carrying the basis spread, received against a base leg on another index, paid. Each leg has its own schedule, day count and index window.

Fields§

§currency: Currency

The swap’s currency.

§collateral: CollateralSpec

What both legs are discounted against.

§spread_index: String

The spread leg’s index, by registry code.

§base_index: String

The base leg’s index, by registry code.

§spread_leg: Leg

The spread leg, received, its coupons carrying spread.

§base_leg: Leg

The base leg, paid.

§spread: f64

The basis spread on the spread leg, as a decimal.

Implementations§

§

impl TenorBasisSwap

pub fn from_template( template: &TenorBasisTemplate, effective: NaiveDate, termination: NaiveDate, notional: f64, spread: f64, ) -> Result<Self, CurveError>

A swap from its template between two dates, at spread on the template’s spread leg.

§Errors

CurveError::UnknownIndex if a template’s index code is not a registered term or overnight index, and CurveError::InvertedDates if termination is not after effective.

pub fn from_legs( spread_leg: &TenorBasisLeg, base_leg: &TenorBasisLeg, effective: NaiveDate, termination: NaiveDate, notional: f64, spread: f64, ) -> Result<Self, CurveError>

A swap from two leg conventions between two dates, at spread on spread_leg (received) against base_leg (paid). Both legs generate forward from effective on their own conventions and project over their index’s window. The legs may be a template’s in either order: which index carries the basis is the trade’s, not the template’s.

§Errors

CurveError::UnknownIndex if a leg’s index code is not a registered term or overnight index — a template is plain data a user edits, so a mistyped code is reported, not a reason to abort the pricing thread — and CurveError::InvertedDates if termination is not after effective.

Trait Implementations§

§

impl Clone for TenorBasisSwap

§

fn clone(&self) -> TenorBasisSwap

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 TenorBasisSwap

§

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

Formats the value using the given formatter. Read more
§

impl PartialEq for TenorBasisSwap

§

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

§

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

The spread leg received on its index’s curve, the base leg paid on its own, both discounted on the collateral curve.

§

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

The fair basis: the spread on the spread leg that zeroes the swap, s − npv(s) / annuity, off the spread leg’s own annuity — the value is exactly affine in the spread, so this is a division.

§

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
§

impl PricingRiskFactors for TenorBasisSwap

§

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

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

impl Product for TenorBasisSwap

§

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

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

impl StructuralPartialEq for TenorBasisSwap

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.