Cash Flows Module

Cash Flows

SimpleCashFlow

class pyquantlib.SimpleCashFlow

Bases: CashFlow

Simple cash flow paying a fixed amount on a given date.

__init__(amount: SupportsFloat | SupportsIndex, date: Date) None

Constructs a cash flow with the given amount and date.

cf = ql.SimpleCashFlow(1000.0, ql.Date(15, 6, 2026))
print(cf.amount())  # 1000.0
print(cf.date())    # June 15th, 2026

Redemption

class pyquantlib.Redemption

Bases: SimpleCashFlow

Bond redemption payment.

__init__(amount: SupportsFloat | SupportsIndex, date: Date) None

Constructs a redemption with the given amount and date.

AmortizingPayment

class pyquantlib.AmortizingPayment

Bases: SimpleCashFlow

Amortizing payment cash flow.

__init__(amount: SupportsFloat | SupportsIndex, date: Date) None

Constructs an amortizing payment with the given amount and date.

Coupons

FixedRateCoupon

class pyquantlib.FixedRateCoupon

Bases: Coupon

Coupon paying a fixed interest rate.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(paymentDate: Date, nominal: SupportsFloat | SupportsIndex, interestRate: InterestRate, accrualStartDate: Date, accrualEndDate: Date, refPeriodStart: Date = <Date: null date>, refPeriodEnd: Date = <Date: null date>, exCouponDate: Date = <Date: null date>) -> None

Constructs a fixed-rate coupon from an InterestRate.

  1. __init__(paymentDate: Date, nominal: SupportsFloat | SupportsIndex, rate: SupportsFloat | SupportsIndex, dayCounter: DayCounter, accrualStartDate: Date, accrualEndDate: Date, refPeriodStart: Date = <Date: null date>, refPeriodEnd: Date = <Date: null date>, exCouponDate: Date = <Date: null date>) -> None

Constructs a fixed-rate coupon from rate and day counter.

interestRate() InterestRate

Returns the interest rate.

coupon = ql.FixedRateCoupon(
    payment_date, nominal, rate, day_counter, accrual_start, accrual_end
)
print(coupon.amount())
print(coupon.rate())

FloatingRateCoupon

class pyquantlib.FloatingRateCoupon

Bases: Coupon

Coupon paying a variable index-based rate.

__init__(paymentDate: Date, nominal: SupportsFloat | SupportsIndex, startDate: Date, endDate: Date, fixingDays: SupportsInt | SupportsIndex, index: QuantLib::InterestRateIndex, gearing: SupportsFloat | SupportsIndex = 1.0, spread: SupportsFloat | SupportsIndex = 0.0, refPeriodStart: Date = <Date: null date>, refPeriodEnd: Date = <Date: null date>, dayCounter: object = None, isInArrears: bool = False, exCouponDate: Date = <Date: null date>) None

Constructs a floating-rate coupon.

adjustedFixing() float

Returns the convexity-adjusted fixing.

convexityAdjustment() float

Returns the convexity adjustment.

fixingDate() Date

Returns the fixing date.

fixingDays() int

Returns the number of fixing days.

gearing() float

Returns the index gearing.

index() QuantLib::InterestRateIndex

Returns the floating index.

indexFixing() float

Returns the fixing of the underlying index.

isInArrears() bool

Returns whether the coupon fixes in arrears.

pricer() base.FloatingRateCouponPricer

Returns the coupon pricer.

setPricer(pricer: base.FloatingRateCouponPricer) None

Sets the coupon pricer.

spread() float

Returns the spread over the index fixing.

Base class for coupons paying a variable index-based rate.

coupon = ql.FloatingRateCoupon(
    payment_date, nominal, start_date, end_date,
    fixingDays=2, index=euribor6m, gearing=1.0, spread=0.005
)
print(coupon.gearing())     # 1.0
print(coupon.spread())      # 0.005
print(coupon.fixingDate())

IborCoupon

class pyquantlib.IborCoupon

Bases: FloatingRateCoupon

Coupon paying a Libor-type index.

__init__(paymentDate: Date, nominal: SupportsFloat | SupportsIndex, startDate: Date, endDate: Date, fixingDays: SupportsInt | SupportsIndex, index: QuantLib::IborIndex, gearing: SupportsFloat | SupportsIndex = 1.0, spread: SupportsFloat | SupportsIndex = 0.0, refPeriodStart: Date = <Date: null date>, refPeriodEnd: Date = <Date: null date>, dayCounter: object = None, isInArrears: bool = False, exCouponDate: Date = <Date: null date>) None

Constructs an Ibor coupon.

fixingDate() Date

Returns the fixing date.

fixingEndDate() Date

Returns the end of the deposit period underlying the coupon fixing.

fixingMaturityDate() Date

Returns the end of the deposit period underlying the fixing.

fixingValueDate() Date

Returns the start of the deposit period underlying the fixing.

iborIndex() QuantLib::IborIndex

Returns the Ibor index.

spanningTime() float

Returns the period underlying the coupon fixing as a year fraction.

Coupon paying a Libor-type index (e.g., Euribor, USD LIBOR).

coupon = ql.IborCoupon(
    payment_date, 1e6, start_date, end_date,
    2, euribor6m
)
print(coupon.fixingDate())
print(coupon.fixingValueDate())

OvernightIndexedCoupon

class pyquantlib.OvernightIndexedCoupon

Bases: FloatingRateCoupon

Coupon paying the compounded daily overnight rate.

__init__(paymentDate: Date, nominal: SupportsFloat | SupportsIndex, startDate: Date, endDate: Date, overnightIndex: QuantLib::OvernightIndex, gearing: SupportsFloat | SupportsIndex = 1.0, spread: SupportsFloat | SupportsIndex = 0.0, refPeriodStart: Date = <Date: null date>, refPeriodEnd: Date = <Date: null date>, dayCounter: object = None, telescopicValueDates: bool = False, averagingMethod: RateAveraging.Type = <Type.Compound: 1>, lookbackDays: object = None, lockoutDays: SupportsInt | SupportsIndex = 0, applyObservationShift: bool = False) None

Constructs an overnight indexed coupon.

applyObservationShift() bool

Returns whether observation shift is applied.

averagingMethod() RateAveraging.Type

Returns the averaging method.

dt() list[float]

Returns the accrual periods.

fixingDates() list[Date]

Returns the fixing dates for the rates to be compounded.

indexFixings() list[float]

Returns the fixings to be compounded.

lockoutDays() int

Returns the number of lockout days.

valueDates() list[Date]

Returns the value dates for the rates to be compounded.

Coupon paying the compounded (or simple average) daily overnight rate.

coupon = ql.OvernightIndexedCoupon(
    payment_date, 10e6, start_date, end_date,
    overnight_index, spread=0.001,
    averagingMethod=ql.RateAveraging.Type.Compound
)

CmsCoupon

class pyquantlib.CmsCoupon

Bases: FloatingRateCoupon

Coupon paying a CMS swap rate.

__init__(paymentDate: Date, nominal: SupportsFloat | SupportsIndex, startDate: Date, endDate: Date, fixingDays: SupportsInt | SupportsIndex, index: QuantLib::SwapIndex, gearing: SupportsFloat | SupportsIndex = 1.0, spread: SupportsFloat | SupportsIndex = 0.0, refPeriodStart: Date = <Date: null date>, refPeriodEnd: Date = <Date: null date>, dayCounter: object = None, isInArrears: bool = False, exCouponDate: Date = <Date: null date>) None

Constructs a CMS coupon.

swapIndex() QuantLib::SwapIndex

