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: SwapIndexThe swap the CMS rate observes.
periods: Vec<CmsPeriod>The CMS leg’s periods, in order.
notional: f64The CMS leg’s notional.
gearing: f64Multiplier on the CMS rate.
spread: f64Added to the geared CMS rate, as a decimal.
mean_reversion: f64The mean reversion the convexity adjustment’s slope is taken at.
direction: DirectionThe CMS leg’s side.
other: LegThe 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
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>
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>
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
pub fn with_spread(self, spread: f64) -> Self
This swap with its CMS leg at spread.
fn cms_leg<R: Scalar>(
&self,
view: &PricingView<'_, R>,
) -> Result<(R, R), PricingError>
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<R: Scalar> Priceable<R> for CmsSwap
impl<R: Scalar> Priceable<R> for CmsSwap
§fn par_spread(&self, view: &PricingView<'_, R>) -> Result<R, PricingError>
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>
fn npv(&self, view: &PricingView<'_, R>) -> Result<R, PricingError>
§fn par_rate(&self, _view: &PricingView<'_, R>) -> Result<R, PricingError>
fn par_rate(&self, _view: &PricingView<'_, R>) -> Result<R, PricingError>
§impl PricingRiskFactors for CmsSwap
impl PricingRiskFactors for CmsSwap
§fn risk_factors(&self) -> Result<RiskFactors<'_>, PricingError>
fn risk_factors(&self) -> Result<RiskFactors<'_>, PricingError>
§impl Product for CmsSwap
impl Product for CmsSwap
§fn currency(&self) -> Currency
fn currency(&self) -> Currency
§fn contract_dates(&self) -> Vec<(&'static str, NaiveDate)>
fn contract_dates(&self) -> Vec<(&'static str, NaiveDate)>
(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>>
fn legs(&self) -> Option<Vec<&Leg>>
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>
fn final_payment_date(&self) -> Option<NaiveDate>
None for a product no ladder is built from.§fn restruck_at_rate(&self, _rate: f64) -> Option<AnyInstrument>
fn restruck_at_rate(&self, _rate: f64) -> Option<AnyInstrument>
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>
fn restruck_at_spread(&self, _spread: f64) -> Option<AnyInstrument>
spread on its spread
leg, or None for a product that quotes none.