Struct CallableSwap
pub struct CallableSwap {
pub swap: SwaptionUnderlying,
pub cancellation: BermudanSwaption,
pub callable_by: CallableBy,
}Expand description
A swap cancellable on Bermudan exercise dates.
Cancelling ends the remaining swap, which from the canceller’s side is entering the reversed swap, so the pair values as the swap plus a Bermudan struck at the swap’s own fixed rate: one of the opposite kind, bought, where the holder may cancel; one of the swap’s own kind, sold, where the counterparty may: the swap plus that swaption.
Fields§
§swap: SwaptionUnderlyingThe swap as booked.
cancellation: BermudanSwaptionThe cancellation right, on the same underlying and dates.
callable_by: CallableByWho holds the right.
Implementations§
§impl CallableSwap
impl CallableSwap
pub fn new(
swap: SwaptionUnderlying,
exercise_dates: Vec<NaiveDate>,
callable_by: CallableBy,
) -> Result<Self, SwaptionError>
pub fn new( swap: SwaptionUnderlying, exercise_dates: Vec<NaiveDate>, callable_by: CallableBy, ) -> Result<Self, SwaptionError>
swap, cancellable on exercise_dates by callable_by.
§Errors
SwaptionError::MixedFixedRates where the fixed coupons carry more
than one rate; otherwise whatever BermudanSwaption::new refuses.
Trait Implementations§
§impl Clone for CallableSwap
impl Clone for CallableSwap
§fn clone(&self) -> CallableSwap
fn clone(&self) -> CallableSwap
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for CallableSwap
impl Debug for CallableSwap
§impl PartialEq for CallableSwap
impl PartialEq for CallableSwap
§impl<R: Scalar> Priceable<R> for CallableSwap
impl<R: Scalar> Priceable<R> for CallableSwap
§fn npv(&self, view: &PricingView<'_, R>) -> Result<R, PricingError>
fn npv(&self, view: &PricingView<'_, R>) -> Result<R, PricingError>
The swap as booked plus the cancellation right, bought or sold, on one view: the swap plus its swaption.
§fn par_rate(&self, _view: &PricingView<'_, R>) -> Result<R, PricingError>
fn par_rate(&self, _view: &PricingView<'_, R>) -> Result<R, PricingError>
Unsupported: a cancellable swap’s par rate moves the strike its own option is struck at, a root through the lattice no entry point runs.
§fn par_spread(&self, _view: &PricingView<'_, R>) -> Result<R, PricingError>
fn par_spread(&self, _view: &PricingView<'_, R>) -> Result<R, PricingError>
Unsupported, as par_rate.
§impl PricingRiskFactors for CallableSwap
impl PricingRiskFactors for CallableSwap
§fn risk_factors(&self) -> Result<RiskFactors<'_>, PricingError>
fn risk_factors(&self) -> Result<RiskFactors<'_>, PricingError>
The cancellation’s: the same underlying, so its discounting and projection are the swap’s, and the Hull-White parameters its own.
§impl Product for CallableSwap
impl Product for CallableSwap
§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.