Indexes Module

Indexes represent market rates used for floating-rate instruments.

Abstract Base Classes

The following abstract classes are available in pyquantlib.base:

Index

Base class for all indexes.

Key methods:

  • name(): Returns the index name

  • fixingCalendar(): Returns the calendar for fixing dates

  • isValidFixingDate(date): Checks if a date is a valid fixing date

  • fixing(date): Returns the fixing for a given date

  • addFixing(date, value): Adds a historical fixing

InterestRateIndex

Base class for interest rate indexes (e.g., LIBOR, EURIBOR, SOFR).

Additional methods:

  • familyName(): Returns the index family name

  • tenor(): Returns the index tenor

  • currency(): Returns the index currency

  • dayCounter(): Returns the day counter

  • fixingDays(): Returns the number of fixing days

from pyquantlib.base import Index, InterestRateIndex

IBOR Indexes

IborIndex

class pyquantlib.IborIndex

Bases: InterestRateIndex

Base class for IBOR indexes (e.g. Euribor, Libor).

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(familyName: str, tenor: Period, settlementDays: SupportsInt | SupportsIndex, currency: Currency, fixingCalendar: Calendar, convention: BusinessDayConvention, endOfMonth: bool, dayCounter: DayCounter) -> None

Constructs an IBOR index without forwarding curve.

  1. __init__(familyName: str, tenor: Period, settlementDays: SupportsInt | SupportsIndex, currency: Currency, fixingCalendar: Calendar, convention: BusinessDayConvention, endOfMonth: bool, dayCounter: DayCounter, h: QuantLib::Handle<QuantLib::YieldTermStructure>) -> None

Constructs an IBOR index with forwarding term structure handle.

  1. __init__(familyName: str, tenor: Period, settlementDays: SupportsInt | SupportsIndex, currency: Currency, fixingCalendar: Calendar, convention: BusinessDayConvention, endOfMonth: bool, dayCounter: DayCounter, forwardingTermStructure: QuantLib::YieldTermStructure) -> None

Constructs an IBOR index with forwarding term structure.

businessDayConvention() BusinessDayConvention

Returns the business day convention.

clone(forwardingTermStructure: QuantLib::Handle<QuantLib::YieldTermStructure>) IborIndex

Returns a copy linked to a different forwarding curve.

endOfMonth() bool

Returns True if end-of-month adjustment applies.

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

Returns the forwarding term structure handle.

Euribor

class pyquantlib.Euribor

Bases: IborIndex

Euribor index fixed by the ECB.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(tenor: Period) -> None

Constructs Euribor index with given tenor.

  1. __init__(tenor: Period, h: QuantLib::Handle<QuantLib::YieldTermStructure>) -> None

Constructs Euribor index with forwarding term structure handle.

  1. __init__(tenor: Period, forwardingTermStructure: QuantLib::YieldTermStructure) -> None

Constructs Euribor index with forwarding term structure.

euribor6m = ql.Euribor(ql.Period(6, ql.Months), curve)

Overnight Indexes

Sofr

class pyquantlib.Sofr

Bases: OvernightIndex

Secured Overnight Financing Rate (SOFR) index.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__() -> None

Constructs SOFR without forwarding curve.

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

Constructs SOFR with forwarding term structure handle.

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

Constructs SOFR with forwarding term structure.

Secured Overnight Financing Rate (USD).

sofr = ql.Sofr()           # without curve
sofr = ql.Sofr(curve)      # with forwarding curve

Eonia

class pyquantlib.Eonia

Bases: OvernightIndex

Euro Overnight Index Average (EONIA) rate fixed by the ECB.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__() -> None

Constructs Eonia without forwarding curve.

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

Constructs Eonia with forwarding term structure handle.

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

Constructs Eonia with forwarding term structure.

Euro Overnight Index Average (EONIA) rate fixed by the ECB.

eonia = ql.Eonia()           # without curve
eonia = ql.Eonia(curve)      # with forwarding curve

Estr

class pyquantlib.Estr

Bases: OvernightIndex

Euro Short-Term Rate (ESTR) index.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__() -> None

Constructs ESTR without forwarding curve.

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

Constructs ESTR with forwarding term structure handle.

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

Constructs ESTR with forwarding term structure.

Euro Short-Term Rate (EUR).

estr = ql.Estr(curve)

Sonia

class pyquantlib.Sonia

Bases: OvernightIndex

Sterling Overnight Index Average (SONIA) rate.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__() -> None

Constructs SONIA without forwarding curve.

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

Constructs SONIA with forwarding term structure handle.

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

Constructs SONIA with forwarding term structure.

Sterling Overnight Index Average (GBP).

sonia = ql.Sonia(curve)

Swap Indexes

SwapIndex

class pyquantlib.SwapIndex

