Skip to main content

AnyTemplate

Enum AnyTemplate 

#[non_exhaustive]
pub enum AnyTemplate {
Show 20 variants Ois(OisTemplate), MeetingOis(MeetingOisTemplate), Vanilla(SwapTemplate), Zcs(ZcsTemplate), Xccy(XccySwapTemplate), FxSwap(FxSwapTemplate), Cds(CdsTemplate), CreditIndex(CreditIndexTemplate), Deposit(DepositTemplate), Future(FutureTemplate), Fra(FraTemplate), TenorBasis(TenorBasisTemplate), Trs(TrsTemplate), Bond(BondTemplate), Swaption(SwaptionTemplate), Ndf(NdfTemplate), Nds(NdsTemplate), FutureOption(FutureOptionTemplate), Ndo(NdoTemplate), Repo(RepoTemplate),
}
Expand description

A convention template tagged by its product group. The product builders accept any Into<AnyTemplate>, and the registry resolves a code to one.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Ois(OisTemplate)

An OIS (fixed vs compounded RFR) template.

§

MeetingOis(MeetingOisTemplate)

A meeting-date OIS (single inter-meeting-window bullet) template.

§

Vanilla(SwapTemplate)

A vanilla IBOR (fixed vs term float) template.

§

Zcs(ZcsTemplate)

A zero-coupon-swap template.

§

Xccy(XccySwapTemplate)

A cross-currency swap template.

§

FxSwap(FxSwapTemplate)

An FX-swap pillar template (cross-collateral discount-curve calibration).

§

Cds(CdsTemplate)

A credit default swap template.

§

CreditIndex(CreditIndexTemplate)

A credit index family (CDX / iTraxx) template.

§

Deposit(DepositTemplate)

A money-market deposit pillar template (type = "MoneyMarket").

§

Future(FutureTemplate)

A rate-future pillar template (type = "RateFuture").

§

Fra(FraTemplate)

A forward-rate-agreement projection pillar template (type = "FRA").

§

TenorBasis(TenorBasisTemplate)

A single-currency tenor-basis projection pillar template (type = "TenorBasis").

§

Trs(TrsTemplate)

A bond total return swap template.

§

Bond(BondTemplate)

An outright-bond template (settlement/quote conventions; the security itself resolves by ISIN through the Securities).

§

Swaption(SwaptionTemplate)

A swaption template — an option on an OIS or vanilla swap. Its expiry is a deal term (the forward start), not a template field.

§

Ndf(NdfTemplate)

A non-deliverable FX forward template — one market’s EMTA terms.

§

Nds(NdsTemplate)

A non-deliverable interest rate swap template — a local swap settled in USD at its NDF’s fixings.

§

FutureOption(FutureOptionTemplate)

An option on a listed bond future — one exchange contract’s terms.

§

Ndo(NdoTemplate)

A non-deliverable FX option template — one market’s EMTA NDO terms.

§

Repo(RepoTemplate)

A general-collateral repo template — one currency’s money-market terms.

Implementations§

§

impl AnyTemplate

pub fn swap(&self, trade_date: NaiveDate) -> Result<ProductBuilder, CurveError>

A draft of this template’s swap on trade_date, every term defaulted: effective at spot, ten years long, on 10,000,000, receiving fixed, and no fixed rate — stated with ProductBuilder::with_fixed_rate or struck with ProductBuilder::at_par before it builds. Refined by the builder’s verbs, each returning a new draft; the verb the Python Template.swap forwards to.

§Errors

CurveError::NotASwapTemplate for a template whose family builds no swap; otherwise as swap_builder_on_tenor.

§

impl AnyTemplate

pub fn ndf( &self, trade_date: NaiveDate, tenor: Period, notional: f64, forward_rate: f64, short: bool, ) -> Result<FxForward, NdfError>

A non-deliverable forward drafted from this NDF template: notional of the settlement currency bought (sold when short) against the reference currency at forward_rate, for a tenor forward traded on trade_date.

Spot is the template’s spot lag in business days of the joint (valuation and settlement) calendar, the value date spot plus the tenor rolled by the template’s convention and end-of-month rule, and the fixing date the template’s fixing date for that value date. The forward is cash-settled in the settlement currency on the pair’s canonical FX key, settlement currency as base (FX-USDKRW), so the stored fixing is reference per settlement as every Annex A rate quotes.

§Errors

NdfError::NotNdf for a template of another family, naming it; NdfError::FixingNotAfterTrade when the fixing would fall on or before the trade date.

§

impl AnyTemplate

pub fn repo( &self, side: RepoSide, start: NaiveDate, end: NaiveDate, rate: RepoRate, collateral: FixedRateBond, amount: RepoAmount, price: f64, margin_ratio: f64, ) -> Result<Repo, RepoError>

A repo drafted on this repo template: its currency, money-market day count and margin basis, with the caller’s side, dates, rate, collateral and amount — RepoTemplate::floating for a rate on the market’s overnight index.