Returns the underlying swap index.

Coupon paying a CMS (Constant Maturity Swap) rate.

coupon = ql.CmsCoupon(
    payment_date, 1e6, start_date, end_date,
    2, swap_index
)

Capped/Floored Coupons

CappedFlooredCoupon

class pyquantlib.CappedFlooredCoupon

Bases: FloatingRateCoupon

Capped and/or floored floating-rate coupon.

__init__(underlying: FloatingRateCoupon, cap: object = None, floor: object = None) None

Constructs from an underlying coupon with optional cap/floor.

cap() float

Returns the cap rate.

convexityAdjustment() float

Returns the convexity adjustment.

effectiveCap() float

Returns the effective cap of fixing.

effectiveFloor() float

Returns the effective floor of fixing.

floor() float

Returns the floor rate.

isCapped() bool

Returns whether the coupon is capped.

isFloored() bool

Returns whether the coupon is floored.

rate() float

Returns the capped/floored rate.

setPricer(pricer: base.FloatingRateCouponPricer) None

Sets the coupon pricer.

underlying() FloatingRateCoupon

Returns the underlying floating-rate coupon.

Wraps a floating-rate coupon with optional cap and/or floor. Use None for absent cap or floor.

underlying = ql.IborCoupon(payment_date, 1e6, start, end, 2, euribor6m)
cf = ql.CappedFlooredCoupon(underlying, cap=0.05, floor=0.01)
print(cf.isCapped(), cf.isFloored())  # True True
print(cf.effectiveCap(), cf.effectiveFloor())

CappedFlooredIborCoupon

class pyquantlib.CappedFlooredIborCoupon

Bases: CappedFlooredCoupon

Capped/floored Ibor coupon.

__init__(paymentDate: Date, nominal: SupportsFloat | SupportsIndex, startDate: Date, endDate: Date, fixingDays: SupportsInt | SupportsIndex, index: QuantLib::IborIndex, gearing: SupportsFloat | SupportsIndex = 1.0, spread: SupportsFloat | SupportsIndex = 0.0, cap: object = None, floor: object = None, refPeriodStart: Date = <Date: null date>, refPeriodEnd: Date = <Date: null date>, dayCounter: object = None, isInArrears: bool = False, exCouponDate: Date = <Date: null date>) None

Constructs a capped/floored Ibor coupon.

Convenience class that builds a capped/floored Ibor coupon in a single constructor.

CappedFlooredCmsCoupon

class pyquantlib.CappedFlooredCmsCoupon

Bases: CappedFlooredCoupon

Capped/floored CMS coupon.

__init__(paymentDate: Date, nominal: SupportsFloat | SupportsIndex, startDate: Date, endDate: Date, fixingDays: SupportsInt | SupportsIndex, index: QuantLib::SwapIndex, gearing: SupportsFloat | SupportsIndex = 1.0, spread: SupportsFloat | SupportsIndex = 0.0, cap: object = None, floor: object = None, refPeriodStart: Date = <Date: null date>, refPeriodEnd: Date = <Date: null date>, dayCounter: object = None, isInArrears: bool = False, exCouponDate: Date = <Date: null date>) None

Constructs a capped/floored CMS coupon.

Convenience class that builds a capped/floored CMS coupon in a single constructor.

Digital Coupons

DigitalCoupon

class pyquantlib.DigitalCoupon

Bases: FloatingRateCoupon

Floating-rate coupon with digital call/put option.

__init__(underlying: FloatingRateCoupon, callStrike: object = None, callPosition: PositionType = <PositionType.Long: 0>, isCallITMIncluded: bool = False, callDigitalPayoff: object = None, putStrike: object = None, putPosition: PositionType = <PositionType.Long: 0>, isPutITMIncluded: bool = False, putDigitalPayoff: object = None, replication: object = None, nakedOption: bool = False) None

Constructs a digital coupon.

callDigitalPayoff() float

Returns the call digital payoff.

callOptionRate() float

Returns the call option rate.

callStrike() float

Returns the call strike.

convexityAdjustment() float

Returns the convexity adjustment.

hasCall() bool

Returns whether the coupon has a call.

hasCollar() bool

Returns whether the coupon has a collar.

hasPut() bool

Returns whether the coupon has a put.

isLongCall() bool

Returns whether the call position is long.

isLongPut() bool

Returns whether the put position is long.

putDigitalPayoff() float

Returns the put digital payoff.

putOptionRate() float

Returns the put option rate.

putStrike() float

Returns the put strike.

rate() float

Returns the coupon rate.

setPricer(pricer: base.FloatingRateCouponPricer) None

Sets the coupon pricer.

underlying() FloatingRateCoupon

Returns the underlying floating-rate coupon.

Floating-rate coupon with embedded digital (binary) call and/or put option.

dc = ql.DigitalCoupon(underlying, callStrike=0.04, putStrike=0.02)
print(dc.hasCall(), dc.hasPut(), dc.hasCollar())  # True True True

DigitalIborCoupon

class pyquantlib.DigitalIborCoupon

Bases: DigitalCoupon

Ibor coupon with digital call/put option.

__init__(underlying: IborCoupon, callStrike: object = None, callPosition: PositionType = <PositionType.Long: 0>, isCallATMIncluded: bool = False, callDigitalPayoff: object = None, putStrike: object = None, putPosition: PositionType = <PositionType.Long: 0>, isPutATMIncluded: bool = False, putDigitalPayoff: object = None, replication: object = None, nakedOption: bool = False) None

Constructs a digital Ibor coupon.

Digital coupon specialized for Ibor underlyings.

DigitalCmsCoupon

class pyquantlib.DigitalCmsCoupon

Bases: DigitalCoupon

CMS coupon with digital call/put option.

__init__(underlying: CmsCoupon, callStrike: object = None, callPosition: PositionType = <PositionType.Long: 0>, isCallATMIncluded: bool = False, callDigitalPayoff: object = None, putStrike: object = None, putPosition: PositionType = <PositionType.Long: 0>, isPutATMIncluded: bool = False, putDigitalPayoff: object = None, replication: object = None, nakedOption: bool = False) None

Constructs a digital CMS coupon.

Digital coupon specialized for CMS underlyings.

DigitalIborLeg

class pyquantlib.DigitalIborLeg

Bases: pybind11_object

Helper class for building a leg of digital Ibor coupons.

__init__(schedule: Schedule, index: QuantLib::IborIndex) None

Constructs from a schedule and Ibor index.

build() list[base.CashFlow]

Builds and returns the leg of cash flows.

inArrears(flag: bool = True) DigitalIborLeg
withCallATM(flag: bool = True) DigitalIborLeg
withCallPayoffs(*args, **kwargs)

Overloaded function.

  1. withCallPayoffs(payoff: SupportsFloat | SupportsIndex) -> DigitalIborLeg

  2. withCallPayoffs(payoffs: collections.abc.Sequence[SupportsFloat | SupportsIndex]) -> DigitalIborLeg

withCallStrikes(*args, **kwargs)

Overloaded function.

  1. withCallStrikes(strike: SupportsFloat | SupportsIndex) -> DigitalIborLeg

  2. withCallStrikes(strikes: collections.abc.Sequence[SupportsFloat | SupportsIndex]) -> DigitalIborLeg

withFixingDays(*args, **kwargs)

Overloaded function.

  1. withFixingDays(fixingDays: SupportsInt | SupportsIndex) -> DigitalIborLeg

  2. withFixingDays(fixingDays: collections.abc.Sequence[SupportsInt | SupportsIndex]) -> DigitalIborLeg