Bases: InterestRateIndex

Swap rate index.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(familyName: str, tenor: Period, settlementDays: SupportsInt | SupportsIndex, currency: Currency, fixingCalendar: Calendar, fixedLegTenor: Period, fixedLegConvention: BusinessDayConvention, fixedLegDayCounter: DayCounter, iborIndex: IborIndex) -> None

Constructs a swap index.

  1. __init__(familyName: str, tenor: Period, settlementDays: SupportsInt | SupportsIndex, currency: Currency, fixingCalendar: Calendar, fixedLegTenor: Period, fixedLegConvention: BusinessDayConvention, fixedLegDayCounter: DayCounter, iborIndex: IborIndex, discountingTermStructure: QuantLib::Handle<QuantLib::YieldTermStructure>) -> None

Constructs a swap index with discounting term structure.

  1. __init__(familyName: str, tenor: Period, settlementDays: SupportsInt | SupportsIndex, currency: Currency, fixingCalendar: Calendar, fixedLegTenor: Period, fixedLegConvention: BusinessDayConvention, fixedLegDayCounter: DayCounter, iborIndex: IborIndex, discountCurve: QuantLib::YieldTermStructure) -> None

Constructs a swap index with discounting curve.

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

Returns the discounting term structure handle.

exogenousDiscount() bool

Returns true if using exogenous discounting.

fixedLegConvention() BusinessDayConvention

Returns the fixed leg business day convention.

fixedLegTenor() Period

Returns the fixed leg tenor.

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

Returns the forwarding term structure handle.

iborIndex() IborIndex

Returns the IBOR index.

underlyingSwap(fixingDate: Date) object

Returns the underlying swap for a given fixing date.

euribor6m = ql.Euribor(ql.Period(6, ql.Months), curve)
swap_index = ql.SwapIndex(
    "EurSwap", ql.Period(5, ql.Years), 2,
    ql.EURCurrency(), ql.TARGET(),
    ql.Period(1, ql.Years), ql.Unadjusted,
    ql.Thirty360(ql.Thirty360.BondBasis), euribor6m,
)

OvernightIndexedSwapIndex

class pyquantlib.OvernightIndexedSwapIndex

Bases: SwapIndex

OIS swap rate index.

__init__(familyName: str, tenor: Period, settlementDays: SupportsInt | SupportsIndex, currency: Currency, overnightIndex: OvernightIndex, telescopicValueDates: bool = False, averagingMethod: RateAveraging.Type = <Type.Compound: 1>) None

Constructs an OIS swap rate index.

overnightIndex() object

Returns the overnight index.

estr = ql.Estr(curve)
ois_index = ql.OvernightIndexedSwapIndex(
    "EstrSwap", ql.Period(1, ql.Years), 2,
    ql.EURCurrency(), estr,
)

Concrete Swap Index Subclasses

Standard market swap indexes with pre-configured conventions.

EuriborSwapIsdaFixA

class pyquantlib.EuriborSwapIsdaFixA

Bases: SwapIndex

Euribor swap rate (ISDA fix A).

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(tenor: Period) -> None

Constructs with given tenor.

  1. __init__(tenor: Period, h: QuantLib::Handle<QuantLib::YieldTermStructure>) -> None

Constructs with forwarding term structure handle.

  1. __init__(tenor: Period, forwarding: QuantLib::Handle<QuantLib::YieldTermStructure>, discounting: QuantLib::Handle<QuantLib::YieldTermStructure>) -> None

Constructs with forwarding and discounting term structure handles.

  1. __init__(tenor: Period, forwardingTermStructure: QuantLib::YieldTermStructure) -> None

Constructs with forwarding term structure.

  1. __init__(tenor: Period, forwardingTermStructure: QuantLib::YieldTermStructure, discountingTermStructure: QuantLib::YieldTermStructure) -> None

Constructs with forwarding and discounting term structures.

EuriborSwapIsdaFixB

class pyquantlib.EuriborSwapIsdaFixB

Bases: SwapIndex

Euribor swap rate (ISDA fix B).

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(tenor: Period) -> None

Constructs with given tenor.

  1. __init__(tenor: Period, h: QuantLib::Handle<QuantLib::YieldTermStructure>) -> None

Constructs with forwarding term structure handle.

  1. __init__(tenor: Period, forwarding: QuantLib::Handle<QuantLib::YieldTermStructure>, discounting: QuantLib::Handle<QuantLib::YieldTermStructure>) -> None

Constructs with forwarding and discounting term structure handles.

  1. __init__(tenor: Period, forwardingTermStructure: QuantLib::YieldTermStructure) -> None

Constructs with forwarding term structure.

  1. __init__(tenor: Period, forwardingTermStructure: QuantLib::YieldTermStructure, discountingTermStructure: QuantLib::YieldTermStructure) -> None

