Skip to main content

XccySwapTemplate

Struct XccySwapTemplate 

pub struct XccySwapTemplate {
    pub name: String,
    pub leg1: XccyLegTemplate,
    pub leg2: XccyLegTemplate,
    pub spot_lag: Period,
    pub notional_exchange: NotionalExchange,
    pub coupon_mode: CouponMode,
    pub deliverability: Deliverability,
    pub fx_index: Option<FxIndexSpec>,
    pub collateral: CsaSpec,
    pub quoted_spread_leg: XccyLegSide,
}
Expand description

Per-leg conventions for a cross-currency swap: two legs plus swap-level fields.

leg1/leg2 are neutral names; pay/receive direction is a trade-time concern. Derives Clone + Debug? — NotionalExchange::Mtm holds a Vec, so this is Clone only (no Eq/Hash).

Fields§

§name: String

Template name (doubles as registry code).

§leg1: XccyLegTemplate

First leg.

§leg2: XccyLegTemplate

Second leg.

§spot_lag: Period

Spot lag (settlement convention).

§notional_exchange: NotionalExchange

Notional-exchange shape.

§coupon_mode: CouponMode

Coupon-payment shape (standard vs zero-coupon at maturity).

§deliverability: Deliverability

Deliverable vs non-deliverable.

§fx_index: Option<FxIndexSpec>

FX-index metadata. Some iff notional_exchange is Mtm.

§collateral: CsaSpec

Collateral (CSA) specification. Mandatory — no implicit default.

§quoted_spread_leg: XccyLegSide

Which leg carries the quoted spread / rate.

Implementations§

§

impl XccySwapTemplate

pub fn custom( name: impl Into<String>, leg1: XccyLegTemplate, leg2: XccyLegTemplate, collateral: CsaSpec, ) -> Result<Self, XccyTemplateError>

A cross-currency template of the caller’s own: leg1 against leg2, collateralised under collateral, the spread quoted on leg1, both notionals exchanged at start and end, spot two days out.

It never enters the registry, which states market conventions; it carries name so a refusal or a report can say which it is. Override the quoted leg, the resetting leg, the collateral or the spot lag with the builders.

§Errors

XccyTemplateError::OneCurrency if both legs are in one currency.

pub fn leg(&self, side: XccyLegSide) -> &XccyLegTemplate

The leg on side.

pub fn side_in(&self, currency: &str) -> Option<XccyLegSide>

The side whose leg is in currency, if either is.

pub fn with_leg( self, side: XccyLegSide, leg: XccyLegTemplate, ) -> Result<Self, XccyTemplateError>

This template with leg on side.

A resetting template keeps resetting the leg on the side it did, so a replaced leg in another currency moves the variable notional with it.

§Errors

XccyTemplateError::OneCurrency if the new leg is in the other leg’s currency.

pub fn with_quoted_spread_leg(self, side: XccyLegSide) -> Self

This template quoting its spread on side.

pub fn with_csa(self, csa: CsaSpec) -> Self

This template collateralised under the CSA csa.

pub fn with_spot_lag_days(self, days_after: i32) -> Self

This template settling days business days after the trade.

pub fn resetting_leg(&self) -> Option<XccyLegSide>

The side whose notional resets, if one does.

pub fn with_settlement_currency( self, code: &str, ) -> Result<Self, XccyTemplateError>

This non-deliverable template settling in code: a leg in code pays deliverably, and every other leg must carry an FX source, a source settling in USD crossing through USD into code.

§Errors

XccyTemplateError::Deliverable on a deliverable template.

pub fn with_leg_fx(self, side: XccyLegSide, fx: Option<LegFx>) -> Self

This template with the leg on side sourcing its FX fixing from fx, or from none — the per-leg terms a custom non-deliverable template states.

pub fn with_initial_exchange( self, initial: bool, ) -> Result<Self, XccyTemplateError>

This template exchanging its notional at the start as well as the end, or, with false, at the end alone. An opted-in initial exchange on a non-deliverable template converts at the trade’s FX rate — the deal rate.

§Errors

XccyTemplateError::InitialExchangeOnResetting on a resetting template.

pub fn with_resetting_leg(self, side: Option<XccyLegSide>) -> Self

This template resetting the notional on side to the forward FX rate at every period, or, with None, exchanging a constant notional — at start and end coming off a resetting template, as it was otherwise.

An FX index already on the template keeps its pair, reset lag and calendar; a new one takes the pair from the two currencies, a two-day lag and the resetting leg’s calendar. Pricing reads which leg resets; the lag and calendar are carried as the contract’s shape.

§

impl XccySwapTemplate

pub fn with_spot_lag(self, days: i32) -> Self

Overrides the spot lag (business days) — builder-style, as OisTemplate::with_spot_lag does. The cross-currency constructor takes a template value, so the override reaches the instrument.

Trait Implementations§

§

impl Clone for XccySwapTemplate

§

fn clone(&self) -> XccySwapTemplate

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 From<XccySwapTemplate> for AnyTemplate

§

fn from(t: XccySwapTemplate) -> Self

Converts to this type from the input type.
§

impl<'a> XccyTemplateArg<'a> for &'a XccySwapTemplate

§

fn resolve(self) -> Result<Cow<'a, XccySwapTemplate>, RungBuildError>

The template the code names, or the value itself. Read more

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.