Skip to main content

Module legs

Module legs 

Expand description

Legs: a compiled list of coupons, and how to value one.

A leg is built once and valued many times. Everything a calendar decides — boundary rolls, payment lags, index windows, daily observation strips — is resolved when the leg is constructed, so a valuation walks dates and never a calendar. The stored leg is passive throughout; a mode enters only through the curves passed to Leg::npv.

There is one leg type, not one per coupon kind. A floating coupon needs a curve to project and a fixed one does not, but with the coupon set closed and projection taking an optional forward curve, that distinction stops being a type and becomes a variant.

A leg does not take a projection curve: it takes a CurveByIndex and asks it for each coupon’s curve by the index the coupon names. A single curve serves a single-index leg through OneCurve; a pricing view serves a leg on any number of declared indices; a leg of fixed coupons takes NoCurve.

Structs§

Leg
A compiled leg: coupons in payment order, the side they are on, how they combine, and — for a non-deliverable leg — how they settle.
LegTerms
The terms every leg shares, whatever its coupons pay.
NoCurve
No projection curve at all — a leg of fixed coupons, or one whose every reset has already fixed.
NonDeliverable
How a leg’s payments settle when they are not paid in the currency they accrue in: each converted into settlement — a non-deliverable leg, as an NDS’s two legs and an NDCCS’s reference leg are.
ObservationConventions
How an overnight coupon observes its index, beyond the plain daily strip: the RFR conventions FpML states under calculationParameters (lookback, observation period shift, lockout) and bounds on each daily rate. Every count is in business days of the strip’s calendar; the default is the plain strip.
OneCurve
One curve for every index — the single-curve source.
PaymentRule
How a schedule’s periods become payment dates.
UnknownStubRule
The name a stub rule is not.

Enums§

Accumulation
How a leg’s coupons combine into what the leg is worth.
Conversion
How one payment of a non-deliverable leg converts into the settlement currency: at an FX fixing on a date, or at a rate agreed at trade.
NonDeliverableError
Why a leg could not be made non-deliverable.
StubInterpolationError
Why a leg electing stub interpolation could not be built.
StubRule
How a term leg’s stubs read the index: over their own accrual period, or by ISDA 2006 §8.3 Linear Interpolation between two named Designated Maturities, as a confirmation elects it.

Constants§

ROLL_TOLERANCE_DAYS 🔒
How far a period’s end may sit from its index maturity and still be a regular period. A business-day roll moves a boundary by a few days — a weekend and a holiday, Easter’s Friday and Monday — where a stub moves it by weeks.

Traits§

CurveByIndex
Projection curves, by the index that names them.

Functions§

accrued_fixed_leg 🔒
accumulated_fixed_leg
The fixed side of a zero-coupon swap: one coupon carrying fixed_rate over [effective, maturity], accruing under compounding into a single payment at maturity.
accumulated_fixed_leg_by_period
accumulated_fixed_leg with its accrual measured period by period: the day count’s year fraction over each unadjusted frequency period from effective to maturity, summed. On 1/1 that counts one per sub-period — FpML’s 1/1 per calculation period — so an annual five-year leg compounds (1 + K)^5 where the one-accrual reading compounds (1 + K)^1.
accumulated_float_leg
The floating side of a zero-coupon swap: coupons’ rates compounding period by period into a single payment at pays.
fixed_rate_leg
Builds a fixed-rate leg over schedule.
ibor_leg
Builds an IBOR-style floating leg over schedule.
ibor_leg_on_index
Builds an IBOR-style floating leg over schedule whose coupons project as every term coupon does — a regular period over the index’s own window, a stub over its accrual — while each coupon accrues over its schedule period. ibor_leg keeps the accrual-window projection for a leg that names an index by string alone and so carries no tenor.
ibor_leg_with_stubs
ibor_leg_on_index with a stub rule: regular periods exactly as that builds them, and each stub — a period the index’s own window does not fit — reading the index as rule says through IborCoupon::with_stub, the seam the Python strip reads its stubs through too.
icma_accruals 🔒
period_accruals under ACT/ACT.ICMA, the one count that needs the schedule’s tenor.
index_tenor_window 🔒
The index’s full Designated Maturity window read by a period starting at start, on its own calendar, convention and end-of-month rule, whatever the period it serves — anchored, like every index window, on the fixing’s value date rather than the raw boundary.
interpolated_stub
The ISDA 2006 §8.3 interpolation a period on index reads between shorter and longer, or None for a regular period — one the index’s own window fits, which reads the index alone.
is_exchange 🔒
Whether coupon is a principal exchange rather than a coupon.
multi_reset_leg
A floating leg over schedule whose coupons reset every reset_tenor on index and pay once per period, the resets combined by method — a MultiResetCoupon per period, each final sub-period the reset tenor leaves short reading the index as stub says.
overnight_leg
Builds an overnight (RFR) floating leg over schedule, accumulating the daily prints the way accumulation says.
overnight_leg_with
overnight_leg observing its index under conventions: a lookback, an observation shift, a rate cut-off, and bounds on each daily rate.
overnight_observations
One observation per business day in [start, end), each spanning to the next business day and capped at end so the strip accrues exactly the period and telescopes to DF(start)/DF(end) when fully projected.
par_fixing_window
The window a term coupon on index, accruing from start to accrual_end, projects its rate over — the one rule every term-coupon builder applies, so a cap, a note and a swap on the same dates read the same forward.
period_accruals 🔒
Each period’s accrual under day_count. ACT/ACT.ICMA needs a reference period, which a bare pair of dates does not carry, so it is taken from the schedule’s tenor: the tenor here is the regular period the schedule’s own periods round to most often, and a short first period is measured against the tenor ending on its end, a short last one against the tenor starting on its start. Regular periods are the tenor’s share of a year either way; a long stub keeps the two-date reading.
term_fixing_window 🔒
yoy_inflation_leg
Builds a year-on-year inflation leg over schedule: one YoyInflationCoupon per period on index, each observing its own start and end at lag_months, paying gearing · YoY + spread.

Type Aliases§

LegWalk 🔒
What one pass over a leg’s future coupons produces: projected amounts, the discount factor at each payment, and — when asked for — each coupon’s basis-point weight. The two vectors a leg-level measure fuses over.