Skip to main content

SwapTemplate

Struct SwapTemplate 

pub struct SwapTemplate {
Show 21 fields pub name: String, pub fixed_day_count: DayCountFraction, pub fixed_frequency: Frequency, pub float_index: IborIndex, pub float_frequency: Frequency, pub calendar: Arc<dyn Calendar>, pub business_day_convention: BusinessDayConvention, pub roll: RollConvention, pub spot_lag: Period, pub payment_lag: Period, pub payment_calendar: Option<Arc<dyn Calendar>>, pub payment_convention: Option<BusinessDayConvention>, pub float_payment_convention: Option<BusinessDayConvention>, pub float_payment_lag: Option<Period>, pub float_payment_calendar: Option<Arc<dyn Calendar>>, pub end_of_month: bool, pub date_generation: DateGenerationRule, pub stated_date_generation: Option<DateGenerationRule>, pub float_reset: Option<Period>, pub float_par_coupons: bool, pub fixed_business_day_convention: Option<BusinessDayConvention>,
}
Expand description

The conventions of a standard vanilla IBOR swap (fixed vs term floating).

Fields§

§name: String

Template name.

§fixed_day_count: DayCountFraction

Fixed-leg day-count.

§fixed_frequency: Frequency

Fixed-leg frequency.

§float_index: IborIndex

The term index of the floating leg.

§float_frequency: Frequency

Floating-leg frequency.

§calendar: Arc<dyn Calendar>

Schedule calendar.

§business_day_convention: BusinessDayConvention

Business-day convention.

§roll: RollConvention

Roll convention.

§spot_lag: Period

Spot lag: valuation → default effective date.

§payment_lag: Period

Payment lag: accrual end → coupon pay date, in business days on the payment calendar (zero ⇒ pay at accrual end, the standard for most vanilla IBOR markets).

§payment_calendar: Option<Arc<dyn Calendar>>

Calendar the payment lag rolls on; None defaults to the schedule calendar.

§payment_convention: Option<BusinessDayConvention>

Business-day convention the payment date rolls under, separate from the schedule’s. None leaves the payment on the unadjusted accrual end.

§float_payment_convention: Option<BusinessDayConvention>

The convention, lag and calendar the floating leg’s payments roll under, where that side follows a different market’s agreement.

None means inherit the single value above, not use the default: an unset floating side follows whatever the fixed side was given, which is what keeps with_payment_convention setting both sides as it always has. Every registered template leaves all three unset, so both legs pay alike unless a caller says otherwise.

§float_payment_lag: Option<Period>

The floating leg’s own payment lag; None inherits payment_lag.

§float_payment_calendar: Option<Arc<dyn Calendar>>

The floating leg’s own payment calendar; None inherits whatever payment_calendar resolves to.

§end_of_month: bool

Whether schedule boundaries snap to month-ends.

§date_generation: DateGenerationRule

Schedule date-generation direction.

§stated_date_generation: Option<DateGenerationRule>

The direction a caller stated with with_date_generation, which the swap builder honours: Backward puts any stub at the front. None on every registered template, which builds forward as it always has; date_generation above is the registered declaration the builder does not yet read.

§float_reset: Option<Period>

The floating leg’s reset tenor where it resets more often than it pays — CNY FR007’s weekly resets inside a quarterly payment — each period’s resets compounded straight (ISDA “Straight” compounding). None for a leg resetting once per period.

§float_par_coupons: bool

Whether each floating coupon forwards over its own accrual period (a par coupon) rather than over its index’s window. false on every registered template.

§fixed_business_day_convention: Option<BusinessDayConvention>

The business-day convention the fixed leg’s schedule rolls under, where it differs from the floating leg’s, such as a fixed leg accrued unadjusted against a floating leg rolled Following. None — every registered template — rolls both legs on business_day_convention.

Implementations§

§

impl SwapTemplate

pub fn with_par_coupons(self, par: bool) -> Self

This template with its floating coupons forwarding over their own accrual periods (par coupons), each still fixing on its own date.

pub fn with_float_reset(self, tenor: Period) -> Self

This template with its floating leg resetting every tenor and compounding the resets straight within each payment period.

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

Overrides the spot lag (business days) — builder-style, for booking a non-standard convention set off a built-in template.

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

Overrides the payment lag (business days).

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

Overrides the calendar the payment lag rolls on (default: the schedule calendar).

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

Rolls the payment date under convention, separate from the schedule’s own — a payment convention, applied with a lag of zero.

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

Generates the schedule under convention, rather than the registered one.

Unadjusted, the accrual boundaries stay on their unadjusted dates, which is what makes with_payment_convention observable: a schedule rolled by its own convention has no weekend boundary left for a payment to move. The pair — unadjusted accrual, rolled payment — is the one the street books.

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

Generates in rule’s direction — Backward from the termination with any stub at the front — rather than forward as every registered template builds.

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

Generates on calendar rather than the registered business centres — FpML’s businessCenters stated per trade. A payment lag with no payment calendar of its own rolls on it too.

pub fn with_roll_convention(self, roll: RollConvention) -> Self

Rolls interior boundaries under roll rather than the registered roll — FpML’s rollConvention stated per trade (a day of the month, EOM, IMM).

pub fn payment_calendar_or_schedule(&self) -> Arc<dyn Calendar>

The calendar the payment lag rolls on: the explicit payment calendar when set, else the schedule calendar.

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

Rolls the floating leg’s payments under convention, leaving the fixed leg on whatever with_payment_convention set — the shape a swap needs when each side follows its own market.

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

Gives the floating leg its own payment lag in business days, leaving the fixed leg on the shared one.

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

Gives the floating leg its own payment calendar, leaving the fixed leg on the shared one.

pub fn float_payment_calendar_or_shared(&self) -> Arc<dyn Calendar>

The floating leg’s payment calendar: its own when set, else whatever the shared one resolves to.

pub fn float_payment_lag_or_shared(&self) -> Period

The floating leg’s payment lag: its own when set, else the shared one.

pub fn effective_date(&self, valuation: NaiveDate) -> NaiveDate

The default effective date for a swap booked off this template as of valuation: the spot lag applied through spot_effective_date — the same resolution Product.build_in performs.

Trait Implementations§

§

impl Clone for SwapTemplate

§

fn clone(&self) -> SwapTemplate

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<SwapTemplate> for AnyTemplate

§

fn from(t: SwapTemplate) -> Self

Converts to this type from the input type.

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.