Legs#

Conventional Legs#

The rateslib.legs module creates Legs which typically contain a list of Periods. The pricing, and risk, calculations of Legs resolves to a linear sum of those same calculations looped over all of the individual Periods. Like Periods, it is probably quite rare that Legs will be instantiated directly, rather they will form the components of Instruments, but none-the-less, this page describes their construction.

rateslib.legs.FixedLeg(schedule, *[, ...])

A Leg containing FixedPeriod.

rateslib.legs.FloatLeg(schedule, *[, ...])

A Leg containing FloatPeriod.

rateslib.legs.ZeroFixedLeg(schedule, *[, ...])

A zero coupon Leg composed of a single ZeroFixedPeriod .

rateslib.legs.ZeroFloatLeg(schedule, *[, ...])

A zero coupon Leg composed of a single ZeroFloatPeriod.

rateslib.legs.ZeroIndexLeg(schedule, *[, ...])

A Leg composed of indexed Cashflow at termination, and possibly effective.

Credit Legs#

Custom Legs and Objects#

rateslib.legs.CustomLeg(periods)

A Leg containing user specified _BasePeriod.

rateslib.legs.Amortization(n, initial[, ...])

An amortization schedule for any _BaseLeg.

rateslib.legs._BaseLeg(*args, **kwargs)

Abstract base class used in the construction of Legs.

Protocols#

rateslib.legs.protocols._WithNPV(*args, **kwargs)

Protocol to establish value of any Leg type.

rateslib.legs.protocols._WithCashflows(...)

Protocol to generate cashflows of any Leg type.

rateslib.legs.protocols._WithAnalyticDelta(...)

Protocol to calculate analytical rate delta sensitivities of any Leg type.

rateslib.legs.protocols._WithAnalyticRateFixings(...)

Protocol to calculate analytical rate fixing sensitivities of any Leg type.

rateslib.legs.protocols._WithExDiv(*args, ...)

Protocol to determine if a Leg is ex-dividend on a given settlement.