Constructs with forwarding and discounting term structures.

EuriborSwapIfrFix

class pyquantlib.EuriborSwapIfrFix

Bases: SwapIndex

Euribor swap rate (IFR fix).

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(tenor: Period) -> None

Constructs with given tenor.

  1. __init__(tenor: Period, h: QuantLib::Handle<QuantLib::YieldTermStructure>) -> None

Constructs with forwarding term structure handle.

  1. __init__(tenor: Period, forwarding: QuantLib::Handle<QuantLib::YieldTermStructure>, discounting: QuantLib::Handle<QuantLib::YieldTermStructure>) -> None

Constructs with forwarding and discounting term structure handles.

  1. __init__(tenor: Period, forwardingTermStructure: QuantLib::YieldTermStructure) -> None

Constructs with forwarding term structure.

  1. __init__(tenor: Period, forwardingTermStructure: QuantLib::YieldTermStructure, discountingTermStructure: QuantLib::YieldTermStructure) -> None

Constructs with forwarding and discounting term structures.

EurLiborSwapIsdaFixA

class pyquantlib.EurLiborSwapIsdaFixA

Bases: SwapIndex

EUR LIBOR swap rate (ISDA fix A).

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(tenor: Period) -> None

Constructs with given tenor.

  1. __init__(tenor: Period, h: QuantLib::Handle<QuantLib::YieldTermStructure>) -> None

Constructs with forwarding term structure handle.

  1. __init__(tenor: Period, forwarding: QuantLib::Handle<QuantLib::YieldTermStructure>, discounting: QuantLib::Handle<QuantLib::YieldTermStructure>) -> None

Constructs with forwarding and discounting term structure handles.

  1. __init__(tenor: Period, forwardingTermStructure: QuantLib::YieldTermStructure) -> None

Constructs with forwarding term structure.

  1. __init__(tenor: Period, forwardingTermStructure: QuantLib::YieldTermStructure, discountingTermStructure: QuantLib::YieldTermStructure) -> None

Constructs with forwarding and discounting term structures.

EurLiborSwapIsdaFixB

class pyquantlib.EurLiborSwapIsdaFixB

Bases: SwapIndex

EUR LIBOR swap rate (ISDA fix B).

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(tenor: Period) -> None

Constructs with given tenor.

  1. __init__(tenor: Period, h: QuantLib::Handle<QuantLib::YieldTermStructure>) -> None

Constructs with forwarding term structure handle.

  1. __init__(tenor: Period, forwarding: QuantLib::Handle<QuantLib::YieldTermStructure>, discounting: QuantLib::Handle<QuantLib::YieldTermStructure>) -> None

Constructs with forwarding and discounting term structure handles.

  1. __init__(tenor: Period, forwardingTermStructure: QuantLib::YieldTermStructure) -> None

Constructs with forwarding term structure.

  1. __init__(tenor: Period, forwardingTermStructure: QuantLib::YieldTermStructure, discountingTermStructure: QuantLib::YieldTermStructure) -> None

Constructs with forwarding and discounting term structures.

EurLiborSwapIfrFix

class pyquantlib.EurLiborSwapIfrFix

Bases: SwapIndex

EUR LIBOR swap rate (IFR fix).

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(tenor: Period) -> None

Constructs with given tenor.

  1. __init__(tenor: Period, h: QuantLib::Handle<QuantLib::YieldTermStructure>) -> None

Constructs with forwarding term structure handle.

  1. __init__(tenor: Period, forwarding: QuantLib::Handle<QuantLib::YieldTermStructure>, discounting: QuantLib::Handle<QuantLib::YieldTermStructure>) -> None

Constructs with forwarding and discounting term structure handles.

  1. __init__(tenor: Period, forwardingTermStructure: QuantLib::YieldTermStructure) -> None

Constructs with forwarding term structure.

  1. __init__(tenor: Period, forwardingTermStructure: QuantLib::YieldTermStructure, discountingTermStructure: QuantLib::YieldTermStructure) -> None

Constructs with forwarding and discounting term structures.

UsdLiborSwapIsdaFixAm

class pyquantlib.UsdLiborSwapIsdaFixAm

Bases: SwapIndex

USD LIBOR swap rate (ISDA fix AM).

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(tenor: Period) -> None

Constructs with given tenor.

  1. __init__(tenor: Period, h: QuantLib::Handle<QuantLib::YieldTermStructure>) -> None

Constructs with forwarding term structure handle.

  1. __init__(tenor: Period, forwarding: QuantLib::Handle<QuantLib::YieldTermStructure>, discounting: QuantLib::Handle<QuantLib::YieldTermStructure>) -> None

