Skip to main content

CmsSwap

Struct CmsSwap 

pub struct CmsSwap {
    pub index: SwapIndex,
    pub periods: Vec<CmsPeriod>,
    pub notional: f64,
    pub gearing: f64,
    pub spread: f64,
    pub mean_reversion: f64,
    pub direction: Direction,
    pub other: Leg,
    pub payoff: Option<RatePayoff>,
    projection: String,
    others: Vec<String>,
}
Expand description

A CMS swap: a leg paying N·τ·(g·CMS + s) per period — the swap index’s CMS rate fixing in advance — against any other leg on the opposite side.

The mean reversion the linear TSR slope is taken at is carried by the trade.

Fields§

§index: SwapIndex

The swap the CMS rate observes.

§periods: Vec<CmsPeriod>

The CMS leg’s periods, in order.

§notional: f64

The CMS leg’s notional.

§gearing: f64

Multiplier on the CMS rate.

§spread: f64

Added to the geared CMS rate, as a decimal.

§mean_reversion: f64

The mean reversion the convexity adjustment’s slope is taken at.

§direction: Direction

The CMS leg’s side.

§other: Leg

The other leg, on the opposite side.

§payoff: Option<RatePayoff>

An option every CMS coupon carries on its rate g·CMS + s — a cap and floor, or a digital — or None for a plain leg.

§projection: String§others: Vec<String>

The indices the other leg reads beside the swap index’s own.

Implementations§

§

impl CmsSwap

pub fn new( index: SwapIndex, schedule: &Schedule, day_count: DayCountFraction, notional: f64, gearing: f64, spread: f64, mean_reversion: f64, direction: Direction, other: Leg, ) -> Result<Self, CmsSwapError>

A CMS leg over schedule on index, accruing on day_count, against other. Each period fixes the swap index’s fixing lag before it starts and pays on its end.

§Errors

CmsSwapError for a schedule of fewer than two dates or two legs on one side.

pub fn with_payoff(self, payoff: RatePayoff) -> Result<Self, PayoffError>

This swap with payoff on every CMS coupon’s rate g·CMS + s: a collar caps and floors it, a digital pays on it — each an option on the CMS rate at (K − s)/g, times |g|, replicated by cms_option, as an IBOR coupon’s payoff reads its index.

§Errors

PayoffError when the payoff is not one.

pub fn with_spread(self, spread: f64) -> Self

This swap with its CMS leg at spread.

pub fn currency(&self) -> Currency

The currency the swap pays in: its index’s.

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

The index the other leg reads besides the swap index’s own, if any. The CMS leg: its value and its annuity (the value of one unit of spread), each signed by the leg’s side.

Trait Implementations§

§

impl Clone for CmsSwap

§

fn clone(&self) -> CmsSwap

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 CmsSwap

§

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

Formats the value using the given formatter. Read more
§

impl PartialEq for CmsSwap

§

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

§

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

The spread on the CMS leg that values the swap at zero: the value less the leg’s spread over the leg’s annuity.

A leg carrying a payoff is not affine in its spread, so it has none.

§

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
§

impl PricingRiskFactors for CmsSwap

§

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

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

impl Product for CmsSwap

§

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 CmsSwap

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.