withGearings(*args, **kwargs)

Overloaded function.

  1. withGearings(gearing: SupportsFloat | SupportsIndex) -> DigitalIborLeg

  2. withGearings(gearings: collections.abc.Sequence[SupportsFloat | SupportsIndex]) -> DigitalIborLeg

withLongCallOption(type: PositionType) DigitalIborLeg
withLongPutOption(type: PositionType) DigitalIborLeg
withNakedOption(nakedOption: bool = True) DigitalIborLeg
withNotionals(*args, **kwargs)

Overloaded function.

  1. withNotionals(nominal: SupportsFloat | SupportsIndex) -> DigitalIborLeg

  2. withNotionals(nominals: collections.abc.Sequence[SupportsFloat | SupportsIndex]) -> DigitalIborLeg

withPaymentAdjustment(convention: BusinessDayConvention) DigitalIborLeg
withPaymentDayCounter(dayCounter: DayCounter) DigitalIborLeg
withPutATM(flag: bool = True) DigitalIborLeg
withPutPayoffs(*args, **kwargs)

Overloaded function.

  1. withPutPayoffs(payoff: SupportsFloat | SupportsIndex) -> DigitalIborLeg

  2. withPutPayoffs(payoffs: collections.abc.Sequence[SupportsFloat | SupportsIndex]) -> DigitalIborLeg

withPutStrikes(*args, **kwargs)

Overloaded function.

  1. withPutStrikes(strike: SupportsFloat | SupportsIndex) -> DigitalIborLeg

  2. withPutStrikes(strikes: collections.abc.Sequence[SupportsFloat | SupportsIndex]) -> DigitalIborLeg

withReplication(replication: DigitalReplication) DigitalIborLeg
withSpreads(*args, **kwargs)

Overloaded function.

  1. withSpreads(spread: SupportsFloat | SupportsIndex) -> DigitalIborLeg

  2. withSpreads(spreads: collections.abc.Sequence[SupportsFloat | SupportsIndex]) -> DigitalIborLeg

Fluent builder for a leg of digital Ibor coupons.

leg = ql.DigitalIborLeg(schedule, euribor6m) \
    .withNotionals(1e6) \
    .withCallStrikes(0.04) \
    .withLongCallOption(ql.PositionType.Long) \
    .withReplication(ql.DigitalReplication()) \
    .build()

DigitalCmsLeg

class pyquantlib.DigitalCmsLeg

Bases: pybind11_object

Helper class for building a leg of digital CMS coupons.

__init__(schedule: Schedule, index: QuantLib::SwapIndex) None

Constructs from a schedule and swap index.

build() list[base.CashFlow]

Builds and returns the leg of cash flows.

inArrears(flag: bool = True) DigitalCmsLeg
withCallATM(flag: bool = True) DigitalCmsLeg
withCallPayoffs(*args, **kwargs)

Overloaded function.

  1. withCallPayoffs(payoff: SupportsFloat | SupportsIndex) -> DigitalCmsLeg

  2. withCallPayoffs(payoffs: collections.abc.Sequence[SupportsFloat | SupportsIndex]) -> DigitalCmsLeg

withCallStrikes(*args, **kwargs)

Overloaded function.

  1. withCallStrikes(strike: SupportsFloat | SupportsIndex) -> DigitalCmsLeg

  2. withCallStrikes(strikes: collections.abc.Sequence[SupportsFloat | SupportsIndex]) -> DigitalCmsLeg

withFixingDays(*args, **kwargs)

Overloaded function.

  1. withFixingDays(fixingDays: SupportsInt | SupportsIndex) -> DigitalCmsLeg

  2. withFixingDays(fixingDays: collections.abc.Sequence[SupportsInt | SupportsIndex]) -> DigitalCmsLeg

withGearings(*args, **kwargs)

Overloaded function.

  1. withGearings(gearing: SupportsFloat | SupportsIndex) -> DigitalCmsLeg

  2. withGearings(gearings: collections.abc.Sequence[SupportsFloat | SupportsIndex]) -> DigitalCmsLeg

withLongCallOption(type: PositionType) DigitalCmsLeg
withLongPutOption(type: PositionType) DigitalCmsLeg
withNakedOption(nakedOption: bool = True) DigitalCmsLeg
withNotionals(*args, **kwargs)

Overloaded function.

  1. withNotionals(nominal: SupportsFloat | SupportsIndex) -> DigitalCmsLeg

  2. withNotionals(nominals: collections.abc.Sequence[SupportsFloat | SupportsIndex]) -> DigitalCmsLeg

withPaymentAdjustment(convention: BusinessDayConvention) DigitalCmsLeg
withPaymentDayCounter(dayCounter: DayCounter) DigitalCmsLeg
withPutATM(flag: bool = True) DigitalCmsLeg
withPutPayoffs(*args, **kwargs)

Overloaded function.

  1. withPutPayoffs(payoff: SupportsFloat | SupportsIndex) -> DigitalCmsLeg

  2. withPutPayoffs(payoffs: collections.abc.Sequence[SupportsFloat | SupportsIndex]) -> DigitalCmsLeg

withPutStrikes(*args, **kwargs)

Overloaded function.

  1. withPutStrikes(strike: SupportsFloat | SupportsIndex) -> DigitalCmsLeg

  2. withPutStrikes(strikes: collections.abc.Sequence[SupportsFloat | SupportsIndex]) -> DigitalCmsLeg

withReplication(replication: DigitalReplication) DigitalCmsLeg
withSpreads(*args, **kwargs)

Overloaded function.

  1. withSpreads(spread: SupportsFloat | SupportsIndex) -> DigitalCmsLeg

  2. withSpreads(spreads: collections.abc.Sequence[SupportsFloat | SupportsIndex]) -> DigitalCmsLeg

Fluent builder for a leg of digital CMS coupons. Same API as DigitalIborLeg but takes a SwapIndex.

ReplicationType

class pyquantlib.ReplicationType

Bases: pybind11_object

Digital option replication strategy.

Members:

Sub : Sub-replication (lower bound).

Central : Central replication.

Super : Super-replication (upper bound).

__init__(value: SupportsInt | SupportsIndex) None
Central = <ReplicationType.Central: 1>
Sub = <ReplicationType.Sub: 0>
Super = <ReplicationType.Super: 2>
ReplicationType.name -> str
property value

Value

Description

Sub

Sub-replication (lower bound)

Central

Central replication

Super

Super-replication (upper bound)

DigitalReplication

class pyquantlib.DigitalReplication

Bases: pybind11_object

Digital option replication configuration.

__init__(replicationType: ReplicationType = <ReplicationType.Central: 1>, gap: SupportsFloat | SupportsIndex = 0.0001) None

Constructs with replication type and gap.

gap() float

Returns the gap size.

replicationType() ReplicationType

Returns the replication type.

Configuration for digital option replication strategy.

repl = ql.DigitalReplication(ql.ReplicationType.Central, gap=1e-4)

Coupon Pricers

BlackIborCouponPricer

class pyquantlib.BlackIborCouponPricer

Bases: FloatingRateCouponPricer

Black-formula pricer for capped/floored Ibor coupons.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__() -> None

Constructs with no optionlet volatility.

  1. __init__(volatility: QuantLib::Handle<QuantLib::OptionletVolatilityStructure>) -> None

Constructs with optionlet volatility.

Black-formula pricer for Ibor coupons. Attach to a leg with setCouponPricer.

pricer = ql.BlackIborCouponPricer()
ql.setCouponPricer(floating_leg, pricer)