Constructs with forwarding and discounting term structure handles.

  1. __init__(tenor: Period, forwardingTermStructure: QuantLib::YieldTermStructure) -> None

Constructs with forwarding term structure.

  1. __init__(tenor: Period, forwardingTermStructure: QuantLib::YieldTermStructure, discountingTermStructure: QuantLib::YieldTermStructure) -> None

Constructs with forwarding and discounting term structures.

UsdLiborSwapIsdaFixPm

class pyquantlib.UsdLiborSwapIsdaFixPm

Bases: SwapIndex

USD LIBOR swap rate (ISDA fix PM).

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(tenor: Period) -> None

Constructs with given tenor.

  1. __init__(tenor: Period, h: QuantLib::Handle<QuantLib::YieldTermStructure>) -> None

Constructs with forwarding term structure handle.

  1. __init__(tenor: Period, forwarding: QuantLib::Handle<QuantLib::YieldTermStructure>, discounting: QuantLib::Handle<QuantLib::YieldTermStructure>) -> None

Constructs with forwarding and discounting term structure handles.

  1. __init__(tenor: Period, forwardingTermStructure: QuantLib::YieldTermStructure) -> None

Constructs with forwarding term structure.

  1. __init__(tenor: Period, forwardingTermStructure: QuantLib::YieldTermStructure, discountingTermStructure: QuantLib::YieldTermStructure) -> None

Constructs with forwarding and discounting term structures.

JpyLiborSwapIsdaFixAm

class pyquantlib.JpyLiborSwapIsdaFixAm

Bases: SwapIndex

JPY LIBOR swap rate (ISDA fix AM).

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(tenor: Period) -> None

Constructs with given tenor.

  1. __init__(tenor: Period, h: QuantLib::Handle<QuantLib::YieldTermStructure>) -> None

Constructs with forwarding term structure handle.

  1. __init__(tenor: Period, forwarding: QuantLib::Handle<QuantLib::YieldTermStructure>, discounting: QuantLib::Handle<QuantLib::YieldTermStructure>) -> None

Constructs with forwarding and discounting term structure handles.

  1. __init__(tenor: Period, forwardingTermStructure: QuantLib::YieldTermStructure) -> None

Constructs with forwarding term structure.

  1. __init__(tenor: Period, forwardingTermStructure: QuantLib::YieldTermStructure, discountingTermStructure: QuantLib::YieldTermStructure) -> None

Constructs with forwarding and discounting term structures.

JpyLiborSwapIsdaFixPm

class pyquantlib.JpyLiborSwapIsdaFixPm

Bases: SwapIndex

JPY LIBOR swap rate (ISDA fix PM).

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(tenor: Period) -> None

Constructs with given tenor.

  1. __init__(tenor: Period, h: QuantLib::Handle<QuantLib::YieldTermStructure>) -> None

Constructs with forwarding term structure handle.

  1. __init__(tenor: Period, forwarding: QuantLib::Handle<QuantLib::YieldTermStructure>, discounting: QuantLib::Handle<QuantLib::YieldTermStructure>) -> None

Constructs with forwarding and discounting term structure handles.

  1. __init__(tenor: Period, forwardingTermStructure: QuantLib::YieldTermStructure) -> None

Constructs with forwarding term structure.

  1. __init__(tenor: Period, forwardingTermStructure: QuantLib::YieldTermStructure, discountingTermStructure: QuantLib::YieldTermStructure) -> None

Constructs with forwarding and discounting term structures.

GbpLiborSwapIsdaFix

class pyquantlib.GbpLiborSwapIsdaFix

Bases: SwapIndex

GBP LIBOR swap rate (ISDA fix).

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(tenor: Period) -> None

Constructs with given tenor.

  1. __init__(tenor: Period, h: QuantLib::Handle<QuantLib::YieldTermStructure>) -> None

Constructs with forwarding term structure handle.

  1. __init__(tenor: Period, forwarding: QuantLib::Handle<QuantLib::YieldTermStructure>, discounting: QuantLib::Handle<QuantLib::YieldTermStructure>) -> None

Constructs with forwarding and discounting term structure handles.

  1. __init__(tenor: Period, forwardingTermStructure: QuantLib::YieldTermStructure) -> None

Constructs with forwarding term structure.

  1. __init__(tenor: Period, forwardingTermStructure: QuantLib::YieldTermStructure, discountingTermStructure: QuantLib::YieldTermStructure) -> None

Constructs with forwarding and discounting term structures.

ChfLiborSwapIsdaFix

class pyquantlib.ChfLiborSwapIsdaFix

Bases: SwapIndex

CHF LIBOR swap rate (ISDA fix).

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(tenor: Period) -> None

Constructs with given tenor.

  1. __init__(tenor: Period, h: QuantLib::Handle<QuantLib::YieldTermStructure>) -> None

