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 namefixingCalendar(): Returns the calendar for fixing datesisValidFixingDate(date): Checks if a date is a valid fixing datefixing(date): Returns the fixing for a given dateaddFixing(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 nametenor(): Returns the index tenorcurrency(): Returns the index currencydayCounter(): Returns the day counterfixingDays(): Returns the number of fixing days
from pyquantlib.base import Index, InterestRateIndex
IBOR Indexes¶
IborIndex¶
- class pyquantlib.IborIndex¶
Bases:
InterestRateIndexBase class for IBOR indexes (e.g. Euribor, Libor).
- __init__(*args, **kwargs)¶
Overloaded function.
__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.
__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.
__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.
- forwardingTermStructure() QuantLib::Handle<QuantLib::YieldTermStructure>¶
Returns the forwarding term structure handle.
Euribor¶
- class pyquantlib.Euribor¶
Bases:
IborIndexEuribor index fixed by the ECB.
- __init__(*args, **kwargs)¶
Overloaded function.
__init__(tenor: Period) -> None
Constructs Euribor index with given tenor.
__init__(tenor: Period, h: QuantLib::Handle<QuantLib::YieldTermStructure>) -> None
Constructs Euribor index with forwarding term structure handle.
__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:
OvernightIndexSecured Overnight Financing Rate (SOFR) index.
- __init__(*args, **kwargs)¶
Overloaded function.
__init__() -> None
Constructs SOFR without forwarding curve.
__init__(h: QuantLib::Handle<QuantLib::YieldTermStructure>) -> None
Constructs SOFR with forwarding term structure handle.
__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:
OvernightIndexEuro Overnight Index Average (EONIA) rate fixed by the ECB.
- __init__(*args, **kwargs)¶
Overloaded function.
__init__() -> None
Constructs Eonia without forwarding curve.
__init__(h: QuantLib::Handle<QuantLib::YieldTermStructure>) -> None
Constructs Eonia with forwarding term structure handle.
__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:
OvernightIndexEuro Short-Term Rate (ESTR) index.
- __init__(*args, **kwargs)¶
Overloaded function.
__init__() -> None
Constructs ESTR without forwarding curve.
__init__(h: QuantLib::Handle<QuantLib::YieldTermStructure>) -> None
Constructs ESTR with forwarding term structure handle.
__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:
OvernightIndexSterling Overnight Index Average (SONIA) rate.
- __init__(*args, **kwargs)¶
Overloaded function.
__init__() -> None
Constructs SONIA without forwarding curve.
__init__(h: QuantLib::Handle<QuantLib::YieldTermStructure>) -> None
Constructs SONIA with forwarding term structure handle.
__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:
InterestRateIndexSwap rate index.
- __init__(*args, **kwargs)¶
Overloaded function.
__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.
__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.
__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.
- fixedLegConvention() BusinessDayConvention¶
Returns the fixed leg business day convention.
- forwardingTermStructure() QuantLib::Handle<QuantLib::YieldTermStructure>¶
Returns the forwarding term structure handle.
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:
SwapIndexOIS 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.
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:
SwapIndexEuribor swap rate (ISDA fix A).
- __init__(*args, **kwargs)¶
Overloaded function.
__init__(tenor: Period) -> None
Constructs with given tenor.
__init__(tenor: Period, h: QuantLib::Handle<QuantLib::YieldTermStructure>) -> None
Constructs with forwarding term structure handle.
__init__(tenor: Period, forwarding: QuantLib::Handle<QuantLib::YieldTermStructure>, discounting: QuantLib::Handle<QuantLib::YieldTermStructure>) -> None
Constructs with forwarding and discounting term structure handles.
__init__(tenor: Period, forwardingTermStructure: QuantLib::YieldTermStructure) -> None
Constructs with forwarding term structure.
__init__(tenor: Period, forwardingTermStructure: QuantLib::YieldTermStructure, discountingTermStructure: QuantLib::YieldTermStructure) -> None
Constructs with forwarding and discounting term structures.
EuriborSwapIsdaFixB¶
- class pyquantlib.EuriborSwapIsdaFixB¶
Bases:
SwapIndexEuribor swap rate (ISDA fix B).
- __init__(*args, **kwargs)¶
Overloaded function.
__init__(tenor: Period) -> None
Constructs with given tenor.
__init__(tenor: Period, h: QuantLib::Handle<QuantLib::YieldTermStructure>) -> None
Constructs with forwarding term structure handle.
__init__(tenor: Period, forwarding: QuantLib::Handle<QuantLib::YieldTermStructure>, discounting: QuantLib::Handle<QuantLib::YieldTermStructure>) -> None
Constructs with forwarding and discounting term structure handles.
__init__(tenor: Period, forwardingTermStructure: QuantLib::YieldTermStructure) -> None
Constructs with forwarding term structure.
__init__(tenor: Period, forwardingTermStructure: QuantLib::YieldTermStructure, discountingTermStructure: QuantLib::YieldTermStructure) -> None
Constructs with forwarding and discounting term structures.
EuriborSwapIfrFix¶
- class pyquantlib.EuriborSwapIfrFix¶
Bases:
SwapIndexEuribor swap rate (IFR fix).
- __init__(*args, **kwargs)¶
Overloaded function.
__init__(tenor: Period) -> None
Constructs with given tenor.
__init__(tenor: Period, h: QuantLib::Handle<QuantLib::YieldTermStructure>) -> None
Constructs with forwarding term structure handle.
__init__(tenor: Period, forwarding: QuantLib::Handle<QuantLib::YieldTermStructure>, discounting: QuantLib::Handle<QuantLib::YieldTermStructure>) -> None
Constructs with forwarding and discounting term structure handles.
__init__(tenor: Period, forwardingTermStructure: QuantLib::YieldTermStructure) -> None
Constructs with forwarding term structure.
__init__(tenor: Period, forwardingTermStructure: QuantLib::YieldTermStructure, discountingTermStructure: QuantLib::YieldTermStructure) -> None
Constructs with forwarding and discounting term structures.
EurLiborSwapIsdaFixA¶
- class pyquantlib.EurLiborSwapIsdaFixA¶
Bases:
SwapIndexEUR LIBOR swap rate (ISDA fix A).
- __init__(*args, **kwargs)¶
Overloaded function.
__init__(tenor: Period) -> None
Constructs with given tenor.
__init__(tenor: Period, h: QuantLib::Handle<QuantLib::YieldTermStructure>) -> None
Constructs with forwarding term structure handle.
__init__(tenor: Period, forwarding: QuantLib::Handle<QuantLib::YieldTermStructure>, discounting: QuantLib::Handle<QuantLib::YieldTermStructure>) -> None
Constructs with forwarding and discounting term structure handles.
__init__(tenor: Period, forwardingTermStructure: QuantLib::YieldTermStructure) -> None
Constructs with forwarding term structure.
__init__(tenor: Period, forwardingTermStructure: QuantLib::YieldTermStructure, discountingTermStructure: QuantLib::YieldTermStructure) -> None
Constructs with forwarding and discounting term structures.
EurLiborSwapIsdaFixB¶
- class pyquantlib.EurLiborSwapIsdaFixB¶
Bases:
SwapIndexEUR LIBOR swap rate (ISDA fix B).
- __init__(*args, **kwargs)¶
Overloaded function.
__init__(tenor: Period) -> None
Constructs with given tenor.
__init__(tenor: Period, h: QuantLib::Handle<QuantLib::YieldTermStructure>) -> None
Constructs with forwarding term structure handle.
__init__(tenor: Period, forwarding: QuantLib::Handle<QuantLib::YieldTermStructure>, discounting: QuantLib::Handle<QuantLib::YieldTermStructure>) -> None
Constructs with forwarding and discounting term structure handles.
__init__(tenor: Period, forwardingTermStructure: QuantLib::YieldTermStructure) -> None
Constructs with forwarding term structure.
__init__(tenor: Period, forwardingTermStructure: QuantLib::YieldTermStructure, discountingTermStructure: QuantLib::YieldTermStructure) -> None
Constructs with forwarding and discounting term structures.
EurLiborSwapIfrFix¶
- class pyquantlib.EurLiborSwapIfrFix¶
Bases:
SwapIndexEUR LIBOR swap rate (IFR fix).
- __init__(*args, **kwargs)¶
Overloaded function.
__init__(tenor: Period) -> None
Constructs with given tenor.
__init__(tenor: Period, h: QuantLib::Handle<QuantLib::YieldTermStructure>) -> None
Constructs with forwarding term structure handle.
__init__(tenor: Period, forwarding: QuantLib::Handle<QuantLib::YieldTermStructure>, discounting: QuantLib::Handle<QuantLib::YieldTermStructure>) -> None
Constructs with forwarding and discounting term structure handles.
__init__(tenor: Period, forwardingTermStructure: QuantLib::YieldTermStructure) -> None
Constructs with forwarding term structure.
__init__(tenor: Period, forwardingTermStructure: QuantLib::YieldTermStructure, discountingTermStructure: QuantLib::YieldTermStructure) -> None
Constructs with forwarding and discounting term structures.
UsdLiborSwapIsdaFixAm¶
- class pyquantlib.UsdLiborSwapIsdaFixAm¶
Bases:
SwapIndexUSD LIBOR swap rate (ISDA fix AM).
- __init__(*args, **kwargs)¶
Overloaded function.
__init__(tenor: Period) -> None
Constructs with given tenor.
__init__(tenor: Period, h: QuantLib::Handle<QuantLib::YieldTermStructure>) -> None
Constructs with forwarding term structure handle.
__init__(tenor: Period, forwarding: QuantLib::Handle<QuantLib::YieldTermStructure>, discounting: QuantLib::Handle<QuantLib::YieldTermStructure>) -> None
Constructs with forwarding and discounting term structure handles.
__init__(tenor: Period, forwardingTermStructure: QuantLib::YieldTermStructure) -> None
Constructs with forwarding term structure.
__init__(tenor: Period, forwardingTermStructure: QuantLib::YieldTermStructure, discountingTermStructure: QuantLib::YieldTermStructure) -> None
Constructs with forwarding and discounting term structures.
UsdLiborSwapIsdaFixPm¶
- class pyquantlib.UsdLiborSwapIsdaFixPm¶
Bases:
SwapIndexUSD LIBOR swap rate (ISDA fix PM).
- __init__(*args, **kwargs)¶
Overloaded function.
__init__(tenor: Period) -> None
Constructs with given tenor.
__init__(tenor: Period, h: QuantLib::Handle<QuantLib::YieldTermStructure>) -> None
Constructs with forwarding term structure handle.
__init__(tenor: Period, forwarding: QuantLib::Handle<QuantLib::YieldTermStructure>, discounting: QuantLib::Handle<QuantLib::YieldTermStructure>) -> None
Constructs with forwarding and discounting term structure handles.
__init__(tenor: Period, forwardingTermStructure: QuantLib::YieldTermStructure) -> None
Constructs with forwarding term structure.
__init__(tenor: Period, forwardingTermStructure: QuantLib::YieldTermStructure, discountingTermStructure: QuantLib::YieldTermStructure) -> None
Constructs with forwarding and discounting term structures.
JpyLiborSwapIsdaFixAm¶
- class pyquantlib.JpyLiborSwapIsdaFixAm¶
Bases:
SwapIndexJPY LIBOR swap rate (ISDA fix AM).
- __init__(*args, **kwargs)¶
Overloaded function.
__init__(tenor: Period) -> None
Constructs with given tenor.
__init__(tenor: Period, h: QuantLib::Handle<QuantLib::YieldTermStructure>) -> None
Constructs with forwarding term structure handle.
__init__(tenor: Period, forwarding: QuantLib::Handle<QuantLib::YieldTermStructure>, discounting: QuantLib::Handle<QuantLib::YieldTermStructure>) -> None
Constructs with forwarding and discounting term structure handles.
__init__(tenor: Period, forwardingTermStructure: QuantLib::YieldTermStructure) -> None
Constructs with forwarding term structure.
__init__(tenor: Period, forwardingTermStructure: QuantLib::YieldTermStructure, discountingTermStructure: QuantLib::YieldTermStructure) -> None
Constructs with forwarding and discounting term structures.
JpyLiborSwapIsdaFixPm¶
- class pyquantlib.JpyLiborSwapIsdaFixPm¶
Bases:
SwapIndexJPY LIBOR swap rate (ISDA fix PM).
- __init__(*args, **kwargs)¶
Overloaded function.
__init__(tenor: Period) -> None
Constructs with given tenor.
__init__(tenor: Period, h: QuantLib::Handle<QuantLib::YieldTermStructure>) -> None
Constructs with forwarding term structure handle.
__init__(tenor: Period, forwarding: QuantLib::Handle<QuantLib::YieldTermStructure>, discounting: QuantLib::Handle<QuantLib::YieldTermStructure>) -> None
Constructs with forwarding and discounting term structure handles.
__init__(tenor: Period, forwardingTermStructure: QuantLib::YieldTermStructure) -> None
Constructs with forwarding term structure.
__init__(tenor: Period, forwardingTermStructure: QuantLib::YieldTermStructure, discountingTermStructure: QuantLib::YieldTermStructure) -> None
Constructs with forwarding and discounting term structures.
GbpLiborSwapIsdaFix¶
- class pyquantlib.GbpLiborSwapIsdaFix¶
Bases:
SwapIndexGBP LIBOR swap rate (ISDA fix).
- __init__(*args, **kwargs)¶
Overloaded function.
__init__(tenor: Period) -> None
Constructs with given tenor.
__init__(tenor: Period, h: QuantLib::Handle<QuantLib::YieldTermStructure>) -> None
Constructs with forwarding term structure handle.
__init__(tenor: Period, forwarding: QuantLib::Handle<QuantLib::YieldTermStructure>, discounting: QuantLib::Handle<QuantLib::YieldTermStructure>) -> None
Constructs with forwarding and discounting term structure handles.
__init__(tenor: Period, forwardingTermStructure: QuantLib::YieldTermStructure) -> None
Constructs with forwarding term structure.
__init__(tenor: Period, forwardingTermStructure: QuantLib::YieldTermStructure, discountingTermStructure: QuantLib::YieldTermStructure) -> None
Constructs with forwarding and discounting term structures.
ChfLiborSwapIsdaFix¶
- class pyquantlib.ChfLiborSwapIsdaFix¶
Bases:
SwapIndexCHF LIBOR swap rate (ISDA fix).
- __init__(*args, **kwargs)¶
Overloaded function.
__init__(tenor: Period) -> None
Constructs with given tenor.
__init__(tenor: Period, h: QuantLib::Handle<QuantLib::YieldTermStructure>) -> None
Constructs with forwarding term structure handle.
__init__(tenor: Period, forwarding: QuantLib::Handle<QuantLib::YieldTermStructure>, discounting: QuantLib::Handle<QuantLib::YieldTermStructure>) -> None
Constructs with forwarding and discounting term structure handles.
__init__(tenor: Period, forwardingTermStructure: QuantLib::YieldTermStructure) -> None
Constructs with forwarding term structure.
__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:
InterestRateIndexBond Market Association index (tax-exempt reference rate).
- __init__(*args, **kwargs)¶
Overloaded function.
__init__() -> None
Constructs a BMA index without a forwarding curve.
__init__(h: QuantLib::Handle<QuantLib::YieldTermStructure>) -> None
Constructs a BMA index from yield curve handle.
__init__(curve: QuantLib::YieldTermStructure) -> None
Constructs from yield curve (handle created internally).
- forwardingTermStructure() QuantLib::Handle<QuantLib::YieldTermStructure>¶
Returns the forwarding term structure handle.
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:
InterestRateIndexIndex 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.
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:
IndexBase class for equity indexes.
- __init__(*args, **kwargs)¶
Overloaded function.
__init__(name: str, fixingCalendar: Calendar, currency: Currency) -> None
Constructs an equity index without curves or spot.
__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.
__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.
- equityDividendCurve() QuantLib::Handle<QuantLib::YieldTermStructure>¶
Returns the dividend curve handle.
- equityInterestRateCurve() QuantLib::Handle<QuantLib::YieldTermStructure>¶
Returns the interest rate curve handle.
- 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¶
CustomRegion¶
region = ql.CustomRegion("Brazil", "BR")
print(region.name(), region.code())
Concrete Regions¶
Class |
Name |
Code |
|---|---|---|
|
Australia |
AU |
|
EU |
EU |
|
France |
FR |
|
UK |
UK |
|
USA |
US |
|
South Africa |
ZA |
us = ql.USRegion()
print(us.name(), us.code()) # "USA" "US"
Inflation Indexes¶
InflationIndex¶
- class pyquantlib.base.InflationIndex¶
Bases:
IndexAbstract base class for inflation indexes.
Base class for all inflation indexes. Provides familyName(), region(), revised(), frequency(), availabilityLag(), and currency().
CPI¶
- class pyquantlib.CPI¶
Bases:
pybind11_objectCPI interpolation methods and utilities.
- class InterpolationType¶
Bases:
pybind11_objectCPI 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:
InflationIndexZero-coupon inflation index.
- __init__(*args, **kwargs)¶
Overloaded function.
__init__(familyName: str, region: Region, revised: bool, frequency: Frequency, availabilityLag: Period, currency: Currency) -> None
Constructs a zero inflation index without a term structure.
__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.
__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.
- 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:
InflationIndexYear-on-year inflation index.
- __init__(*args, **kwargs)¶
Overloaded function.
__init__(underlyingIndex: ZeroInflationIndex) -> None
Constructs a year-on-year index as a ratio of a zero index.
__init__(underlyingIndex: ZeroInflationIndex, h: QuantLib::Handle<QuantLib::YoYInflationTermStructure>) -> None
Constructs a year-on-year index with term structure handle.
__init__(underlyingIndex: ZeroInflationIndex, yoyInflationTermStructure: QuantLib::YoYInflationTermStructure) -> None
Constructs a year-on-year index with term structure.
__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.
__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.
__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.
- 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:
ZeroInflationIndexUS Consumer Price Index.
- __init__(*args, **kwargs)¶
Overloaded function.
__init__() -> None
Constructs USCPI without a term structure.
__init__(h: QuantLib::Handle<QuantLib::ZeroInflationTermStructure>) -> None
Constructs USCPI with a term structure handle.
__init__(zeroInflationTermStructure: QuantLib::ZeroInflationTermStructure) -> None
Constructs USCPI with a term structure.
- class pyquantlib.YYUSCPI¶
Bases:
YoYInflationIndexYear-on-year US Consumer Price Index.
- __init__(*args, **kwargs)¶
Overloaded function.
__init__() -> None
Constructs YYUSCPI without a term structure.
__init__(h: QuantLib::Handle<QuantLib::YoYInflationTermStructure>) -> None
Constructs YYUSCPI with a term structure handle.
__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:
ZeroInflationIndexEU Harmonised Index of Consumer Prices.
- __init__(*args, **kwargs)¶
Overloaded function.
__init__() -> None
Constructs EUHICP without a term structure.
__init__(h: QuantLib::Handle<QuantLib::ZeroInflationTermStructure>) -> None
Constructs EUHICP with a term structure handle.
__init__(zeroInflationTermStructure: QuantLib::ZeroInflationTermStructure) -> None
Constructs EUHICP with a term structure.
- class pyquantlib.EUHICPXT¶
Bases:
ZeroInflationIndexEU HICP Excluding Tobacco.
- __init__(*args, **kwargs)¶
Overloaded function.
__init__() -> None
Constructs EUHICPXT without a term structure.
__init__(h: QuantLib::Handle<QuantLib::ZeroInflationTermStructure>) -> None
Constructs EUHICPXT with a term structure handle.
__init__(zeroInflationTermStructure: QuantLib::ZeroInflationTermStructure) -> None
Constructs EUHICPXT with a term structure.
- class pyquantlib.YYEUHICP¶
Bases:
YoYInflationIndexYear-on-year EU HICP.
- __init__(*args, **kwargs)¶
Overloaded function.
__init__() -> None
Constructs YYEUHICP without a term structure.
__init__(h: QuantLib::Handle<QuantLib::YoYInflationTermStructure>) -> None
Constructs YYEUHICP with a term structure handle.
__init__(yoyInflationTermStructure: QuantLib::YoYInflationTermStructure) -> None
Constructs YYEUHICP with a term structure.
- class pyquantlib.YYEUHICPXT¶
Bases:
YoYInflationIndexYear-on-year EU HICP Excluding Tobacco.
- __init__(*args, **kwargs)¶
Overloaded function.
__init__() -> None
Constructs YYEUHICPXT without a term structure.
__init__(h: QuantLib::Handle<QuantLib::YoYInflationTermStructure>) -> None
Constructs YYEUHICPXT with a term structure handle.
__init__(yoyInflationTermStructure: QuantLib::YoYInflationTermStructure) -> None
Constructs YYEUHICPXT with a term structure.
UK RPI¶
- class pyquantlib.UKRPI¶
Bases:
ZeroInflationIndexUK Retail Prices Index.
- __init__(*args, **kwargs)¶
Overloaded function.
__init__() -> None
Constructs UKRPI without a term structure.
__init__(h: QuantLib::Handle<QuantLib::ZeroInflationTermStructure>) -> None
Constructs UKRPI with a term structure handle.
__init__(zeroInflationTermStructure: QuantLib::ZeroInflationTermStructure) -> None
Constructs UKRPI with a term structure.
- class pyquantlib.YYUKRPI¶
Bases:
YoYInflationIndexYear-on-year UK Retail Prices Index.
- __init__(*args, **kwargs)¶
Overloaded function.
__init__() -> None
Constructs YYUKRPI without a term structure.
__init__(h: QuantLib::Handle<QuantLib::YoYInflationTermStructure>) -> None
Constructs YYUKRPI with a term structure handle.
__init__(yoyInflationTermStructure: QuantLib::YoYInflationTermStructure) -> None
Constructs YYUKRPI with a term structure.
Australian CPI¶
- class pyquantlib.AUCPI¶
Bases:
ZeroInflationIndexAustralian Consumer Price Index.
- __init__(*args, **kwargs)¶
Overloaded function.
__init__(frequency: Frequency, revised: bool) -> None
Constructs AUCPI without a term structure.
__init__(frequency: Frequency, revised: bool, h: QuantLib::Handle<QuantLib::ZeroInflationTermStructure>) -> None
Constructs AUCPI with a term structure handle.
__init__(frequency: Frequency, revised: bool, zeroInflationTermStructure: QuantLib::ZeroInflationTermStructure) -> None
Constructs AUCPI with a term structure.
- class pyquantlib.YYAUCPI¶
Bases:
YoYInflationIndexYear-on-year Australian Consumer Price Index.
- __init__(*args, **kwargs)¶
Overloaded function.
__init__(frequency: Frequency, revised: bool) -> None
Constructs YYAUCPI without a term structure.
__init__(frequency: Frequency, revised: bool, h: QuantLib::Handle<QuantLib::YoYInflationTermStructure>) -> None
Constructs YYAUCPI with a term structure handle.
__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:
ZeroInflationIndexFrench Harmonised Index of Consumer Prices.
- __init__(*args, **kwargs)¶
Overloaded function.
__init__() -> None
Constructs FRHICP without a term structure.
__init__(h: QuantLib::Handle<QuantLib::ZeroInflationTermStructure>) -> None
Constructs FRHICP with a term structure handle.
__init__(zeroInflationTermStructure: QuantLib::ZeroInflationTermStructure) -> None
Constructs FRHICP with a term structure.
- class pyquantlib.YYFRHICP¶
Bases:
YoYInflationIndexYear-on-year French HICP.
- __init__(*args, **kwargs)¶
Overloaded function.
__init__() -> None
Constructs YYFRHICP without a term structure.
__init__(h: QuantLib::Handle<QuantLib::YoYInflationTermStructure>) -> None
Constructs YYFRHICP with a term structure handle.
__init__(yoyInflationTermStructure: QuantLib::YoYInflationTermStructure) -> None
Constructs YYFRHICP with a term structure.
South African CPI¶
- class pyquantlib.ZACPI¶
Bases:
ZeroInflationIndexSouth African Consumer Price Index.
- __init__(*args, **kwargs)¶
Overloaded function.
__init__() -> None
Constructs ZACPI without a term structure.
__init__(h: QuantLib::Handle<QuantLib::ZeroInflationTermStructure>) -> None
Constructs ZACPI with a term structure handle.
__init__(zeroInflationTermStructure: QuantLib::ZeroInflationTermStructure) -> None
Constructs ZACPI with a term structure.
- class pyquantlib.YYZACPI¶
Bases:
YoYInflationIndexYear-on-year South African Consumer Price Index.
- __init__(*args, **kwargs)¶
Overloaded function.
__init__() -> None
Constructs YYZACPI without a term structure.
__init__(h: QuantLib::Handle<QuantLib::YoYInflationTermStructure>) -> None
Constructs YYZACPI with a term structure handle.
__init__(yoyInflationTermStructure: QuantLib::YoYInflationTermStructure) -> None
Constructs YYZACPI with a term structure.