LinearTsrPricer

class pyquantlib.LinearTsrPricer

Bases: CmsCouponPricer, MeanRevertingPricer

CMS coupon pricer using linear terminal swap rate model.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(swaptionVol: QuantLib::Handle<QuantLib::SwaptionVolatilityStructure>, meanReversion: QuoteHandle, couponDiscountCurve: object = None, settings: LinearTsrPricerSettings = <LinearTsrPricerSettings object at 0x7f252f3fa170>) -> None

Constructs with explicit handles.

  1. __init__(swaptionVol: QuantLib::SwaptionVolatilityStructure, meanReversion: base.Quote, couponDiscountCurve: object = None, settings: LinearTsrPricerSettings = <LinearTsrPricerSettings object at 0x7f253436b770>) -> None

Constructs from shared pointers (handles created internally).

capletPrice(effectiveCap: SupportsFloat | SupportsIndex) float

Returns the caplet price.

capletRate(effectiveCap: SupportsFloat | SupportsIndex) float

Returns the caplet rate.

floorletPrice(effectiveFloor: SupportsFloat | SupportsIndex) float

Returns the floorlet price.

floorletRate(effectiveFloor: SupportsFloat | SupportsIndex) float

Returns the floorlet rate.

meanReversion() float

Returns the mean reversion value.

setMeanReversion(meanReversion: QuoteHandle) None

Sets the mean reversion handle.

swapletPrice() float

Returns the swaplet price.

swapletRate() float

Returns the swaplet rate.

Linear Terminal Swap Rate pricer for CMS coupons.

pricer = ql.LinearTsrPricer(swaption_vol, mean_reversion)
ql.setCouponPricer(cms_leg, pricer)

LinearTsrPricerSettings

class pyquantlib.LinearTsrPricerSettings

Bases: pybind11_object

Settings for LinearTsrPricer integration bounds.

__init__() None

Constructs default settings (RateBound strategy).

withBSStdDevs(*args, **kwargs)

Overloaded function.

  1. withBSStdDevs(stdDevs: SupportsFloat | SupportsIndex = 3.0) -> LinearTsrPricerSettings

Sets Black-Scholes std devs strategy with default bounds.

  1. withBSStdDevs(stdDevs: SupportsFloat | SupportsIndex, lowerRateBound: SupportsFloat | SupportsIndex, upperRateBound: SupportsFloat | SupportsIndex) -> LinearTsrPricerSettings

Sets Black-Scholes std devs strategy with explicit bounds.

withPriceThreshold(*args, **kwargs)

Overloaded function.

  1. withPriceThreshold(priceThreshold: SupportsFloat | SupportsIndex = 1e-08) -> LinearTsrPricerSettings

Sets price threshold strategy with default bounds.

  1. withPriceThreshold(priceThreshold: SupportsFloat | SupportsIndex, lowerRateBound: SupportsFloat | SupportsIndex, upperRateBound: SupportsFloat | SupportsIndex) -> LinearTsrPricerSettings

Sets price threshold strategy with explicit bounds.

withRateBound(lowerRateBound: SupportsFloat | SupportsIndex = 0.0, upperRateBound: SupportsFloat | SupportsIndex = 2.0) LinearTsrPricerSettings

Sets rate bound strategy with explicit bounds.

withVegaRatio(*args, **kwargs)

Overloaded function.

  1. withVegaRatio(vegaRatio: SupportsFloat | SupportsIndex = 0.01) -> LinearTsrPricerSettings

Sets vega ratio strategy with default bounds.

  1. withVegaRatio(vegaRatio: SupportsFloat | SupportsIndex, lowerRateBound: SupportsFloat | SupportsIndex, upperRateBound: SupportsFloat | SupportsIndex) -> LinearTsrPricerSettings

Sets vega ratio strategy with explicit bounds.

LinearTsrPricerStrategy

class pyquantlib.LinearTsrPricerStrategy

Bases: pybind11_object

Integration boundary determination strategy.

Members:

RateBound

VegaRatio

PriceThreshold

BSStdDevs

__init__(value: SupportsInt | SupportsIndex) None
BSStdDevs = <LinearTsrPricerStrategy.BSStdDevs: 3>
PriceThreshold = <LinearTsrPricerStrategy.PriceThreshold: 2>
RateBound = <LinearTsrPricerStrategy.RateBound: 0>
VegaRatio = <LinearTsrPricerStrategy.VegaRatio: 1>
LinearTsrPricerStrategy.name -> str
property value

YieldCurveModel

class pyquantlib.YieldCurveModel

Bases: pybind11_object

Yield curve model for CMS convexity adjustment.

Members:

Standard

ExactYield

ParallelShifts

NonParallelShifts

__init__(value: SupportsInt | SupportsIndex) None
ExactYield = <YieldCurveModel.ExactYield: 1>
NonParallelShifts = <YieldCurveModel.NonParallelShifts: 3>
ParallelShifts = <YieldCurveModel.ParallelShifts: 2>
Standard = <YieldCurveModel.Standard: 0>
YieldCurveModel.name -> str
property value

Value

Description

Standard

Standard yield curve model

ExactYield

Exact yield model

ParallelShifts

Parallel shifts model

NonParallelShifts

Non-parallel shifts model

HaganPricer

class pyquantlib.HaganPricer

Bases: CmsCouponPricer, MeanRevertingPricer

CMS coupon pricer using Hagan static replication.

__init__(*args, **kwargs)
capletPrice(effectiveCap: SupportsFloat | SupportsIndex) float

Returns the caplet price.

capletRate(effectiveCap: SupportsFloat | SupportsIndex) float

Returns the caplet rate.

floorletPrice(effectiveFloor: SupportsFloat | SupportsIndex) float

Returns the floorlet price.

floorletRate(effectiveFloor: SupportsFloat | SupportsIndex) float

Returns the floorlet rate.

meanReversion() float

Returns the mean reversion value.

setMeanReversion(meanReversion: QuoteHandle) None

Sets the mean reversion handle.

swapletRate() float

Returns the swaplet rate.

Abstract base class for Hagan-style CMS coupon pricers using static replication. Inherits from both CmsCouponPricer and MeanRevertingPricer.

AnalyticHaganPricer

class pyquantlib.AnalyticHaganPricer

Bases: HaganPricer

Analytic CMS coupon pricer using Hagan formula.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(swaptionVol: QuantLib::Handle<QuantLib::SwaptionVolatilityStructure>, modelOfYieldCurve: YieldCurveModel, meanReversion: QuoteHandle) -> None

Constructs with explicit handles.

  1. __init__(swaptionVol: QuantLib::SwaptionVolatilityStructure, modelOfYieldCurve: YieldCurveModel, meanReversion: base.Quote) -> None

Constructs from shared pointers (handles created internally).

Analytic CMS coupon pricer based on the Hagan formula.

pricer = ql.AnalyticHaganPricer(
    swaption_vol, ql.YieldCurveModel.Standard, mean_reversion
)
ql.setCouponPricer(cms_leg, pricer)

NumericHaganPricer

class pyquantlib.NumericHaganPricer

Bases: HaganPricer

Numeric CMS coupon pricer using Hagan integration.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(swaptionVol: QuantLib::Handle<QuantLib::SwaptionVolatilityStructure>, modelOfYieldCurve: YieldCurveModel, meanReversion: QuoteHandle, lowerLimit: SupportsFloat | SupportsIndex = 0.0, upperLimit: SupportsFloat | SupportsIndex = 1.0, precision: SupportsFloat | SupportsIndex = 1e-06, hardUpperLimit: SupportsFloat | SupportsIndex = 1.7976931348623157e+308) -> None