Constructs with forwarding term structure handle.

  1. __init__(tenor: Period, forwarding: QuantLib::Handle<QuantLib::YieldTermStructure>, discounting: QuantLib::Handle<QuantLib::YieldTermStructure>) -> None

Constructs with forwarding and discounting term structure handles.

  1. __init__(tenor: Period, forwardingTermStructure: QuantLib::YieldTermStructure) -> None

Constructs with forwarding term structure.

  1. __init__(tenor: Period, forwardingTermStructure: QuantLib::YieldTermStructure, discountingTermStructure: QuantLib::YieldTermStructure) -> None

Constructs with forwarding and discounting term structures.

swap_index = ql.EuriborSwapIsdaFixA(ql.Period(5, ql.Years))
swap_index = ql.EuriborSwapIsdaFixA(ql.Period(5, ql.Years), forwarding_curve)
swap_index = ql.EuriborSwapIsdaFixA(ql.Period(5, ql.Years), forwarding_curve, discounting_curve)

BMA Index

BMAIndex

class pyquantlib.BMAIndex

Bases: InterestRateIndex

Bond Market Association index (tax-exempt reference rate).

__init__(*args, **kwargs)

Overloaded function.

  1. __init__() -> None

Constructs a BMA index without a forwarding curve.

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

Constructs a BMA index from yield curve handle.

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

Constructs from yield curve (handle created internally).

fixingSchedule(start: Date, end: Date) Schedule

Returns the fixing schedule between two dates.

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

Returns the forwarding term structure handle.

isValidFixingDate(fixingDate: Date) bool

Returns true if the date is a valid BMA fixing date.

Bond Market Association index (tax-exempt municipal reference rate). Fixes weekly on Wednesdays.

bma = ql.BMAIndex()              # without forwarding curve
bma = ql.BMAIndex(curve)         # with forwarding curve
sched = bma.fixingSchedule(start, end)

Swap Spread Index

SwapSpreadIndex

class pyquantlib.SwapSpreadIndex

Bases: InterestRateIndex

Index for the spread between two swap rates.

__init__(familyName: str, swapIndex1: SwapIndex, swapIndex2: SwapIndex, gearing1: SupportsFloat | SupportsIndex = 1.0, gearing2: SupportsFloat | SupportsIndex = -1.0) None

Constructs a swap spread index.

gearing1() float

Returns the gearing for the first index.

gearing2() float

Returns the gearing for the second index.

swapIndex1() SwapIndex

Returns the first swap index.

swapIndex2() SwapIndex

Returns the second swap index.

Spread between two swap rate indexes with configurable gearings.

idx1 = ql.EuriborSwapIsdaFixA(ql.Period("2Y"), curve)
idx2 = ql.EuriborSwapIsdaFixA(ql.Period("10Y"), curve)
spread = ql.SwapSpreadIndex("CMS2s10s", idx1, idx2)
# Custom gearings: 0.5 * idx1 - 0.5 * idx2
spread = ql.SwapSpreadIndex("Weighted", idx1, idx2, 0.5, -0.5)

Equity Indexes

EquityIndex

class pyquantlib.EquityIndex

Bases: Index

Base class for equity indexes.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(name: str, fixingCalendar: Calendar, currency: Currency) -> None

Constructs an equity index without curves or spot.

  1. __init__(name: str, fixingCalendar: Calendar, currency: Currency, interest: QuantLib::Handle<QuantLib::YieldTermStructure>, dividend: QuantLib::Handle<QuantLib::YieldTermStructure>, spot: QuoteHandle) -> None

Constructs an equity index with term structure handles.

  1. __init__(name: str, fixingCalendar: Calendar, currency: Currency, interest: QuantLib::YieldTermStructure, dividend: QuantLib::YieldTermStructure, spot: base.Quote) -> None

Constructs an equity index (handles created internally).

clone(interest: QuantLib::Handle<QuantLib::YieldTermStructure>, dividend: QuantLib::Handle<QuantLib::YieldTermStructure>, spot: QuoteHandle) EquityIndex

Returns a copy linked to different curves or spot.

currency() Currency

Returns the index currency.

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

Returns the dividend curve handle.

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

Returns the interest rate curve handle.

forecastFixing(fixingDate: Date) float

Returns the forecast fixing for the given date.

spot() QuoteHandle

Returns the spot quote handle.

Equity index for total return swap pricing. Supports interest rate and dividend curves.

eq_index = ql.EquityIndex("SPX", ql.UnitedStates(ql.UnitedStates.NYSE),
                           ql.USDCurrency())

# With term structures
eq_index = ql.EquityIndex("SPX", ql.UnitedStates(ql.UnitedStates.NYSE),
                           ql.USDCurrency(), interest_ts, dividend_ts, spot)

