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
bondgroup. - credit
- Credit (CDS) templates — the
creditgroup. - futures_
option - Options on listed bond futures: one template per exchange contract.
Options on government bond futures — the
futures_optiongroup, one template per listed option contract. - fx
- FX product templates. (Placeholder: lands with the FX product arm.)
FX-swap pillar templates — the
fxgroup. - irs
- Interest-rate swap templates — the
irsgroup 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 — themmgroup 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
ndfgroup, 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
ndogroup: 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
ndsgroup: 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
repogroup: 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
swaptiongroup. - trs
- Bond total-return-swap templates — the
trsgroup. - xccy
- Cross-currency swap templates — the
xccygroup.
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’sstatictable. The schema lives in the builder; this macro only wires name/code/args and tags the variant.
Structs§
- Deposit
Template - 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 quotedvalueis 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]. - Future
Template - The conventions of a rate future (a
type = "RateFuture"pillar): a forward accrual over a fixedperiod(the contract’s reference length, e.g. 3M) starting at the pillar’s locator. The quotedvalueis the futures price (100·(1 − rate));RateFutureConvexityis 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]. - FxSwap
Template - 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.
- Meeting
OisTemplate - 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).
- Swap
Template - The conventions of a standard vanilla IBOR swap (fixed vs term floating).
- Swaption
Template - A swaption template: an option on a swap whose conventions come from an existing swap template.
- Template
Entry - One registry row: the template’s product group, accessor name, code, and
constructor (wrapping its
AnyTemplate). - Tenor
Basis Leg - 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.
- Tenor
Basis Template - 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. - Future
Reference - How a listed rate future’s reference period is set from its delivery month.
- Last
Trading - When a listed rate future stops trading, relative to the reference period
RateFuture::for_contractresolves for its delivery month, on the template’s calendar. - Meeting
Node - Where a meeting-dated swap’s rung puts its curve node.
- Swaption
Underlying Template - The swap a
SwaptionTemplatewrites its option on. - Tick
Rule - A listed rate future’s minimum price fluctuation, in index points.
- TrsFunding
Shape - The funding-leg shape of a total return swap template.
Functions§
- spot_
effective_ date - The template-convention spot (default effective) date:
valuationadvanced byspot_lagoncal— the one seam both the product builders and the calibration helpers resolve a swap’s effective date through, so a helper and aProductfrom the same template always describe the same instrument. ADay-unit lag advances in business days (a zero-day lag rolls forward to the next business day on or aftervaluation); other units advance by calendar arithmetic underbdc.