Skip to main content

Module products

Module products 

Expand description

Product construction: turning a template and a few trade terms into an instrument, and saying what market data it will need.

This is the assembly layer. It reaches into every layer below — schedules and conventions from the reference data, legs from the cashflow layer, instruments from theirs — which is why it ports last rather than first.

It takes no scalar type parameter, and that is the point. The reference library’s equivalent held 59 active-scalar references at 7.7k lines, which is why the original plan filed it with the passive layers and had to be corrected. Every one of those references was a contract term — a notional, a rate, a spread — and contract terms are passive here, so the layer that assembles them is passive too. A builder that had to know the pricing mode would mean the trade knew it.

What a product needs from the market is derived from the product, not declared alongside it: market_data_needs asks the assembled instrument. Two statements of the same fact would eventually disagree, and the one that resolves the curves is the one that matters.

Structs§

IrsIndexEntry 🔒
One irs-group template’s floating index, with the code to rebuild it.
ProductBuilder
Assembles one product from its terms.
ScheduleConventions
The schedule conventions a leg is generated under.
SideParseError
A spelling that is not a swap side.
SwapConventions 🔒
The conventions one swap template supplies to a ProductBuilder.
TenorDating 🔒
What a forward tenor is read against: the trade date, and the template’s spot rule — its calendar, spot lag and business-day convention.
TerminationParseError
Why a spelling is neither a date nor a forward tenor.
WindowTerms 🔒
What a one-period window swap is built from, read off either overnight template: the meeting template and the plain OIS template differ in what they know about a window’s identity, not in how the swap over it is built.

Enums§

FutureContract
Which listed contract a futures rung is quoted on.
FxSwapQuote
How an FX-swap pillar is quoted: the far outright, or forward points over the spot, both in the pair’s quoting units (collateral per one foreign).
Locator
Where a quote sits on its curve, in the spellings a quote sheet uses: a tenor (4Y), a date (2027-03-18), a contract code (SEP27), or a window of two dates or two codes (2026-10-29 - 2026-12-10, SEP27 - DEC27, also spelled with ..). The sheet binder and the helpers dispatch on its shape.
MeetingLocator
Which window a meeting-dated swap covers.
NdfError
Why a non-deliverable forward could not be drafted from a template.
NdoError
Why a non-deliverable option could not be drafted from a template.
NdsError
Why a non-deliverable swap could not be drafted from a template.
ProductFamily
Which product a builder is assembling.
RungBuildError
Why a basis ladder could not be built from a template.
Side
Which side of a swap draft the fixed leg is on: a payer pays fixed and receives floating, a receiver the reverse. The word the desk uses, and the word the Python draft’s with_side takes.
SwapLegsError
Why two legs do not make a fixed-versus-floating swap.
Termination
Where a swap draft ends: a stated date, or a forward tenor such as 5Y or 2Y2Y read from the draft’s trade date and its template’s spot, exactly as swap_dates_from_tenor reads one.
WindowEnd
One end of a window locator: a date, or a quarterly IMM contract code standing for its third Wednesday.

Traits§

SwapTemplateArg
A swap template as par_rungs takes it: a registry code, or a (code, &template) value, registered or customised, code the name a refusal calls it by.
XccyTemplateArg
A cross-currency template as cross_currency_rungs takes it: a registry code, or a template value, registered or customised.

Functions§