Regions

Regions identify the geographic area for inflation indexes.

Region

class pyquantlib.Region

Bases: pybind11_object

Geographic region for inflation indexes.

__init__(*args, **kwargs)
code() str

Returns the ISO region code.

name() str

Returns the region name.

CustomRegion

class pyquantlib.CustomRegion

Bases: Region

Custom region with user-defined name and code.

__init__(name: str, code: str) None

Constructs a custom region.

region = ql.CustomRegion("Brazil", "BR")
print(region.name(), region.code())

Concrete Regions

Class

Name

Code

AustraliaRegion

Australia

AU

EURegion

EU

EU

FranceRegion

France

FR

UKRegion

UK

UK

USRegion

USA

US

ZARegion

South Africa

ZA

us = ql.USRegion()
print(us.name(), us.code())  # "USA" "US"

Inflation Indexes

InflationIndex

class pyquantlib.base.InflationIndex

Bases: Index

Abstract base class for inflation indexes.

__init__(familyName: str, region: Region, revised: bool, frequency: Frequency, availabilityLag: Period, currency: Currency) None

Constructs an inflation index.

availabilityLag() Period

Returns the availability lag.

currency() Currency

Returns the currency.

familyName() str

Returns the family name.

frequency() Frequency

Returns the publication frequency.

pastFixing(fixingDate: Date) float

Returns the past fixing for the given date.

region() Region

Returns the geographic region.

revised() bool

Returns true if the index is revised after publication.

Base class for all inflation indexes. Provides familyName(), region(), revised(), frequency(), availabilityLag(), and currency().

CPI

class pyquantlib.CPI

Bases: pybind11_object

CPI interpolation methods and utilities.

class InterpolationType

Bases: pybind11_object

CPI interpolation type.

Members:

AsIndex : Same interpolation as the index.

Flat : Flat from previous fixing.

Linear : Linearly between bracketing fixings.

__init__(value: SupportsInt | SupportsIndex) None
AsIndex = <InterpolationType.AsIndex: 0>
Flat = <InterpolationType.Flat: 1>
Linear = <InterpolationType.Linear: 2>
CPI.InterpolationType.name -> str
property value
static laggedFixing(index: QuantLib::ZeroInflationIndex, date: Date, observationLag: Period, interpolationType: CPI.InterpolationType) float

Returns the lagged CPI fixing.

__init__(*args, **kwargs)
AsIndex = <InterpolationType.AsIndex: 0>
Flat = <InterpolationType.Flat: 1>
Linear = <InterpolationType.Linear: 2>

CPI interpolation types and the laggedFixing static method.

# Interpolation types
ql.CPI.AsIndex          # use index's built-in interpolation
ql.CPI.Flat             # flat (no interpolation within period)
ql.CPI.Linear           # linear interpolation between fixings

# Compute lagged fixing
fixing = ql.CPI.laggedFixing(index, date, observationLag, interpolation)

ZeroInflationIndex

class pyquantlib.ZeroInflationIndex

Bases: InflationIndex

Zero-coupon inflation index.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(familyName: str, region: Region, revised: bool, frequency: Frequency, availabilityLag: Period, currency: Currency) -> None

Constructs a zero inflation index without a term structure.

  1. __init__(familyName: str, region: Region, revised: bool, frequency: Frequency, availabilityLag: Period, currency: Currency, h: QuantLib::Handle<QuantLib::ZeroInflationTermStructure>) -> None

Constructs a zero inflation index with term structure handle.

  1. __init__(familyName: str, region: Region, revised: bool, frequency: Frequency, availabilityLag: Period, currency: Currency, zeroInflationTermStructure: QuantLib::ZeroInflationTermStructure) -> None

Constructs a zero inflation index with term structure.

clone(h: QuantLib::Handle<QuantLib::ZeroInflationTermStructure>) ZeroInflationIndex

Returns a copy linked to a different term structure.

lastFixingDate() Date

Returns the last available fixing date.

zeroInflationTermStructure() QuantLib::Handle<QuantLib::ZeroInflationTermStructure>

Returns the zero inflation term structure handle.

# Without term structure
idx = ql.ZeroInflationIndex("CPI", ql.USRegion(), False, ql.Monthly,
                            ql.Period(3, ql.Months), ql.USDCurrency())

# With term structure (hidden handle)
idx = ql.ZeroInflationIndex("CPI", ql.USRegion(), False, ql.Monthly,
                            ql.Period(3, ql.Months), ql.USDCurrency(),
                            zero_inflation_curve)

YoYInflationIndex

class pyquantlib.YoYInflationIndex

Bases: InflationIndex

Year-on-year inflation index.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(underlyingIndex: ZeroInflationIndex) -> None

