Skip to main content

Module templates

Module templates 

Expand description

Convention-bundle templates — the conventions of a standard product, as data, plus the template registry.

Templates carry data only; the builders that consume them live in the instruments/products layers, so statics never depends on instruments. Named templates are declared through the templates! macro, which emits a typed accessor and a registry row from one declaration; registry unions the per-group tables and resolves a template by code. The irs group covers every single-currency rate swap (OIS + vanilla IBOR); xccy, fx, and credit are reserved for their product arms.

Re-exports§

pub use irs::eur_euribor_3m as eur_euribor_3m_irs;
pub use irs::usd_sofr as usd_sofr_ois;

Modules§

bond
Outright-bond templates: market settlement/quote conventions for held bonds. Outright-bond templates — the bond group.
credit
Credit (CDS) templates — the credit group.
futures_option
Options on listed bond futures: one template per exchange contract. Options on government bond futures — the futures_option group, one template per listed option contract.
fx
FX product templates. (Placeholder: lands with the FX product arm.) FX-swap pillar templates — the fx group.
irs
Interest-rate swap templates — the irs group covers every single-currency rate swap, both OIS (fixed vs compounded RFR) and vanilla IBOR (fixed vs term float). Builders resolve their index by code through the index registry.
mm
Money-market templates: deposits (MoneyMarket) and rate futures (RateFuture). Money-market templates — the mm group covers single-currency front-end instruments quoted as tagged pillars: deposits (type = "MoneyMarket", a simple accrual to a convention-advanced maturity), rate futures (type = "RateFuture", a forward accrual over a fixed contract length), and forward-rate agreements (type = "FRA", a forward accrual on a projection curve).
ndf
Non-deliverable FX forward templates — the ndf group, one per currency with an EMTA Template Terms document for NDFs.
ndo
Non-deliverable FX option templates: one per EMTA NDO template. Non-deliverable FX option templates — the ndo group: one row per EMTA NDO template, each carrying its own template date and the NDF terms that date its fixing.
nds
Non-deliverable interest rate swap templates — the nds group: a local swap whose every payment converts into USD at an FX fixing two business days before it pays.
registry
The template registry — the single source for resolving a template code and for enumerating the available templates (the Python namespace is built from it).
repo
General-collateral repo templates. Repo templates — the repo group: one per currency’s general-collateral market, carrying what a repo drafted there inherits.
swaption
Bond total-return-swap templates: float- and fixed-funding variants. Swaption templates — the swaption group.
trs
Bond total-return-swap templates — the trs group.
xccy
Cross-currency swap templates — the xccy group.

Macros§

templates 🔒
Declares a group of templates sharing one builder: per entry, emits a typed accessor pub fn <name>() -> <ty> (calling <builder>(<code>, <args…>), so the code doubles as the template name with no duplication) and a row in the group’s static table. The schema lives in the builder; this macro only wires name/code/args and tags the variant.

Structs§

DepositTemplate
The conventions of a money-market deposit (a type = "MoneyMarket" pillar): a single simple-rate accrual from the reference date to a convention-advanced maturity. It carries no quote — only the currency and the schedule conventions needed to turn a pillar tenor (or exact date) into a maturity.
FraTemplate
The conventions of a forward-rate agreement (a type = "FRA" projection pillar): a forward accrual over the underlying index’s period (e.g. 3M), starting at the pillar’s locator. The quoted value is the simple forward rate. It pins the index’s forward (projection) curve, not discount; it carries the index name (the forward-curve key), the accrual length, and the schedule conventions needed to turn the locator into the accrual [start, end].
FutureTemplate
The conventions of a rate future (a type = "RateFuture" pillar): a forward accrual over a fixed period (the contract’s reference length, e.g. 3M) starting at the pillar’s locator. The quoted value is the futures price (100·(1 − rate)); RateFutureConvexity is deferred (an adjustment on the segment, not a pillar quote). It carries the schedule conventions needed to turn the pillar locator into the accrual [start, end].
FxSwapTemplate
The conventions of an FX-swap pillar used to calibrate a foreign currency’s discount curve under a collateral currency (cross-collateral / post-CSA discounting). It carries no quote — the forward-points quote fills a recipe pillar hole — only the currencies and the schedule conventions needed to turn a pillar tenor into a forward-settlement date.
MeetingOisTemplate
The conventions of a meeting-date OIS — a single-period overnight-indexed swap spanning one inter-meeting window, bookable as a bet on one central-bank decision. Carries the deciding CentralBank (selecting the seeded meeting schedule at materialisation) plus the single accrual period’s conventions.
OisTemplate
The conventions of a standard overnight-indexed swap (fixed vs compounded RFR).
SwapTemplate
The conventions of a standard vanilla IBOR swap (fixed vs term floating).
SwaptionTemplate
A swaption template: an option on a swap whose conventions come from an existing swap template.
TemplateEntry
One registry row: the template’s product group, accessor name, code, and constructor (wrapping its AnyTemplate).
TenorBasisLeg
One leg of a single-currency tenor-basis swap (a floating leg projecting one index). Carries the index name (the forward-curve key), the leg frequency, the day-count, and the schedule conventions needed to generate the leg to a maturity.
TenorBasisTemplate
The conventions of a single-currency tenor-basis swap (a type = "TenorBasis" projection pillar): a spread leg projecting one index against a base leg projecting another, with the quoted basis spread on the spread leg. It pins the spread index’s forward curve against the base index’s (an available peer forward); the two indices must resolve to distinct forward-curve keys. It carries no quote — the basis spread fills a recipe pillar hole — only the two legs’ conventions.
TrsTemplate
The conventions of a bond total return swap template. Carries the funding shape, funding currency (default USD), optional projection index, reset frequency, and funding day-count; the reference bond and agreed spread are supplied when the trade is built (with_underlying / with_funding_spread).
ZcsTemplate
The conventions of a zero-coupon swap: a single terminal fixed accrual against a floating side that compounds one term-index reset per schedule period, both paying once at maturity.

Enums§

AnyTemplate
A convention template tagged by its product group. The product builders accept any Into<AnyTemplate>, and the registry resolves a code to one.
FutureReference
How a listed rate future’s reference period is set from its delivery month.
LastTrading
When a listed rate future stops trading, relative to the reference period RateFuture::for_contract resolves for its delivery month, on the template’s calendar.
MeetingNode
Where a meeting-dated swap’s rung puts its curve node.
SwaptionUnderlyingTemplate
The swap a SwaptionTemplate writes its option on.
TickRule
A listed rate future’s minimum price fluctuation, in index points.
TrsFundingShape
The funding-leg shape of a total return swap template.

Functions§

spot_effective_date
The template-convention spot (default effective) date: valuation advanced by spot_lag on cal — the one seam both the product builders and the calibration helpers resolve a swap’s effective date through, so a helper and a Product from the same template always describe the same instrument. A Day-unit lag advances in business days (a zero-day lag rolls forward to the next business day on or after valuation); other units advance by calendar arithmetic under bdc.