Constructs with explicit handles.

  1. __init__(swaptionVol: QuantLib::SwaptionVolatilityStructure, modelOfYieldCurve: YieldCurveModel, meanReversion: base.Quote, lowerLimit: SupportsFloat | SupportsIndex = 0.0, upperLimit: SupportsFloat | SupportsIndex = 1.0, precision: SupportsFloat | SupportsIndex = 1e-06, hardUpperLimit: SupportsFloat | SupportsIndex = 1.7976931348623157e+308) -> None

Constructs from shared pointers (handles created internally).

lowerLimit() float

Returns the lower integration limit.

stdDeviations() float

Returns the number of standard deviations for upper limit.

upperLimit() float

Returns the upper integration limit.

Numeric CMS coupon pricer using Hagan integration with configurable limits.

pricer = ql.NumericHaganPricer(
    swaption_vol, ql.YieldCurveModel.Standard, mean_reversion,
    lowerLimit=0.0, upperLimit=1.0, precision=1e-6
)

CompoundingOvernightIndexedCouponPricer

class pyquantlib.CompoundingOvernightIndexedCouponPricer

Bases: FloatingRateCouponPricer

Pricer for compounded overnight indexed coupons.

__init__() None

Constructs a compounding overnight pricer.

swapletRate() float

Returns the compounded swaplet rate.

Pricer for compounded overnight indexed coupons.

ArithmeticAveragedOvernightIndexedCouponPricer

class pyquantlib.ArithmeticAveragedOvernightIndexedCouponPricer

Bases: FloatingRateCouponPricer

Pricer for arithmetically averaged overnight indexed coupons.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(meanReversion: SupportsFloat | SupportsIndex = 0.03, volatility: SupportsFloat | SupportsIndex = 0.0, byApprox: bool = False) -> None

Constructs with convexity adjustment parameters.

  1. __init__(byApprox: bool) -> None

Constructs with approximation flag (no convexity adjustment).

swapletRate() float

Returns the averaged swaplet rate.

Pricer for arithmetically averaged overnight indexed coupons with optional convexity adjustment.

# Default (no convexity adjustment)
pricer = ql.ArithmeticAveragedOvernightIndexedCouponPricer()

# With convexity adjustment parameters
pricer = ql.ArithmeticAveragedOvernightIndexedCouponPricer(
    meanReversion=0.03, volatility=0.01, byApprox=False
)

BlackCompoundingOvernightIndexedCouponPricer

class pyquantlib.BlackCompoundingOvernightIndexedCouponPricer

Bases: CompoundingOvernightIndexedCouponPricer

Black pricer for capped/floored compounded overnight coupons.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__() -> None

Constructs without optionlet volatility.

  1. __init__(v: QuantLib::Handle<QuantLib::OptionletVolatilityStructure>, effectiveVolatilityInput: bool = False) -> None

Constructs with optionlet volatility and effective vol flag.

Black pricer for capped/floored compounded overnight coupons.

BlackAveragingOvernightIndexedCouponPricer

class pyquantlib.BlackAveragingOvernightIndexedCouponPricer

Bases: ArithmeticAveragedOvernightIndexedCouponPricer

Black pricer for capped/floored averaged overnight coupons.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__() -> None

Constructs without optionlet volatility.

  1. __init__(v: QuantLib::Handle<QuantLib::OptionletVolatilityStructure>, effectiveVolatilityInput: bool = False) -> None

Constructs with optionlet volatility and effective vol flag.

Black pricer for capped/floored averaged overnight coupons. Requires RateAveraging.Type.Simple.

setCouponPricer

pyquantlib.setCouponPricer(*args, **kwargs)

Overloaded function.

  1. setCouponPricer(leg: collections.abc.Sequence[base.CashFlow], pricer: base.FloatingRateCouponPricer) -> None

Sets the coupon pricer for all floating-rate coupons in the leg.

  1. setCouponPricer(leg: collections.abc.Sequence[base.CashFlow], pricer: base.InflationCouponPricer) -> None

Sets the coupon pricer for all inflation coupons in the leg.

Also accepts inflation coupon pricers for legs containing YoYInflationCoupon cashflows.

Leg Builders

FixedRateLeg

class pyquantlib.FixedRateLeg

Bases: pybind11_object

Helper class for building a leg of fixed-rate coupons.

__init__(schedule: Schedule) None

Constructs a FixedRateLeg from a schedule.

build() list[base.CashFlow]

Builds and returns the leg of cash flows.

withCouponRates(*args, **kwargs)

Overloaded function.

  1. withCouponRates(rate: SupportsFloat | SupportsIndex, dayCounter: DayCounter, compounding: Compounding = <Compounding.Simple: 0>, frequency: Frequency = <Frequency.Annual: 1>) -> FixedRateLeg

  2. withCouponRates(interestRate: InterestRate) -> FixedRateLeg

  3. withCouponRates(rates: collections.abc.Sequence[SupportsFloat | SupportsIndex], dayCounter: DayCounter, compounding: Compounding = <Compounding.Simple: 0>, frequency: Frequency = <Frequency.Annual: 1>) -> FixedRateLeg

  4. withCouponRates(interestRates: collections.abc.Sequence[InterestRate]) -> FixedRateLeg

withExCouponPeriod(period: Period, calendar: Calendar, convention: BusinessDayConvention, endOfMonth: bool = False) FixedRateLeg
withFirstPeriodDayCounter(dayCounter: DayCounter) FixedRateLeg
withLastPeriodDayCounter(dayCounter: DayCounter) FixedRateLeg
withNotionals(*args, **kwargs)

Overloaded function.

  1. withNotionals(nominal: SupportsFloat | SupportsIndex) -> FixedRateLeg

  2. withNotionals(nominals: collections.abc.Sequence[SupportsFloat | SupportsIndex]) -> FixedRateLeg

withPaymentAdjustment(convention: BusinessDayConvention) FixedRateLeg
withPaymentCalendar(calendar: Calendar) FixedRateLeg
withPaymentLag(lag: SupportsInt | SupportsIndex) FixedRateLeg
leg = ql.FixedRateLeg(schedule) \
    .withNotionals(1000000.0) \
    .withCouponRates(0.05, ql.Actual365Fixed()) \
    .build()

for cf in leg:
    print(f"{cf.date()}: {cf.amount():.2f}")

IborLeg

class pyquantlib.IborLeg

Bases: pybind11_object

Helper class for building a leg of Ibor coupons.

__init__(schedule: Schedule, index: QuantLib::IborIndex) None

Constructs an IborLeg from a schedule and index.

build() list[base.CashFlow]

Builds and returns the leg of cash flows.

inArrears(flag: bool = True) IborLeg
withCaps(*args, **kwargs)

Overloaded function.

  1. withCaps(cap: SupportsFloat | SupportsIndex) -> IborLeg

  2. withCaps(caps: collections.abc.Sequence[SupportsFloat | SupportsIndex]) -> IborLeg

withExCouponPeriod(period: Period, calendar: Calendar, convention: BusinessDayConvention, endOfMonth: bool = False) IborLeg
withFixingDays(*args, **kwargs)

Overloaded function.

  1. withFixingDays(fixingDays: SupportsInt | SupportsIndex) -> IborLeg

  2. withFixingDays(fixingDays: collections.abc.Sequence[SupportsInt | SupportsIndex]) -> IborLeg

withFloors(*args, **kwargs)