§Errors

RepoError::NotARepoTemplate for a template of another family; otherwise as the repo’s constructors.

pub fn ndo( &self, trade_date: NaiveDate, tenor: Period, notional: f64, strike: f64, kind: OptionKind, ) -> Result<FxOption, NdoError>

A non-deliverable option drafted from this NDO template: a European kind on notional of the settlement currency against the reference currency at the absolute strike (reference per settlement), settled as the NDF terms date it — settlement tenor from spot on the joint calendar, the fixing the lag before it — expiring on the fixing date (the EMTA templates’ Expiration Date is the Valuation Date), its payoff paid in cash in the settlement currency on the settlement date.

§Errors

NdoError::NotNdo for a template of another family, naming it; NdoError::FixingNotAfterTrade when the fixing would fall on or before the trade date.

§

impl AnyTemplate

pub fn nds( &self, trade_date: NaiveDate, tenor: Period, notional: f64, fixed_rate: f64, pays_fixed: bool, ) -> Result<AnyInstrument, NdsError>

A non-deliverable swap drafted from this NDS template: the local swap its market trades, tenor long from spot on trade_date, on notional at fixed_rate — paying fixed when pays_fixed — with every payment of both legs settling in the template’s settlement currency at the FX fixing its NDF terms date, the payment adjusted Preceding onto the fixing calendar and stepped back the lag.

A tenor within the template’s zero-coupon limit pays once at maturity on both legs; a template whose fixed leg compounds (BRL) accrues (1 + K)^τ into its single payment.

§Errors

NdsError::NotNds for a template of another family, naming it; NdsError::Swap where the local swap does not draft; NdsError::Settlement where its legs refuse the conversion.

§

impl AnyTemplate

pub fn family(&self) -> &'static str

The family’s name, as a refusal names it and the template surface reports it.

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

This NDS or non-deliverable cross-currency template settling in code — see NdsTemplate::with_settlement_currency and XccySwapTemplate::with_settlement_currency.

§Errors

xccy::XccyTemplateError::NoSettlement for any other family, naming it; xccy::XccyTemplateError::Deliverable on a deliverable cross-currency template.

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

This cross-currency template exchanging its notional at the start as well as the end, or, with false, at the end alone — see XccySwapTemplate::with_initial_exchange.

§Errors

xccy::XccyTemplateError::NotCrossCurrency for a template of another family, naming it, and xccy::XccyTemplateError::InitialExchangeOnResetting on a resetting one.

Trait Implementations§

§

impl Clone for AnyTemplate

§

fn clone(&self) -> AnyTemplate

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

§

fn from(t: BondTemplate) -> Self

Converts to this type from the input type.
§

impl From<CdsTemplate> for AnyTemplate

§

fn from(t: CdsTemplate) -> Self

Converts to this type from the input type.
§

impl From<CreditIndexTemplate> for AnyTemplate

§

fn from(t: CreditIndexTemplate) -> Self

Converts to this type from the input type.
§

impl From<DepositTemplate> for AnyTemplate

§

fn from(t: DepositTemplate) -> Self

Converts to this type from the input type.
§

impl From<FraTemplate> for AnyTemplate

§

fn from(t: FraTemplate) -> Self

Converts to this type from the input type.
§

impl From<FutureTemplate> for AnyTemplate

§

fn from(t: FutureTemplate) -> Self

Converts to this type from the input type.
§

impl From<FxSwapTemplate> for AnyTemplate

§

fn from(t: FxSwapTemplate) -> Self

Converts to this type from the input type.
§

impl From<MeetingOisTemplate> for AnyTemplate

§

fn from(t: MeetingOisTemplate) -> Self

Converts to this type from the input type.
§

impl From<NdfTemplate> for AnyTemplate

§

fn from(t: NdfTemplate) -> Self

Converts to this type from the input type.
§

impl From<NdsTemplate> for AnyTemplate

§

fn from(t: NdsTemplate) -> Self

Converts to this type from the input type.
§

impl From<OisTemplate> for AnyTemplate

§

fn from(t: OisTemplate) -> Self

Converts to this type from the input type.
§

impl From<SwapTemplate> for AnyTemplate

§

fn from(t: SwapTemplate) -> Self

Converts to this type from the input type.
§

impl From<SwaptionTemplate> for AnyTemplate

§

fn from(t: SwaptionTemplate) -> Self

Converts to this type from the input type.
§

impl From<TenorBasisTemplate> for AnyTemplate

§

fn from(t: TenorBasisTemplate) -> Self

Converts to this type from the input type.
§

impl From<TrsTemplate> for AnyTemplate

§

fn from(t: TrsTemplate) -> Self

Converts to this type from the input type.
§

impl From<XccySwapTemplate> for AnyTemplate

§

fn from(t: XccySwapTemplate) -> Self

Converts to this type from the input type.
§

impl From<ZcsTemplate> for AnyTemplate

§

fn from(t: ZcsTemplate) -> 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.