Skip to main content

XccyLegTemplate

Struct XccyLegTemplate 

pub struct XccyLegTemplate {
Show 14 fields pub currency: String, pub calendar: Arc<dyn Calendar>, pub day_count: DayCountFraction, pub frequency: Frequency, pub business_day_convention: BusinessDayConvention, pub end_of_month: bool, pub date_generation: DateGenerationRule, pub pay_delay: Period, pub fixing_lag: Period, pub kind: XccyLegKind, pub index_code: String, pub index: Option<AnyIndex>, pub projection: IborProjection, pub fx: Option<LegFx>,
}
Expand description

Per-leg conventions for a cross-currency swap leg.

Fields§

§currency: String

Leg currency (ISO 4217 code).

§calendar: Arc<dyn Calendar>

Leg calendar (often a joint calendar).

§day_count: DayCountFraction

Leg day-count.

§frequency: Frequency

Coupon frequency (Frequency::Once for the zero-coupon case).

§business_day_convention: BusinessDayConvention

Business-day convention.

§end_of_month: bool

Per-leg end-of-month rule (can differ between legs).

§date_generation: DateGenerationRule

Schedule date-generation direction.

§pay_delay: Period

Payment delay applied to this leg’s coupon payment dates.

No rate cut-off rides with it: the screens quote the OIS-compounded legs with a 1 BD cut-off, but on an overnight leg a cut-off is a lockout, which helixio prices without (§9 of the roadmap). A field here would document a convention the engine does not apply.

§fixing_lag: Period

Fixing lag (0 BD on OIS legs and HKD HIBOR; 2 BD on other IBOR legs).

§kind: XccyLegKind

Per-leg rate-projection mechanism.

§index_code: String

The projection key the leg’s coupons reset against, by registry code ("USD-SOFR", "EUR-EURIBOR-3M"); empty on a fixed leg, which projects nothing.

§index: Option<AnyIndex>

The index itself where the leg was stated on a value — a constructed index the registry never carried — and None where index_code names the registry. A swap built on the leg reads this first.

§projection: IborProjection

The window an IBOR coupon reads its index over; ignored on an overnight or fixed leg.

§fx: Option<LegFx>

Where this leg’s FX fixing comes from, on a non-deliverable template whose settlement currency is not this leg’s; None otherwise.

Implementations§

§

impl XccyLegTemplate

pub fn on_index(index_code: &str) -> Result<Self, XccyTemplateError>

A floating leg on the registered index index_code, in its currency and on its conventions.

An overnight index gives a compounded leg: quarterly, Modified Following, end of month, backward, paying two days late, on the index’s day count and fixing calendar. An IBOR index gives a term leg paying at its own tenor, on its day count, calendar, business-day convention, end-of-month rule and fixing lag, with no payment delay. Every one of these can be overridden afterwards.

§Errors

XccyTemplateError for a code no registry entry carries, an index that is neither overnight nor IBOR, or an IBOR tenor no leg pays on.

pub fn fixed(currency: &str) -> Result<Self, XccyTemplateError>

A fixed leg in currency: annual, ACT/365.FIXED, Modified Following with end-of-month on the currency’s settlement centre, generated backward, paying on the period end. Refine it with the builders.

§Errors

XccyTemplateError::NotALeg if currency is not a currency with a settlement centre.

pub fn on(index: AnyIndex, code: &str) -> Result<Self, XccyTemplateError>

A floating leg on index itself, keyed under code: as XccyLegTemplate::on_index, for an index the caller holds as a value — one the registry may never have carried.

§Errors

XccyTemplateError for an index that is neither overnight nor IBOR, or an IBOR tenor no leg pays on.

pub fn with_index(self, index_code: &str) -> Result<Self, XccyTemplateError>

This leg projecting on the registered index_code instead, its kind and currency taken from the new index and every other convention kept.

The kind follows the index, so a leg cannot name an overnight index and project it as a term rate. A payment delay or fixing lag the old kind implied is not carried across: override it after if it matters.

§Errors

As XccyLegTemplate::on_index.

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

This leg projecting on index itself, keyed under code, as XccyLegTemplate::with_index.

§Errors

As XccyLegTemplate::on.

pub fn with_frequency(self, frequency: Frequency) -> Self

This leg paying at frequency.

pub fn with_day_count(self, day_count: DayCountFraction) -> Self

This leg accruing on day_count.

pub fn with_calendar(self, calendar: Arc<dyn Calendar>) -> Self

This leg’s schedule and payments on calendar.

pub fn with_business_day_convention( self, convention: BusinessDayConvention, ) -> Self

This leg’s schedule rolled under convention.

pub fn with_end_of_month(self, end_of_month: bool) -> Self

This leg with its end-of-month rule set.

pub fn with_date_generation(self, rule: DateGenerationRule) -> Self

This leg’s schedule generated in rule’s direction.

pub fn with_pay_delay(self, days_late: i32) -> Self

This leg paying days business days after each period ends.

pub fn with_projection(self, projection: IborProjection) -> Self

This leg’s IBOR coupons reading their index over projection.

pub fn with_fixing_lag(self, days_before: i32) -> Self

This leg fixing days business days before each period starts.

Trait Implementations§

§

impl Clone for XccyLegTemplate

§

fn clone(&self) -> XccyLegTemplate

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

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.