Module calc_methods
Expand description
vendor calc-type registry — the VendorCalcMethod convention bundles.
The vendor’s DES Calc Type field encodes, per market, how a bond’s analytics are conventioned: the coupon accrual basis, the (possibly different) accrued-interest basis, the ex-dividend rule, and the yield quote method. This module is the curated, screen-verified subset of that registry: each row here ships with a reference test pinned to a real DES/YAS screen, and codes outside the table resolve to a loud error — never a silent guess. (The full vendor list spans warrants, preferreds, loans, floaters, and Bradys; only bond codes belong here, each tagged with the instrument kind it applies to.)
Deliberately excluded (help-page reviewed, structure not representable
— a wrong booking is worse than a missing row): preferred / preference
shares (56, 57, 103, 104, 192, 721), warrants (125, 126, 199), partly-paid
(59), sinking-fund / amortizing (77, 785 — the product exists, as a
FixedRateBond with a notional
profile, but the static carries no schedule to build one from), stepped /
multi-coupon schedules (133, 720), Indonesian fix-to-float (742), Brady
MCF / Russian IANs (772), callable interest-at-maturity (791),
long-last-coupon schedules (241 — the backward
short-stub schedule generator cannot produce a merged final period),
zero-redemption interest-only strips (276 — FixedRateBond always
redeems face), Canadian / special multi-coupon steps (292, 320), inverse
floaters (303, 305 — fixed-rate-minus-benchmark coupons), long-last
coupons also at 327 and 373,
FX-linked cashflows (1409 FX-linked notes, 1451 Israel Gilboa USD/ILS
coupons), intra-period sinking factors (1459).
The pay-in-kind family is unregistered for three different reasons, and
the distinction is deliberate — a user who hits one needs to know which
boundary they crossed. The structure itself is now representable:
PaymentInKindBond
books a fixed-rate PIK through the contractual-accretion seam.
- 111 (pay-in-kind) — pending a help-page pin. The instrument is supported, but a registry row must fix the accretion convention (rate, frequency, day count, and quote basis) from the vendor page rather than guess it. Until that page is transcribed the code stays unregistered and a PIK is booked through its own constructor. Not a statement about the structure.
- 212 (% PIK preferred) — elective. Whether a period pays cash or capitalises is issuer discretion carried as trade state, not a contractual formula a static convention bundle can express.
- 1423, 1445 (pay-in-kind floats and toggles) — rate-dependent or elective. A capitalisation rate driven by a forecast index makes the accreted face a function of market data, which the build-once bond cashflow model cannot hold safely (the coupons would re-derive on a curve bump while the face denominating every price and accrued quantity went stale).
None of these three is “not modelled”; all are scoped out with a stated obstacle.
Inflation-linked calc types carry the InflationLinked kind and book
through InflationLinkedBond
materialisation. Graduated rows (44, 175, 314, 1193, 1195, plus the
reserved-internal TIPS/RRB rows) also resolve a LinkerConvention.
Both halves of the convention layer now dispatch. YieldQuoteMethod
resolves to a YieldKernel the nominal yield-space entry points evaluate,
and LinkerConvention resolves to the per-market quote arithmetic in
instruments::bonds::linker. Each
selects how a security is quoted; neither is read when one is priced.
The top of the code space (65000+) is reserved internal: rows the vendor registry has no verified code for yet (US TIPS, Canadian RRBs). They are documented as swappable — when a DES screen supplies the real code, the row moves and the constant follows.
Structs§
- Calc
Conventions - The convention bundle a calc-type code resolves to. Applied by
FixedRateBond::from_static: the bundle supplies what the flat static cannot express — the coupon basis (superseding the static’s DES day count, which for these markets is the accrued basis), the accrued-basis override, the ex-div rule, and the yield conventions. The static’s payment frequency always wins (it is structural), and an explicitly set static ex-div rule or non-default yield convention wins over the bundle’s. - NoSingle
Basis - A yield convention asked for a reading that needs one compounding basis when its kernel has none — the ISE and JGB simple-yield conventions.
- Vendor
Calc Method - A resolved vendor calc-type: the code, its DES label, and the bundle.
Enums§
- Bond
Kind - The instrument kind a calc-type code applies to.
- Calc
Method Error - Calc-type resolution failure.
- Convention
Status - Whether a calc type’s convention is fully pinned against a vendor screen.
- Linker
Convention - The per-market linker street convention a graduated inflation-linked row
resolves to — the linker analogue of
YieldConventionfor nominal street yields. - Yield
Kernel - The arithmetic a
YieldQuoteMethodresolves to. - Yield
Quote Convention - The convention a quoted yield is stated under, by the one name a caller gives it.
- Yield
Quote Method - The market’s primary yield quote convention.
Constants§
- CALC_
CANADIAN_ RRB - Reserved-internal calc code for Canadian Real Return Bonds (no verified vendor code yet; swappable — see the module docs).
- CALC_
US_ TIPS - Reserved-internal calc code for US TIPS (no verified vendor code yet; swappable — see the module docs).
- PENDING_
PINS 🔒 - Every code whose convention is partly pending a vendor screen pin, and
what is outstanding — in ascending code order, transcribed from the row
comments in
VendorCalcMethod::from_code. A test re-derives the set from those comments, so a new PENDING note without a row here, or a row whose note has gone, fails by code. - STREET 🔒
- The ICMA-coupon default bundle (street/ISMA family): coupons on the reference-period basis, accrued on the same basis, yields compounded at the bond’s own frequency.