check_outright 🔒
An FX rung’s outright, refused where it cannot be one: not finite and positive; more than three times spot or under a third of it — forward points, or a quote in other units; or more than 10% from spot and nearer 1/spot than spot — the pair quoted the other way round. A curve solved on either is nonsense, and both are unmistakable against spot, so the rung is refused before anything is solved.
cross_currency_rungs
The spread rungs of a collateral ladder, built from a basis-swap template — what a recipe’s Basis segment declares, given its quotes.
cross_currency_rungs_resolved 🔒
cross_currency_rungs once its template is resolved.
deposit_rung
The par rung of a money-market deposit on a deposit template value: lent on valuation, maturing tenor on under the template’s calendar and convention, on the template’s day count, quoted at rate. Noded at the maturity, which is where a deposit pays, and labelled by its tenor.
fixings_needed_of 🔒
fra_rung
The par rung of a forward-rate agreement on a FRA template value: the accrual starts start after the index’s spot date and runs one index period, fixing on the index’s lag, quoted at rate. Noded at the accrual end and labelled <start>x<end> in months (3x6) where both are whole months, else by its start tenor.
future_rung
The par rung of a listed rate future on a future template value, quoted at its price (95.90): the rung’s quote is the futures rate (100 − price)/100, so the ladder’s residual is rate-scaled like its neighbours, and the instrument carries convexity as its adjustment — the curve fits the futures rate less the adjustment. Zero is a statement that future and forward coincide, not a neutral default. Noded at the contract’s accrual end and labelled by the contract.
fx_settlement_fixings 🔒
A cash-settled FX forward’s or option’s settlement fixing, every key of it, once the fixing date has passed — the line the pricer reads it at.
fx_swap_rung
The par rung of an FX swap on an FX-swap template value: the near leg on the valuation date at spot — where both discount factors are one, so the near exchange is worth exactly zero whatever the two curves — and the far leg on tenor advanced from the pair’s spot date (two business days on the template’s calendar) under its convention, at the quoted outright. The foreign leg’s collateral is the foreign currency under the template’s collateral currency, so the rung solves discount(<foreign>-CSA-<coll>); its quote is the outright, which the swap’s fair far rate verifies, and its residual is covered interest parity on the far date anchored at the valuation date — FxImplied’s reading from the same spot and outrights.
irs_index 🔒
The irs-group templates indexed by the floating index each references, built once per process. The registry is static, so this cannot go stale; a lookup is a scan over a dozen entries comparing names, and exactly one template is then constructed — the one asked for — rather than every template in the group until one matches.
market_data_needs
What an assembled product will need from the market.
meeting_overnight_swap
A meeting-dated overnight swap: one fixed coupon on the template’s fixed day count against one compounded overnight coupon over the window locator resolves to, both paid the template’s payment lag after the window end (two business days for USD, as its OIS pays). It is an OvernightIndexedSwap — the product the family already prices, quotes and risks — over a single meeting-to-meeting period.
meeting_rung
The par rung of a meeting-dated swap: the swap locator resolves to at rate, noded at the window’s end — where its accrual ends, not where it pays: the knot is the decision — its pillar carrying the deciding meeting’s identity where the window starts on one, and labelled by bank and meeting date (FED 2026-12-09).
meeting_window
The window a locator names on a meeting-OIS template, resolved against schedule — the bank’s seeded schedule where none is given — as (start, end, meeting): Window { start, end } as given, stamped with the decision whose effective date start is where the schedule has one; Ordinal(n) from the effective date of the n-th decision strictly after valuation to the effective date of the next; Meeting(decision) from that decision’s effective date to the next’s.
ndf_fixing_source
The fixing an NDF row settles on: the pair’s canonical key, settlement currency first (FX-USDKRW, FX-EURXOF); on a cross-currency row, the cross of the reference currency’s key against USD and the settlement currency’s (FX-USDKRW × FX-EURUSD).
ndf_rung
The par rung of an NDF on an NDF template value: an FX swap whose far leg is the cash-settled forward AnyTemplate::ndf drafts at the quoted outright — spot, value and fixing dates from the template’s own calendars and lag — turned to quote the reference currency as base, and whose near leg is the physical opposite on the valuation date at spot, where both discount factors are one, as fx_swap_rung’s is. The rung’s quote is the swap’s own far rate, settlement units per reference unit: the reciprocal of the sheet’s outright. The reference currency’s leg discounts under the settlement currency’s collateral, so the rung solves discount(<ref>-CSA-<settle>): the NDF-implied curve. Before its fixing a cash-settled forward values as the physical one, so the residual is covered interest parity at the value date, and the swap’s fair far rate verifies the quote. Quoted, as the template is, in reference units per settlement unit (KRW per USD).
nds_rung
The par rung of an NDS on an NDS template value: the swap AnyTemplate::nds drafts at par_rate, receiving fixed, noded at its last payment. It discounts in the settlement currency and reads the local currency’s curve under that collateral for its conversions, so it solves discount(<ref>-CSA-<settle>) past the forward market’s reach, against the floating index’s projection the market already holds.
nds_settlement 🔒
What an NDS row settles in, the fixing it converts at, and the local swap a tenor trade draws on: the source’s own, or — under a settlement override — the cross through USD into it, the swap paying on its settlement centre’s days too.
non_deliverable_fixings 🔒
A non-deliverable leg reads its FX fixing for every payment still to be valued once the fixing date has passed — the NDF’s rule.
not_family 🔒
par_rungs
The par rungs of a single-currency swap ladder, built from a swap template — the sibling of cross_currency_rungs for the commonest curve there is.
par_rungs_resolved 🔒
par_rungs once its template is resolved.
payment_rule 🔒
A lag, a convention and a calendar as one payment rule.
still_valued 🔒
Whether a valuation on valuation still values coupon of leg, and so still reads its resets. A non-summing leg pays once: every coupon counts until that payment and none after (Leg::npv). A summing leg skips a coupon paid on or before the valuation date (Leg::walk).
swap_builder_on_index
A ProductBuilder pre-loaded with the registered conventions for index’s standard single-currency swap — calendar, frequency, roll, business-day convention, day counts, and payment lag all come from the template registry, restated nowhere.
swap_builder_on_overnight_template
A swap builder from a named template, for the markets where an index alone does not determine the swap.
swap_builder_on_template
The currency and the floating day count come from the template’s own index, not from a second registry lookup. template_index_matches_the_registry_index pins that this is the same index the code-keyed path resolved, so routing through here changes no number.
swap_builder_on_tenor
A swap on a template value from a forward tenor: swap_dates_from_tenor then swap_builder_on_template.
swap_dates_from_tenor
A ProductBuilder pre-loaded with the conventions of a resolved swap template value, rather than of a template named by code.
swap_from_legs
A fixed-versus-floating swap from two compiled legs.
swap_index_code
The registered index code a swap template’s floating leg projects on, or None for a template that is not a swap.
tenor_basis_rung
The spread rung of a tenor basis swap on a tenor-basis template value: the swap from spot — the term leg’s fixing lag where a leg is a term index, two business days otherwise — to tenor on, carrying spread on its spread leg, noded at its final payment and labelled by tenor.
turn_rung
The par rung of a turn-of-period window [start, end] on a meeting-OIS template, quoted at the simple forward over the window — the surrounding level plus the jump, as a desk states a year-end turn — noded at end and carrying KnotKind::Turn(start); labelled turn <start>. A turn is a window, not an instant: the curve needs a pillar at start too, which a meeting rung or a plain window rung ending there supplies.
window_rung
The par rung of a one-period forward swap over [start, end] on an OIS template — the IMM-dated forward a vendor sheet quotes as SEP27 - DEC27, or any forward-starting window — built as the meeting-dated swap is, with the template’s payment lag, noded at the window end, labelled <start>..<end>, carrying no knot. A window on a meeting template is meeting_rung.
window_swap 🔒
The single-period swap over [start, end] on an overnight template’s terms: one fixed coupon against one compounded overnight coupon, both paid the template’s lag after the window end.