Constructs a year-on-year index as a ratio of a zero index.

  1. __init__(underlyingIndex: ZeroInflationIndex, h: QuantLib::Handle<QuantLib::YoYInflationTermStructure>) -> None

Constructs a year-on-year index with term structure handle.

  1. __init__(underlyingIndex: ZeroInflationIndex, yoyInflationTermStructure: QuantLib::YoYInflationTermStructure) -> None

Constructs a year-on-year index with term structure.

  1. __init__(familyName: str, region: Region, revised: bool, frequency: Frequency, availabilityLag: Period, currency: Currency) -> None

Constructs a quoted year-on-year index without a term structure.

  1. __init__(familyName: str, region: Region, revised: bool, frequency: Frequency, availabilityLag: Period, currency: Currency, h: QuantLib::Handle<QuantLib::YoYInflationTermStructure>) -> None

Constructs a quoted year-on-year index with term structure handle.

  1. __init__(familyName: str, region: Region, revised: bool, frequency: Frequency, availabilityLag: Period, currency: Currency, yoyInflationTermStructure: QuantLib::YoYInflationTermStructure) -> None

Constructs a quoted year-on-year index with term structure.

clone(h: QuantLib::Handle<QuantLib::YoYInflationTermStructure>) YoYInflationIndex

Returns a copy linked to a different term structure.

interpolated() bool

Returns true if the index interpolates between fixings.

lastFixingDate() Date

Returns the last available fixing date.

ratio() bool

Returns true if index is defined as a ratio of zero index fixings.

underlyingIndex() ZeroInflationIndex

Returns the underlying zero inflation index (if ratio-based).

yoyInflationTermStructure() QuantLib::Handle<QuantLib::YoYInflationTermStructure>

Returns the YoY inflation term structure handle.

# Ratio-based from a zero inflation index
yoy = ql.YoYInflationIndex(zero_index)

# Quoted year-on-year index
yoy = ql.YoYInflationIndex("YYUS", ql.USRegion(), False, False,
                           ql.Monthly, ql.Period(3, ql.Months),
                           ql.USDCurrency())

Concrete Inflation Indexes

US CPI

class pyquantlib.USCPI

Bases: ZeroInflationIndex

US Consumer Price Index.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__() -> None

Constructs USCPI without a term structure.

  1. __init__(h: QuantLib::Handle<QuantLib::ZeroInflationTermStructure>) -> None

Constructs USCPI with a term structure handle.

  1. __init__(zeroInflationTermStructure: QuantLib::ZeroInflationTermStructure) -> None

Constructs USCPI with a term structure.

class pyquantlib.YYUSCPI

Bases: YoYInflationIndex

Year-on-year US Consumer Price Index.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__() -> None

Constructs YYUSCPI without a term structure.

  1. __init__(h: QuantLib::Handle<QuantLib::YoYInflationTermStructure>) -> None

Constructs YYUSCPI with a term structure handle.

  1. __init__(yoyInflationTermStructure: QuantLib::YoYInflationTermStructure) -> None

Constructs YYUSCPI with a term structure.

cpi = ql.USCPI()                          # without term structure
cpi = ql.USCPI(zero_inflation_curve)      # with term structure

yy = ql.YYUSCPI()                         # without term structure
yy = ql.YYUSCPI(yoy_inflation_curve)      # with term structure

EU HICP

class pyquantlib.EUHICP

Bases: ZeroInflationIndex

EU Harmonised Index of Consumer Prices.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__() -> None

Constructs EUHICP without a term structure.

  1. __init__(h: QuantLib::Handle<QuantLib::ZeroInflationTermStructure>) -> None

Constructs EUHICP with a term structure handle.

  1. __init__(zeroInflationTermStructure: QuantLib::ZeroInflationTermStructure) -> None

Constructs EUHICP with a term structure.

class pyquantlib.EUHICPXT

Bases: ZeroInflationIndex

EU HICP Excluding Tobacco.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__() -> None

Constructs EUHICPXT without a term structure.

  1. __init__(h: QuantLib::Handle<QuantLib::ZeroInflationTermStructure>) -> None

Constructs EUHICPXT with a term structure handle.

  1. __init__(zeroInflationTermStructure: QuantLib::ZeroInflationTermStructure) -> None

Constructs EUHICPXT with a term structure.

class pyquantlib.YYEUHICP

Bases: YoYInflationIndex

Year-on-year EU HICP.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__() -> None

Constructs YYEUHICP without a term structure.

  1. __init__(h: QuantLib::Handle<QuantLib::YoYInflationTermStructure>) -> None

Constructs YYEUHICP with a term structure handle.

  1. __init__(yoyInflationTermStructure: QuantLib::YoYInflationTermStructure) -> None

Constructs YYEUHICP with a term structure.