Overloaded function.

  1. withFloors(floor: SupportsFloat | SupportsIndex) -> IborLeg

  2. withFloors(floors: collections.abc.Sequence[SupportsFloat | SupportsIndex]) -> IborLeg

withGearings(*args, **kwargs)

Overloaded function.

  1. withGearings(gearing: SupportsFloat | SupportsIndex) -> IborLeg

  2. withGearings(gearings: collections.abc.Sequence[SupportsFloat | SupportsIndex]) -> IborLeg

withNotionals(*args, **kwargs)

Overloaded function.

  1. withNotionals(nominal: SupportsFloat | SupportsIndex) -> IborLeg

  2. withNotionals(nominals: collections.abc.Sequence[SupportsFloat | SupportsIndex]) -> IborLeg

withPaymentAdjustment(convention: BusinessDayConvention) IborLeg
withPaymentCalendar(calendar: Calendar) IborLeg
withPaymentDayCounter(dayCounter: DayCounter) IborLeg
withPaymentLag(lag: SupportsInt | SupportsIndex) IborLeg
withSpreads(*args, **kwargs)

Overloaded function.

  1. withSpreads(spread: SupportsFloat | SupportsIndex) -> IborLeg

  2. withSpreads(spreads: collections.abc.Sequence[SupportsFloat | SupportsIndex]) -> IborLeg

withZeroPayments(flag: bool = True) IborLeg
leg = ql.IborLeg(schedule, euribor6m) \
    .withNotionals(1e6) \
    .withSpreads(0.005) \
    .build()

OvernightLeg

class pyquantlib.OvernightLeg

Bases: pybind11_object

Helper class for building a leg of overnight indexed coupons.

__init__(schedule: Schedule, overnightIndex: QuantLib::OvernightIndex) None

Constructs an OvernightLeg from a schedule and overnight index.

build() list[base.CashFlow]

Builds and returns the leg of cash flows.

withAveragingMethod(averagingMethod: RateAveraging.Type) OvernightLeg
withGearings(*args, **kwargs)

Overloaded function.

  1. withGearings(gearing: SupportsFloat | SupportsIndex) -> OvernightLeg

  2. withGearings(gearings: collections.abc.Sequence[SupportsFloat | SupportsIndex]) -> OvernightLeg

withLockoutDays(lockoutDays: SupportsInt | SupportsIndex) OvernightLeg
withLookbackDays(lookbackDays: SupportsInt | SupportsIndex) OvernightLeg
withNotionals(*args, **kwargs)

Overloaded function.

  1. withNotionals(nominal: SupportsFloat | SupportsIndex) -> OvernightLeg

  2. withNotionals(nominals: collections.abc.Sequence[SupportsFloat | SupportsIndex]) -> OvernightLeg

withObservationShift(applyObservationShift: bool = True) OvernightLeg
withPaymentAdjustment(convention: BusinessDayConvention) OvernightLeg
withPaymentCalendar(calendar: Calendar) OvernightLeg
withPaymentDayCounter(dayCounter: DayCounter) OvernightLeg
withPaymentLag(lag: SupportsInt | SupportsIndex) OvernightLeg
withSpreads(*args, **kwargs)

Overloaded function.

  1. withSpreads(spread: SupportsFloat | SupportsIndex) -> OvernightLeg

  2. withSpreads(spreads: collections.abc.Sequence[SupportsFloat | SupportsIndex]) -> OvernightLeg

withTelescopicValueDates(telescopicValueDates: bool) OvernightLeg
leg = ql.OvernightLeg(schedule, overnight_index) \
    .withNotionals(10e6) \
    .withSpreads(0.001) \
    .withAveragingMethod(ql.RateAveraging.Type.Compound) \
    .build()

CmsLeg

class pyquantlib.CmsLeg

Bases: pybind11_object

Helper class for building a leg of CMS coupons.

__init__(schedule: Schedule, swapIndex: QuantLib::SwapIndex) None

Constructs a CmsLeg from a schedule and swap index.

build() list[base.CashFlow]

Builds and returns the leg of cash flows.

inArrears(flag: bool = True) CmsLeg
withCaps(*args, **kwargs)

Overloaded function.

  1. withCaps(cap: SupportsFloat | SupportsIndex) -> CmsLeg

  2. withCaps(caps: collections.abc.Sequence[SupportsFloat | SupportsIndex]) -> CmsLeg

withExCouponPeriod(period: Period, calendar: Calendar, convention: BusinessDayConvention, endOfMonth: bool = False) CmsLeg
withFixingDays(*args, **kwargs)

Overloaded function.

  1. withFixingDays(fixingDays: SupportsInt | SupportsIndex) -> CmsLeg

  2. withFixingDays(fixingDays: collections.abc.Sequence[SupportsInt | SupportsIndex]) -> CmsLeg

withFloors(*args, **kwargs)

Overloaded function.

  1. withFloors(floor: SupportsFloat | SupportsIndex) -> CmsLeg

  2. withFloors(floors: collections.abc.Sequence[SupportsFloat | SupportsIndex]) -> CmsLeg

withGearings(*args, **kwargs)

Overloaded function.

  1. withGearings(gearing: SupportsFloat | SupportsIndex) -> CmsLeg

  2. withGearings(gearings: collections.abc.Sequence[SupportsFloat | SupportsIndex]) -> CmsLeg

withNotionals(*args, **kwargs)

Overloaded function.

  1. withNotionals(nominal: SupportsFloat | SupportsIndex) -> CmsLeg

  2. withNotionals(nominals: collections.abc.Sequence[SupportsFloat | SupportsIndex]) -> CmsLeg

withPaymentAdjustment(convention: BusinessDayConvention) CmsLeg
withPaymentDayCounter(dayCounter: DayCounter) CmsLeg
withSpreads(*args, **kwargs)

Overloaded function.

  1. withSpreads(spread: SupportsFloat | SupportsIndex) -> CmsLeg

  2. withSpreads(spreads: collections.abc.Sequence[SupportsFloat | SupportsIndex]) -> CmsLeg

withZeroPayments(flag: bool = True) CmsLeg
leg = ql.CmsLeg(schedule, swap_index) \
    .withNotionals(1e6) \
    .withSpreads(0.001) \
    .build()

BMA Coupons

AverageBMACoupon

class pyquantlib.AverageBMACoupon

Bases: FloatingRateCoupon

Coupon paying the weighted average of BMA fixings.

__init__(paymentDate: Date, nominal: SupportsFloat | SupportsIndex, startDate: Date, endDate: Date, index: QuantLib::BMAIndex, gearing: SupportsFloat | SupportsIndex = 1.0, spread: SupportsFloat | SupportsIndex = 0.0, refPeriodStart: Date = <Date: null date>, refPeriodEnd: Date = <Date: null date>, dayCounter: object = None) None

Constructs an average BMA coupon.

fixingDates() list[Date]

Returns the fixing dates to be averaged.

indexFixings() list[float]

Returns the index fixings to be averaged.

Coupon paying the weighted average of BMA fixings.

AverageBMALeg

class pyquantlib.AverageBMALeg

Bases: pybind11_object

Builder for a sequence of average BMA coupons.

__init__(schedule: Schedule, index: QuantLib::BMAIndex) None

Constructs an AverageBMALeg builder.

leg() list[base.CashFlow]

Builds and returns the leg.

withGearings(*args, **kwargs)

Overloaded function.

  1. withGearings(gearing: SupportsFloat | SupportsIndex) -> AverageBMALeg

Sets a single gearing.

  1. withGearings(gearings: collections.abc.Sequence[SupportsFloat | SupportsIndex]) -> AverageBMALeg

