Cash Flows Module¶
Cash Flows¶
SimpleCashFlow¶
- class pyquantlib.SimpleCashFlow¶
Bases:
CashFlowSimple 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:
SimpleCashFlowBond redemption payment.
- __init__(amount: SupportsFloat | SupportsIndex, date: Date) None¶
Constructs a redemption with the given amount and date.
AmortizingPayment¶
- class pyquantlib.AmortizingPayment¶
Bases:
SimpleCashFlowAmortizing 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:
CouponCoupon paying a fixed interest rate.
- __init__(*args, **kwargs)¶
Overloaded function.
__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.
__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:
CouponCoupon 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.
- index() QuantLib::InterestRateIndex¶
Returns the floating index.
- pricer() base.FloatingRateCouponPricer¶
Returns the coupon pricer.
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:
FloatingRateCouponCoupon 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.
- iborIndex() QuantLib::IborIndex¶
Returns the Ibor index.
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:
FloatingRateCouponCoupon 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.
- averagingMethod() RateAveraging.Type¶
Returns the averaging method.
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:
FloatingRateCouponCoupon 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:
FloatingRateCouponCapped 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.
- 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:
CappedFlooredCouponCapped/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:
CappedFlooredCouponCapped/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:
FloatingRateCouponFloating-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.
- 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:
DigitalCouponIbor 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:
DigitalCouponCMS 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_objectHelper class for building a leg of digital Ibor coupons.
- __init__(schedule: Schedule, index: QuantLib::IborIndex) None¶
Constructs from a schedule and Ibor index.
- inArrears(flag: bool = True) DigitalIborLeg¶
- withCallATM(flag: bool = True) DigitalIborLeg¶
- withCallPayoffs(*args, **kwargs)¶
Overloaded function.
withCallPayoffs(payoff: SupportsFloat | SupportsIndex) -> DigitalIborLeg
withCallPayoffs(payoffs: collections.abc.Sequence[SupportsFloat | SupportsIndex]) -> DigitalIborLeg
- withCallStrikes(*args, **kwargs)¶
Overloaded function.
withCallStrikes(strike: SupportsFloat | SupportsIndex) -> DigitalIborLeg
withCallStrikes(strikes: collections.abc.Sequence[SupportsFloat | SupportsIndex]) -> DigitalIborLeg
- withFixingDays(*args, **kwargs)¶
Overloaded function.
withFixingDays(fixingDays: SupportsInt | SupportsIndex) -> DigitalIborLeg
withFixingDays(fixingDays: collections.abc.Sequence[SupportsInt | SupportsIndex]) -> DigitalIborLeg
- withGearings(*args, **kwargs)¶
Overloaded function.
withGearings(gearing: SupportsFloat | SupportsIndex) -> DigitalIborLeg
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.
withNotionals(nominal: SupportsFloat | SupportsIndex) -> DigitalIborLeg
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.
withPutPayoffs(payoff: SupportsFloat | SupportsIndex) -> DigitalIborLeg
withPutPayoffs(payoffs: collections.abc.Sequence[SupportsFloat | SupportsIndex]) -> DigitalIborLeg
- withPutStrikes(*args, **kwargs)¶
Overloaded function.
withPutStrikes(strike: SupportsFloat | SupportsIndex) -> DigitalIborLeg
withPutStrikes(strikes: collections.abc.Sequence[SupportsFloat | SupportsIndex]) -> DigitalIborLeg
- withReplication(replication: DigitalReplication) DigitalIborLeg¶
- withSpreads(*args, **kwargs)¶
Overloaded function.
withSpreads(spread: SupportsFloat | SupportsIndex) -> DigitalIborLeg
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_objectHelper class for building a leg of digital CMS coupons.
- __init__(schedule: Schedule, index: QuantLib::SwapIndex) None¶
Constructs from a schedule and swap index.
- inArrears(flag: bool = True) DigitalCmsLeg¶
- withCallATM(flag: bool = True) DigitalCmsLeg¶
- withCallPayoffs(*args, **kwargs)¶
Overloaded function.
withCallPayoffs(payoff: SupportsFloat | SupportsIndex) -> DigitalCmsLeg
withCallPayoffs(payoffs: collections.abc.Sequence[SupportsFloat | SupportsIndex]) -> DigitalCmsLeg
- withCallStrikes(*args, **kwargs)¶
Overloaded function.
withCallStrikes(strike: SupportsFloat | SupportsIndex) -> DigitalCmsLeg
withCallStrikes(strikes: collections.abc.Sequence[SupportsFloat | SupportsIndex]) -> DigitalCmsLeg
- withFixingDays(*args, **kwargs)¶
Overloaded function.
withFixingDays(fixingDays: SupportsInt | SupportsIndex) -> DigitalCmsLeg
withFixingDays(fixingDays: collections.abc.Sequence[SupportsInt | SupportsIndex]) -> DigitalCmsLeg
- withGearings(*args, **kwargs)¶
Overloaded function.
withGearings(gearing: SupportsFloat | SupportsIndex) -> DigitalCmsLeg
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.
withNotionals(nominal: SupportsFloat | SupportsIndex) -> DigitalCmsLeg
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.
withPutPayoffs(payoff: SupportsFloat | SupportsIndex) -> DigitalCmsLeg
withPutPayoffs(payoffs: collections.abc.Sequence[SupportsFloat | SupportsIndex]) -> DigitalCmsLeg
- withPutStrikes(*args, **kwargs)¶
Overloaded function.
withPutStrikes(strike: SupportsFloat | SupportsIndex) -> DigitalCmsLeg
withPutStrikes(strikes: collections.abc.Sequence[SupportsFloat | SupportsIndex]) -> DigitalCmsLeg
- withReplication(replication: DigitalReplication) DigitalCmsLeg¶
- withSpreads(*args, **kwargs)¶
Overloaded function.
withSpreads(spread: SupportsFloat | SupportsIndex) -> DigitalCmsLeg
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_objectDigital 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-replication (lower bound) |
|
Central replication |
|
Super-replication (upper bound) |
DigitalReplication¶
- class pyquantlib.DigitalReplication¶
Bases:
pybind11_objectDigital option replication configuration.
- __init__(replicationType: ReplicationType = <ReplicationType.Central: 1>, gap: SupportsFloat | SupportsIndex = 0.0001) None¶
Constructs with replication type and gap.
- 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:
FloatingRateCouponPricerBlack-formula pricer for capped/floored Ibor coupons.
- __init__(*args, **kwargs)¶
Overloaded function.
__init__() -> None
Constructs with no optionlet volatility.
__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,MeanRevertingPricerCMS coupon pricer using linear terminal swap rate model.
- __init__(*args, **kwargs)¶
Overloaded function.
__init__(swaptionVol: QuantLib::Handle<QuantLib::SwaptionVolatilityStructure>, meanReversion: QuoteHandle, couponDiscountCurve: object = None, settings: LinearTsrPricerSettings = <LinearTsrPricerSettings object at 0x7f252f3fa170>) -> None
Constructs with explicit handles.
__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.
- setMeanReversion(meanReversion: QuoteHandle) None¶
Sets the mean reversion handle.
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_objectSettings for LinearTsrPricer integration bounds.
- withBSStdDevs(*args, **kwargs)¶
Overloaded function.
withBSStdDevs(stdDevs: SupportsFloat | SupportsIndex = 3.0) -> LinearTsrPricerSettings
Sets Black-Scholes std devs strategy with default bounds.
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.
withPriceThreshold(priceThreshold: SupportsFloat | SupportsIndex = 1e-08) -> LinearTsrPricerSettings
Sets price threshold strategy with default bounds.
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.
withVegaRatio(vegaRatio: SupportsFloat | SupportsIndex = 0.01) -> LinearTsrPricerSettings
Sets vega ratio strategy with default bounds.
withVegaRatio(vegaRatio: SupportsFloat | SupportsIndex, lowerRateBound: SupportsFloat | SupportsIndex, upperRateBound: SupportsFloat | SupportsIndex) -> LinearTsrPricerSettings
Sets vega ratio strategy with explicit bounds.
LinearTsrPricerStrategy¶
- class pyquantlib.LinearTsrPricerStrategy¶
Bases:
pybind11_objectIntegration 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_objectYield 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 yield curve model |
|
Exact yield model |
|
Parallel shifts model |
|
Non-parallel shifts model |
HaganPricer¶
- class pyquantlib.HaganPricer¶
Bases:
CmsCouponPricer,MeanRevertingPricerCMS 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.
- setMeanReversion(meanReversion: QuoteHandle) None¶
Sets the mean reversion handle.
Abstract base class for Hagan-style CMS coupon pricers using static replication. Inherits from both CmsCouponPricer and MeanRevertingPricer.
AnalyticHaganPricer¶
- class pyquantlib.AnalyticHaganPricer¶
Bases:
HaganPricerAnalytic CMS coupon pricer using Hagan formula.
- __init__(*args, **kwargs)¶
Overloaded function.
__init__(swaptionVol: QuantLib::Handle<QuantLib::SwaptionVolatilityStructure>, modelOfYieldCurve: YieldCurveModel, meanReversion: QuoteHandle) -> None
Constructs with explicit handles.
__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:
HaganPricerNumeric CMS coupon pricer using Hagan integration.
- __init__(*args, **kwargs)¶
Overloaded function.
__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.
__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).
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:
FloatingRateCouponPricerPricer for compounded overnight indexed coupons.
Pricer for compounded overnight indexed coupons.
ArithmeticAveragedOvernightIndexedCouponPricer¶
- class pyquantlib.ArithmeticAveragedOvernightIndexedCouponPricer¶
Bases:
FloatingRateCouponPricerPricer for arithmetically averaged overnight indexed coupons.
- __init__(*args, **kwargs)¶
Overloaded function.
__init__(meanReversion: SupportsFloat | SupportsIndex = 0.03, volatility: SupportsFloat | SupportsIndex = 0.0, byApprox: bool = False) -> None
Constructs with convexity adjustment parameters.
__init__(byApprox: bool) -> None
Constructs with approximation flag (no convexity adjustment).
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:
CompoundingOvernightIndexedCouponPricerBlack pricer for capped/floored compounded overnight coupons.
- __init__(*args, **kwargs)¶
Overloaded function.
__init__() -> None
Constructs without optionlet volatility.
__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:
ArithmeticAveragedOvernightIndexedCouponPricerBlack pricer for capped/floored averaged overnight coupons.
- __init__(*args, **kwargs)¶
Overloaded function.
__init__() -> None
Constructs without optionlet volatility.
__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.
setCouponPricer(leg: collections.abc.Sequence[base.CashFlow], pricer: base.FloatingRateCouponPricer) -> None
Sets the coupon pricer for all floating-rate coupons in the leg.
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_objectHelper class for building a leg of fixed-rate coupons.
- withCouponRates(*args, **kwargs)¶
Overloaded function.
withCouponRates(rate: SupportsFloat | SupportsIndex, dayCounter: DayCounter, compounding: Compounding = <Compounding.Simple: 0>, frequency: Frequency = <Frequency.Annual: 1>) -> FixedRateLeg
withCouponRates(interestRate: InterestRate) -> FixedRateLeg
withCouponRates(rates: collections.abc.Sequence[SupportsFloat | SupportsIndex], dayCounter: DayCounter, compounding: Compounding = <Compounding.Simple: 0>, frequency: Frequency = <Frequency.Annual: 1>) -> FixedRateLeg
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.
withNotionals(nominal: SupportsFloat | SupportsIndex) -> FixedRateLeg
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_objectHelper class for building a leg of Ibor coupons.
- __init__(schedule: Schedule, index: QuantLib::IborIndex) None¶
Constructs an IborLeg from a schedule and index.
- withCaps(*args, **kwargs)¶
Overloaded function.
withCaps(cap: SupportsFloat | SupportsIndex) -> IborLeg
withCaps(caps: collections.abc.Sequence[SupportsFloat | SupportsIndex]) -> IborLeg
- withExCouponPeriod(period: Period, calendar: Calendar, convention: BusinessDayConvention, endOfMonth: bool = False) IborLeg¶
- withFixingDays(*args, **kwargs)¶
Overloaded function.
withFixingDays(fixingDays: SupportsInt | SupportsIndex) -> IborLeg
withFixingDays(fixingDays: collections.abc.Sequence[SupportsInt | SupportsIndex]) -> IborLeg
- withFloors(*args, **kwargs)¶
Overloaded function.
withFloors(floor: SupportsFloat | SupportsIndex) -> IborLeg
withFloors(floors: collections.abc.Sequence[SupportsFloat | SupportsIndex]) -> IborLeg
- withGearings(*args, **kwargs)¶
Overloaded function.
withGearings(gearing: SupportsFloat | SupportsIndex) -> IborLeg
withGearings(gearings: collections.abc.Sequence[SupportsFloat | SupportsIndex]) -> IborLeg
- withNotionals(*args, **kwargs)¶
Overloaded function.
withNotionals(nominal: SupportsFloat | SupportsIndex) -> IborLeg
withNotionals(nominals: collections.abc.Sequence[SupportsFloat | SupportsIndex]) -> IborLeg
- withPaymentAdjustment(convention: BusinessDayConvention) IborLeg¶
- withPaymentDayCounter(dayCounter: DayCounter) IborLeg¶
- withPaymentLag(lag: SupportsInt | SupportsIndex) IborLeg¶
- withSpreads(*args, **kwargs)¶
Overloaded function.
withSpreads(spread: SupportsFloat | SupportsIndex) -> IborLeg
withSpreads(spreads: collections.abc.Sequence[SupportsFloat | SupportsIndex]) -> IborLeg
leg = ql.IborLeg(schedule, euribor6m) \
.withNotionals(1e6) \
.withSpreads(0.005) \
.build()
OvernightLeg¶
- class pyquantlib.OvernightLeg¶
Bases:
pybind11_objectHelper 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.
- withAveragingMethod(averagingMethod: RateAveraging.Type) OvernightLeg¶
- withGearings(*args, **kwargs)¶
Overloaded function.
withGearings(gearing: SupportsFloat | SupportsIndex) -> OvernightLeg
withGearings(gearings: collections.abc.Sequence[SupportsFloat | SupportsIndex]) -> OvernightLeg
- withLockoutDays(lockoutDays: SupportsInt | SupportsIndex) OvernightLeg¶
- withLookbackDays(lookbackDays: SupportsInt | SupportsIndex) OvernightLeg¶
- withNotionals(*args, **kwargs)¶
Overloaded function.
withNotionals(nominal: SupportsFloat | SupportsIndex) -> OvernightLeg
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.
withSpreads(spread: SupportsFloat | SupportsIndex) -> OvernightLeg
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_objectHelper class for building a leg of CMS coupons.
- __init__(schedule: Schedule, swapIndex: QuantLib::SwapIndex) None¶
Constructs a CmsLeg from a schedule and swap index.
- withCaps(*args, **kwargs)¶
Overloaded function.
withCaps(cap: SupportsFloat | SupportsIndex) -> CmsLeg
withCaps(caps: collections.abc.Sequence[SupportsFloat | SupportsIndex]) -> CmsLeg
- withExCouponPeriod(period: Period, calendar: Calendar, convention: BusinessDayConvention, endOfMonth: bool = False) CmsLeg¶
- withFixingDays(*args, **kwargs)¶
Overloaded function.
withFixingDays(fixingDays: SupportsInt | SupportsIndex) -> CmsLeg
withFixingDays(fixingDays: collections.abc.Sequence[SupportsInt | SupportsIndex]) -> CmsLeg
- withFloors(*args, **kwargs)¶
Overloaded function.
withFloors(floor: SupportsFloat | SupportsIndex) -> CmsLeg
withFloors(floors: collections.abc.Sequence[SupportsFloat | SupportsIndex]) -> CmsLeg
- withGearings(*args, **kwargs)¶
Overloaded function.
withGearings(gearing: SupportsFloat | SupportsIndex) -> CmsLeg
withGearings(gearings: collections.abc.Sequence[SupportsFloat | SupportsIndex]) -> CmsLeg
- withNotionals(*args, **kwargs)¶
Overloaded function.
withNotionals(nominal: SupportsFloat | SupportsIndex) -> CmsLeg
withNotionals(nominals: collections.abc.Sequence[SupportsFloat | SupportsIndex]) -> CmsLeg
- withPaymentAdjustment(convention: BusinessDayConvention) CmsLeg¶
- withPaymentDayCounter(dayCounter: DayCounter) CmsLeg¶
- withSpreads(*args, **kwargs)¶
Overloaded function.
withSpreads(spread: SupportsFloat | SupportsIndex) -> CmsLeg
withSpreads(spreads: collections.abc.Sequence[SupportsFloat | SupportsIndex]) -> CmsLeg
leg = ql.CmsLeg(schedule, swap_index) \
.withNotionals(1e6) \
.withSpreads(0.001) \
.build()
BMA Coupons¶
AverageBMACoupon¶
- class pyquantlib.AverageBMACoupon¶
Bases:
FloatingRateCouponCoupon 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.
Coupon paying the weighted average of BMA fixings.
AverageBMALeg¶
- class pyquantlib.AverageBMALeg¶
Bases:
pybind11_objectBuilder for a sequence of average BMA coupons.
- withGearings(*args, **kwargs)¶
Overloaded function.
withGearings(gearing: SupportsFloat | SupportsIndex) -> AverageBMALeg
Sets a single gearing.
withGearings(gearings: collections.abc.Sequence[SupportsFloat | SupportsIndex]) -> AverageBMALeg
Sets gearing schedule.
- withNotionals(*args, **kwargs)¶
Overloaded function.
withNotionals(notional: SupportsFloat | SupportsIndex) -> AverageBMALeg
Sets a single notional.
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.
withSpreads(spread: SupportsFloat | SupportsIndex) -> AverageBMALeg
Sets a single spread.
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_objectPer-session settings for IborCoupon class.
- static instance() IborCouponSettings¶
Returns the singleton instance.
- __init__(*args, **kwargs)¶
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:
CouponAbstract base class for inflation coupons.
- __init__(*args, **kwargs)¶
- dayCounter() DayCounter¶
Returns the day counter.
- index() QuantLib::InflationIndex¶
Returns the inflation index.
- price(discountingCurve: QuantLib::Handle<QuantLib::YieldTermStructure>) float¶
Returns the present value given a discounting curve.
- pricer() QuantLib::InflationCouponPricer¶
Returns the inflation coupon pricer.
Abstract base class for coupons linked to an inflation index.
ZeroInflationCashFlow¶
- class pyquantlib.ZeroInflationCashFlow¶
Bases:
CashFlowCash 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.
- 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:
InflationCouponYear-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.
- interpolation() QuantLib::CPI::InterpolationType¶
Returns the interpolation type.
- yoyIndex() QuantLib::YoYInflationIndex¶
Returns the YoY inflation index.
Coupon paying the year-on-year inflation rate.
CappedFlooredYoYInflationCoupon¶
- class pyquantlib.CappedFlooredYoYInflationCoupon¶
Bases:
YoYInflationCouponCapped and/or floored YoY inflation coupon.
- __init__(*args, **kwargs)¶
Overloaded function.
__init__(underlying: YoYInflationCoupon, cap: object = None, floor: object = None) -> None
Constructs from an underlying YoY 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, cap: object = None, floor: object = None, refPeriodStart: Date = <Date: null date>, refPeriodEnd: Date = <Date: null date>) -> None
Constructs a capped/floored YoY inflation coupon.
Year-on-year inflation coupon with cap and/or floor.
yoyInflationLeg¶
- class pyquantlib.yoyInflationLeg¶
Bases:
pybind11_objectBuilder 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.
- withCaps(*args, **kwargs)¶
Overloaded function.
withCaps(cap: SupportsFloat | SupportsIndex) -> yoyInflationLeg
withCaps(caps: collections.abc.Sequence[SupportsFloat | SupportsIndex]) -> yoyInflationLeg
- withFixingDays(*args, **kwargs)¶
Overloaded function.
withFixingDays(fixingDays: SupportsInt | SupportsIndex) -> yoyInflationLeg
withFixingDays(fixingDays: collections.abc.Sequence[SupportsInt | SupportsIndex]) -> yoyInflationLeg
- withFloors(*args, **kwargs)¶
Overloaded function.
withFloors(floor: SupportsFloat | SupportsIndex) -> yoyInflationLeg
withFloors(floors: collections.abc.Sequence[SupportsFloat | SupportsIndex]) -> yoyInflationLeg
- withGearings(*args, **kwargs)¶
Overloaded function.
withGearings(gearing: SupportsFloat | SupportsIndex) -> yoyInflationLeg
withGearings(gearings: collections.abc.Sequence[SupportsFloat | SupportsIndex]) -> yoyInflationLeg
- withNotionals(*args, **kwargs)¶
Overloaded function.
withNotionals(nominal: SupportsFloat | SupportsIndex) -> yoyInflationLeg
withNotionals(nominals: collections.abc.Sequence[SupportsFloat | SupportsIndex]) -> yoyInflationLeg
- withPaymentAdjustment(convention: BusinessDayConvention) yoyInflationLeg¶
- withPaymentDayCounter(dayCounter: DayCounter) yoyInflationLeg¶
- withSpreads(*args, **kwargs)¶
Overloaded function.
withSpreads(spread: SupportsFloat | SupportsIndex) -> yoyInflationLeg
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,ObservableAbstract base class for inflation coupon pricers.
- __init__(*args, **kwargs)¶
Abstract base class for inflation coupon pricers.
YoYInflationCouponPricer¶
- class pyquantlib.YoYInflationCouponPricer¶
Bases:
InflationCouponPricerBase pricer for YoY inflation coupons.
- __init__(*args, **kwargs)¶
Overloaded function.
__init__() -> None
Constructs with no vol or nominal curve.
__init__(nominalTermStructure: QuantLib::Handle<QuantLib::YieldTermStructure>) -> None
Constructs with a nominal term structure.
__init__(capletVol: QuantLib::Handle<QuantLib::YoYOptionletVolatilitySurface>, nominalTermStructure: QuantLib::Handle<QuantLib::YieldTermStructure>) -> None
Constructs with caplet vol and nominal term structure.
__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.
Base pricer for year-on-year inflation coupons.
BlackYoYInflationCouponPricer¶
- class pyquantlib.BlackYoYInflationCouponPricer¶
Bases:
YoYInflationCouponPricerBlack-formula pricer for YoY inflation coupons.
- __init__(*args, **kwargs)¶
Overloaded function.
__init__() -> None
Constructs with no vol or nominal curve.
__init__(nominalTermStructure: QuantLib::Handle<QuantLib::YieldTermStructure>) -> None
Constructs with a nominal term structure.
__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:
YoYInflationCouponPricerUnit-displaced Black pricer for YoY inflation coupons.
- __init__(*args, **kwargs)¶
Overloaded function.
__init__() -> None
Constructs with no vol or nominal curve.
__init__(nominalTermStructure: QuantLib::Handle<QuantLib::YieldTermStructure>) -> None
Constructs with a nominal term structure.
__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:
YoYInflationCouponPricerBachelier (normal) pricer for YoY inflation coupons.
- __init__(*args, **kwargs)¶
Overloaded function.
__init__() -> None
Constructs with no vol or nominal curve.
__init__(nominalTermStructure: QuantLib::Handle<QuantLib::YieldTermStructure>) -> None
Constructs with a nominal term structure.
__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:
DividendFixed cash dividend.
- __init__(amount: SupportsFloat | SupportsIndex, date: Date) None¶
Constructs a fixed dividend.
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:
DividendFractional (proportional) dividend.
- __init__(*args, **kwargs)¶
Overloaded function.
__init__(rate: SupportsFloat | SupportsIndex, date: Date) -> None
Constructs a fractional dividend (rate only).
__init__(rate: SupportsFloat | SupportsIndex, nominal: SupportsFloat | SupportsIndex, date: Date) -> None
Constructs a fractional dividend with nominal.
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_objectDuration 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 duration |
|
Macaulay duration |
|
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.