class pyquantlib.YYEUHICPXT

Bases: YoYInflationIndex

Year-on-year EU HICP Excluding Tobacco.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__() -> None

Constructs YYEUHICPXT without a term structure.

  1. __init__(h: QuantLib::Handle<QuantLib::YoYInflationTermStructure>) -> None

Constructs YYEUHICPXT with a term structure handle.

  1. __init__(yoyInflationTermStructure: QuantLib::YoYInflationTermStructure) -> None

Constructs YYEUHICPXT with a term structure.

UK RPI

class pyquantlib.UKRPI

Bases: ZeroInflationIndex

UK Retail Prices Index.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__() -> None

Constructs UKRPI without a term structure.

  1. __init__(h: QuantLib::Handle<QuantLib::ZeroInflationTermStructure>) -> None

Constructs UKRPI with a term structure handle.

  1. __init__(zeroInflationTermStructure: QuantLib::ZeroInflationTermStructure) -> None

Constructs UKRPI with a term structure.

class pyquantlib.YYUKRPI

Bases: YoYInflationIndex

Year-on-year UK Retail Prices Index.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__() -> None

Constructs YYUKRPI without a term structure.

  1. __init__(h: QuantLib::Handle<QuantLib::YoYInflationTermStructure>) -> None

Constructs YYUKRPI with a term structure handle.

  1. __init__(yoyInflationTermStructure: QuantLib::YoYInflationTermStructure) -> None

Constructs YYUKRPI with a term structure.

Australian CPI

class pyquantlib.AUCPI

Bases: ZeroInflationIndex

Australian Consumer Price Index.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(frequency: Frequency, revised: bool) -> None

Constructs AUCPI without a term structure.

  1. __init__(frequency: Frequency, revised: bool, h: QuantLib::Handle<QuantLib::ZeroInflationTermStructure>) -> None

Constructs AUCPI with a term structure handle.

  1. __init__(frequency: Frequency, revised: bool, zeroInflationTermStructure: QuantLib::ZeroInflationTermStructure) -> None

Constructs AUCPI with a term structure.

class pyquantlib.YYAUCPI

Bases: YoYInflationIndex

Year-on-year Australian Consumer Price Index.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(frequency: Frequency, revised: bool) -> None

Constructs YYAUCPI without a term structure.

  1. __init__(frequency: Frequency, revised: bool, h: QuantLib::Handle<QuantLib::YoYInflationTermStructure>) -> None

Constructs YYAUCPI with a term structure handle.

  1. __init__(frequency: Frequency, revised: bool, yoyInflationTermStructure: QuantLib::YoYInflationTermStructure) -> None

Constructs YYAUCPI with a term structure.

cpi = ql.AUCPI(ql.Quarterly, False)          # frequency and revised flag
cpi = ql.AUCPI(ql.Quarterly, False, zero_inflation_curve)

French HICP

class pyquantlib.FRHICP

Bases: ZeroInflationIndex

French Harmonised Index of Consumer Prices.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__() -> None

Constructs FRHICP without a term structure.

  1. __init__(h: QuantLib::Handle<QuantLib::ZeroInflationTermStructure>) -> None

Constructs FRHICP with a term structure handle.

  1. __init__(zeroInflationTermStructure: QuantLib::ZeroInflationTermStructure) -> None

Constructs FRHICP with a term structure.

class pyquantlib.YYFRHICP

Bases: YoYInflationIndex

Year-on-year French HICP.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__() -> None

Constructs YYFRHICP without a term structure.

  1. __init__(h: QuantLib::Handle<QuantLib::YoYInflationTermStructure>) -> None

Constructs YYFRHICP with a term structure handle.

  1. __init__(yoyInflationTermStructure: QuantLib::YoYInflationTermStructure) -> None

Constructs YYFRHICP with a term structure.

South African CPI

class pyquantlib.ZACPI

Bases: ZeroInflationIndex

South African Consumer Price Index.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__() -> None

Constructs ZACPI without a term structure.

  1. __init__(h: QuantLib::Handle<QuantLib::ZeroInflationTermStructure>) -> None

Constructs ZACPI with a term structure handle.

  1. __init__(zeroInflationTermStructure: QuantLib::ZeroInflationTermStructure) -> None

Constructs ZACPI with a term structure.

class pyquantlib.YYZACPI

Bases: YoYInflationIndex

Year-on-year South African Consumer Price Index.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__() -> None

Constructs YYZACPI without a term structure.

  1. __init__(h: QuantLib::Handle<QuantLib::YoYInflationTermStructure>) -> None

Constructs YYZACPI with a term structure handle.

  1. __init__(yoyInflationTermStructure: QuantLib::YoYInflationTermStructure) -> None

Constructs YYZACPI with a term structure.