Sets gearing schedule.

withNotionals(*args, **kwargs)

Overloaded function.

  1. withNotionals(notional: SupportsFloat | SupportsIndex) -> AverageBMALeg

Sets a single notional.

  1. withNotionals(notionals: collections.abc.Sequence[SupportsFloat | SupportsIndex]) -> AverageBMALeg

Sets notional schedule.

withPaymentAdjustment(convention: BusinessDayConvention) AverageBMALeg

Sets payment business day convention.

withPaymentDayCounter(dayCounter: DayCounter) AverageBMALeg

Sets payment day counter.

withSpreads(*args, **kwargs)

Overloaded function.

  1. withSpreads(spread: SupportsFloat | SupportsIndex) -> AverageBMALeg

Sets a single spread.

  1. withSpreads(spreads: collections.abc.Sequence[SupportsFloat | SupportsIndex]) -> AverageBMALeg

Sets spread schedule.

Builder for a sequence of average BMA coupons.

bma = ql.BMAIndex(curve)
leg = ql.AverageBMALeg(schedule, bma) \
    .withNotionals(1e6) \
    .leg()

Settings

IborCouponSettings

class pyquantlib.IborCouponSettings

Bases: pybind11_object

Per-session settings for IborCoupon class.

static instance() IborCouponSettings

Returns the singleton instance.

__init__(*args, **kwargs)
createAtParCoupons() None

Switches to par coupon creation.

createIndexedCoupons() None

Switches to indexed coupon creation.

usingAtParCoupons() bool

Returns whether par coupons are being used.

Controls whether IborCoupons are created as par or indexed coupons.

settings = ql.IborCouponSettings.instance()
settings.createAtParCoupons()    # default
settings.createIndexedCoupons()  # alternative

Inflation Coupons

InflationCoupon

class pyquantlib.base.InflationCoupon

Bases: Coupon

Abstract base class for inflation coupons.

__init__(*args, **kwargs)
accruedAmount(date: Date) float

Returns the accrued amount at the given date.

amount() float

Returns the coupon amount.

dayCounter() DayCounter

Returns the day counter.

fixingDate() Date

Returns the fixing date.

fixingDays() int

Returns the number of fixing days.

index() QuantLib::InflationIndex

Returns the inflation index.

indexFixing() float

Returns the index fixing.

observationLag() Period

Returns the observation lag.

price(discountingCurve: QuantLib::Handle<QuantLib::YieldTermStructure>) float

Returns the present value given a discounting curve.

pricer() QuantLib::InflationCouponPricer

Returns the inflation coupon pricer.

rate() float

Returns the coupon rate.

setPricer(pricer: QuantLib::InflationCouponPricer) None

Sets the inflation coupon pricer.

Abstract base class for coupons linked to an inflation index.

ZeroInflationCashFlow

class pyquantlib.ZeroInflationCashFlow

Bases: CashFlow

Cash flow dependent on a zero-inflation index ratio.

__init__(notional: SupportsFloat | SupportsIndex, index: QuantLib::ZeroInflationIndex, observationInterpolation: QuantLib::CPI::InterpolationType, startDate: Date, endDate: Date, observationLag: Period, paymentDate: Date, growthOnly: bool = False) None

Constructs a zero-inflation cash flow.

baseDate() Date

Returns the base date.

baseFixing() float

Returns the base fixing.

fixingDate() Date

Returns the fixing date.

growthOnly() bool

Returns whether only growth is paid.

indexFixing() float

Returns the index fixing.

notional() float

Returns the notional.

observationInterpolation() QuantLib::CPI::InterpolationType

Returns the observation interpolation type.

zeroInflationIndex() QuantLib::ZeroInflationIndex

Returns the zero-inflation index.

Cash flow paying the zero-inflation rate between two dates.

YoYInflationCoupon

class pyquantlib.YoYInflationCoupon

Bases: InflationCoupon

Year-on-year inflation coupon.

__init__(paymentDate: Date, nominal: SupportsFloat | SupportsIndex, startDate: Date, endDate: Date, fixingDays: SupportsInt | SupportsIndex, index: QuantLib::YoYInflationIndex, observationLag: Period, interpolation: QuantLib::CPI::InterpolationType, dayCounter: DayCounter, gearing: SupportsFloat | SupportsIndex = 1.0, spread: SupportsFloat | SupportsIndex = 0.0, refPeriodStart: Date = <Date: null date>, refPeriodEnd: Date = <Date: null date>) None

Constructs a YoY inflation coupon.

adjustedFixing() float

Returns the adjusted fixing.

gearing() float

Returns the gearing.

interpolation() QuantLib::CPI::InterpolationType

Returns the interpolation type.

spread() float

Returns the spread.

yoyIndex() QuantLib::YoYInflationIndex

Returns the YoY inflation index.

Coupon paying the year-on-year inflation rate.

CappedFlooredYoYInflationCoupon

class pyquantlib.CappedFlooredYoYInflationCoupon

Bases: YoYInflationCoupon

Capped and/or floored YoY inflation coupon.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(underlying: YoYInflationCoupon, cap: object = None, floor: object = None) -> None

Constructs from an underlying YoY inflation coupon.

  1. __init__(paymentDate: Date, nominal: SupportsFloat | SupportsIndex, startDate: Date, endDate: Date, fixingDays: SupportsInt | SupportsIndex, index: QuantLib::YoYInflationIndex, observationLag: Period, interpolation: QuantLib::CPI::InterpolationType, dayCounter: DayCounter, gearing: SupportsFloat | SupportsIndex = 1.0, spread: SupportsFloat | SupportsIndex = 0.0, cap: object = None, floor: object = None, refPeriodStart: Date = <Date: null date>, refPeriodEnd: Date = <Date: null date>) -> None

Constructs a capped/floored YoY inflation coupon.

cap() float

Returns the cap rate.

effectiveCap() float

Returns the effective cap of the fixing.

effectiveFloor() float

Returns the effective floor of the fixing.

floor() float

Returns the floor rate.

isCapped() bool

Returns True if the coupon is capped.

isFloored() bool

Returns True if the coupon is floored.

Year-on-year inflation coupon with cap and/or floor.

yoyInflationLeg

class pyquantlib.yoyInflationLeg

Bases: pybind11_object

Builder for year-on-year inflation legs.

__init__(schedule: Schedule, calendar: Calendar, index: QuantLib::YoYInflationIndex, observationLag: Period, interpolation: QuantLib::CPI::InterpolationType) None

Constructs a yoyInflationLeg builder.

build() list[base.CashFlow]

Builds and returns the leg of cash flows.

withCaps(*args, **kwargs)

Overloaded function.

  1. withCaps(cap: SupportsFloat | SupportsIndex) -> yoyInflationLeg

  2. withCaps(caps: collections.abc.Sequence[SupportsFloat | SupportsIndex]) -> yoyInflationLeg

withFixingDays(*args, **kwargs)

Overloaded function.

  1. withFixingDays(fixingDays: SupportsInt | SupportsIndex) -> yoyInflationLeg

  2. withFixingDays(fixingDays: collections.abc.Sequence[SupportsInt | SupportsIndex]) -> yoyInflationLeg

withFloors(*args, **kwargs)

Overloaded function.

  1. withFloors(floor: SupportsFloat | SupportsIndex) -> yoyInflationLeg

  2. withFloors(floors: collections.abc.Sequence[SupportsFloat | SupportsIndex]) -> yoyInflationLeg

withGearings(*args, **kwargs)

Overloaded function.

  1. withGearings(gearing: SupportsFloat | SupportsIndex) -> yoyInflationLeg

  2. withGearings(gearings: collections.abc.Sequence[SupportsFloat | SupportsIndex]) -> yoyInflationLeg

withNotionals(*args, **kwargs)

Overloaded function.

  1. withNotionals(nominal: SupportsFloat | SupportsIndex) -> yoyInflationLeg

  2. withNotionals(nominals: collections.abc.Sequence[SupportsFloat | SupportsIndex]) -> yoyInflationLeg

withPaymentAdjustment(convention: BusinessDayConvention) yoyInflationLeg
withPaymentDayCounter(dayCounter: DayCounter) yoyInflationLeg
withSpreads(*args, **kwargs)

Overloaded function.

  1. withSpreads(spread: SupportsFloat | SupportsIndex) -> yoyInflationLeg

  2. withSpreads(spreads: collections.abc.Sequence[SupportsFloat | SupportsIndex]) -> yoyInflationLeg

Builder class for constructing a leg of year-on-year inflation coupons.

leg = ql.yoyInflationLeg(schedule, calendar, yoy_index, observation_lag) \
    .withNotionals(1_000_000.0) \
    .withPaymentDayCounter(ql.Actual365Fixed()) \
    .build()

Inflation Coupon Pricers

InflationCouponPricer

class pyquantlib.base.InflationCouponPricer

Bases: Observer, Observable

Abstract base class for inflation coupon pricers.

__init__(*args, **kwargs)

Abstract base class for inflation coupon pricers.

YoYInflationCouponPricer

class pyquantlib.YoYInflationCouponPricer

Bases: InflationCouponPricer

Base pricer for YoY inflation coupons.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__() -> None

Constructs with no vol or nominal curve.

  1. __init__(nominalTermStructure: QuantLib::Handle<QuantLib::YieldTermStructure>) -> None

Constructs with a nominal term structure.

  1. __init__(capletVol: QuantLib::Handle<QuantLib::YoYOptionletVolatilitySurface>, nominalTermStructure: QuantLib::Handle<QuantLib::YieldTermStructure>) -> None

Constructs with caplet vol and nominal term structure.

  1. __init__(nominalTermStructure: QuantLib::YieldTermStructure) -> None

Constructs with a nominal term structure (handle created internally).

capletVolatility() QuantLib::Handle<QuantLib::YoYOptionletVolatilitySurface>

Returns the caplet volatility handle.

nominalTermStructure() QuantLib::Handle<QuantLib::YieldTermStructure>

Returns the nominal term structure handle.

setCapletVolatility(capletVol: QuantLib::Handle<QuantLib::YoYOptionletVolatilitySurface>) None

Sets the caplet volatility handle.

Base pricer for year-on-year inflation coupons.

BlackYoYInflationCouponPricer

class pyquantlib.BlackYoYInflationCouponPricer

Bases: YoYInflationCouponPricer

Black-formula pricer for YoY inflation coupons.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__() -> None

Constructs with no vol or nominal curve.

  1. __init__(nominalTermStructure: QuantLib::Handle<QuantLib::YieldTermStructure>) -> None

Constructs with a nominal term structure.

  1. __init__(capletVol: QuantLib::Handle<QuantLib::YoYOptionletVolatilitySurface>, nominalTermStructure: QuantLib::Handle<QuantLib::YieldTermStructure>) -> None

Constructs with caplet vol and nominal term structure.

Black-formula pricer for YoY inflation coupons (lognormal volatility).

UnitDisplacedBlackYoYInflationCouponPricer

class pyquantlib.UnitDisplacedBlackYoYInflationCouponPricer

Bases: YoYInflationCouponPricer

Unit-displaced Black pricer for YoY inflation coupons.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__() -> None

Constructs with no vol or nominal curve.

  1. __init__(nominalTermStructure: QuantLib::Handle<QuantLib::YieldTermStructure>) -> None

Constructs with a nominal term structure.

  1. __init__(capletVol: QuantLib::Handle<QuantLib::YoYOptionletVolatilitySurface>, nominalTermStructure: QuantLib::Handle<QuantLib::YieldTermStructure>) -> None

Constructs with caplet vol and nominal term structure.

Unit-displaced Black-formula pricer for YoY inflation coupons.

BachelierYoYInflationCouponPricer

class pyquantlib.BachelierYoYInflationCouponPricer

Bases: YoYInflationCouponPricer

Bachelier (normal) pricer for YoY inflation coupons.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__() -> None

Constructs with no vol or nominal curve.

  1. __init__(nominalTermStructure: QuantLib::Handle<QuantLib::YieldTermStructure>) -> None

Constructs with a nominal term structure.

  1. __init__(capletVol: QuantLib::Handle<QuantLib::YoYOptionletVolatilitySurface>, nominalTermStructure: QuantLib::Handle<QuantLib::YieldTermStructure>) -> None

Constructs with caplet vol and nominal term structure.

Bachelier (normal volatility) pricer for YoY inflation coupons.

pricer = ql.BlackYoYInflationCouponPricer(yoy_vol_handle)
ql.setCouponPricer(yoy_leg, pricer)

Dividends

FixedDividend

class pyquantlib.FixedDividend

Bases: Dividend

Fixed cash dividend.

__init__(amount: SupportsFloat | SupportsIndex, date: Date) None

Constructs a fixed dividend.

amount() float

Returns the dividend amount.

Fixed cash dividend.

div = ql.FixedDividend(2.50, ql.Date(15, 6, 2026))
print(div.amount())  # 2.5
print(div.date())    # June 15th, 2026

FractionalDividend

class pyquantlib.FractionalDividend

Bases: Dividend

Fractional (proportional) dividend.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(rate: SupportsFloat | SupportsIndex, date: Date) -> None

Constructs a fractional dividend (rate only).

  1. __init__(rate: SupportsFloat | SupportsIndex, nominal: SupportsFloat | SupportsIndex, date: Date) -> None

Constructs a fractional dividend with nominal.

nominal() float

Returns the nominal value.

rate() float

Returns the dividend rate.

Fractional (proportional) dividend: amount = rate * nominal.

div = ql.FractionalDividend(0.03, 100.0, ql.Date(15, 6, 2026))
print(div.rate())     # 0.03
print(div.nominal())  # 100.0

DividendVector

pyquantlib.DividendVector(dividendDates: collections.abc.Sequence[Date], dividends: collections.abc.Sequence[SupportsFloat | SupportsIndex]) list[base.Dividend]

Builds a sequence of fixed dividends from dates and amounts.

Builds a sequence of fixed dividends from dates and amounts.

divs = ql.DividendVector(
    [ql.Date(15, 6, 2026), ql.Date(15, 12, 2026)],
    [2.50, 2.50],
)

Duration

DurationType

class pyquantlib.DurationType

Bases: pybind11_object

Duration calculation type.

Members:

Simple : Simple duration.

Macaulay : Macaulay duration.

Modified : Modified duration.

__init__(value: SupportsInt | SupportsIndex) None
Macaulay = <DurationType.Macaulay: 1>
Modified = <DurationType.Modified: 2>
Simple = <DurationType.Simple: 0>
DurationType.name -> str
property value

Value

Description

Simple

Simple duration

Macaulay

Macaulay duration

Modified

Modified duration

Note

Abstract base classes CashFlow, Coupon, FloatingRateCouponPricer, MeanRevertingPricer, CmsCouponPricer, HaganPricer, InflationCoupon, and InflationCouponPricer are available in pyquantlib.base for isinstance checks and custom implementations.