Logo
Reference manual - version qle_version
inflation.hpp File Reference

some inflation related utilities. More...

#include <ql/indexes/inflationindex.hpp>
#include <ql/instruments/bond.hpp>
#include <ql/termstructures/inflation/inflationhelpers.hpp>
#include <ql/termstructures/inflationtermstructure.hpp>
#include <ql/termstructures/volatility/inflation/cpivolatilitystructure.hpp>
#include <ql/time/period.hpp>

Functions

QuantLib::Time inflationTime (const QuantLib::Date &date, const QuantLib::ext::shared_ptr< QuantLib::InflationTermStructure > &inflationTs, bool indexIsInterpolated, const QuantLib::DayCounter &dayCounter=QuantLib::DayCounter())
QuantLib::Real inflationGrowth (const QuantLib::Handle< QuantLib::ZeroInflationTermStructure > &ts, QuantLib::Time t, const QuantLib::DayCounter &dc, bool indexIsInterpolated)
QuantLib::Real inflationGrowth (const QuantLib::Handle< QuantLib::ZeroInflationTermStructure > &ts, QuantLib::Time t, bool indexIsInterpolated)
QuantLib::Real inflationLinkedBondQuoteFactor (const QuantLib::ext::shared_ptr< QuantLib::Bond > &bond)
std::map< std::tuple< std::string, QuantLib::CPI::InterpolationType, QuantLib::Frequency, QuantLib::Period >, QuantLib::ext::shared_ptr< QuantLib::ZeroInflationIndex > > extractAllInflationUnderlyingFromBond (const QuantLib::ext::shared_ptr< QuantLib::Bond > &bond)
QuantLib::Date lastAvailableFixing (const QuantLib::InflationIndex &index, const QuantLib::Date &asof)
 Check if today - availabilityLag is already known, otherwise return the fixingDate of the previous fixing.
QuantLib::Rate cpiFixing (const QuantLib::ext::shared_ptr< QuantLib::ZeroInflationIndex > &index, const QuantLib::Date &maturity, const QuantLib::Period &obsLag, bool interpolated)
 Computes a CPI fixing giving an zeroIndex, with interpolation if needed.
QuantLib::Date curveBaseDate (const bool baseDateLastKnownFixing, const QuantLib::Date &refDate, const QuantLib::Period obsLagCurve, const QuantLib::Frequency curveFreq, const QuantLib::ext::shared_ptr< QuantLib::InflationIndex > &index)
 derives the zero inflation curve base date based on the useLastKnownFixing rule
QuantLib::Date fixingDate (const QuantLib::Date &d, const QuantLib::Period obsLag, const QuantLib::Frequency, bool interpolated)
QuantLib::Rate guessCurveBaseRate (const bool baseDateLastKnownFixing, const QuantLib::Date &swapStart, const QuantLib::Date &asof, const QuantLib::Period &swapTenor, const QuantLib::DayCounter &swapZCLegDayCounter, const QuantLib::Period &swapObsLag, const QuantLib::Rate zeroCouponRate, const QuantLib::Period &curveObsLag, const QuantLib::DayCounter &curveDayCounter, const QuantLib::ext::shared_ptr< QuantLib::ZeroInflationIndex > &index, const bool interpolated, const QuantLib::ext::shared_ptr< QuantLib::Seasonality > &seasonality=nullptr)
bool isCPIVolSurfaceLogNormal (const QuantLib::ext::shared_ptr< QuantLib::CPIVolatilitySurface > &surface)

Detailed Description

some inflation related utilities.

Function Documentation

◆ inflationTime()

QuantLib::Time inflationTime ( const QuantLib::Date & date,
const QuantLib::ext::shared_ptr< QuantLib::InflationTermStructure > & inflationTs,
bool indexIsInterpolated,
const QuantLib::DayCounter & dayCounter = QuantLib::DayCounter() )

Utility function for calculating the time to a given date based on a given inflation index, inflationIndex, and a given inflation term structure, inflationTs. An optional dayCounter can be provided to use instead of the inflation term structure day counter.

◆ inflationGrowth() [1/2]

QuantLib::Real inflationGrowth ( const QuantLib::Handle< QuantLib::ZeroInflationTermStructure > & ts,
QuantLib::Time t,
const QuantLib::DayCounter & dc,
bool indexIsInterpolated )

Utility for calculating the ratio \( \frac{P_r(0, t)}{P_n(0, t)} \) where \( P_r(0, t) \) is the real zero coupon bond price at time zero for maturity \( t \) and \( P_n(0, t) \) is the nominal zero coupon bond price.

◆ inflationGrowth() [2/2]

QuantLib::Real inflationGrowth ( const QuantLib::Handle< QuantLib::ZeroInflationTermStructure > & ts,
QuantLib::Time t,
bool indexIsInterpolated )

Utility for calculating the ratio \( \frac{P_r(0, t)}{P_n(0, t)} \) where \( P_r(0, t) \) is the real zero coupon bond price at time zero for maturity \( t \) and \( P_n(0, t) \) is the nominal zero coupon bond price.

◆ inflationLinkedBondQuoteFactor()

QuantLib::Real inflationLinkedBondQuoteFactor ( const QuantLib::ext::shared_ptr< QuantLib::Bond > & bond)

Calculate the Compound Factor to compute the nominal price from the real price I(t_s)/I(t_0) with I(t_s) the CPI at settlement date and I(t_0) the bond's base CPI

◆ extractAllInflationUnderlyingFromBond()

std::map< std::tuple< std::string, QuantLib::CPI::InterpolationType, QuantLib::Frequency, QuantLib::Period >, QuantLib::ext::shared_ptr< QuantLib::ZeroInflationIndex > > extractAllInflationUnderlyingFromBond ( const QuantLib::ext::shared_ptr< QuantLib::Bond > & bond)

Iterates over all bond cashflows, and extract all inflation underlyings

◆ fixingDate()

QuantLib::Date fixingDate ( const QuantLib::Date & d,
const QuantLib::Period obsLag,
const QuantLib::Frequency ,
bool interpolated )

computes the fixingDate for ZC CPI Swap following the rule for an interpolated index it is d - obsLag but for an interpolated index the fixing date is per definition on the start of the inflation period in which d - obsLag falls

◆ guessCurveBaseRate()

QuantLib::Rate guessCurveBaseRate ( const bool baseDateLastKnownFixing,
const QuantLib::Date & swapStart,
const QuantLib::Date & asof,
const QuantLib::Period & swapTenor,
const QuantLib::DayCounter & swapZCLegDayCounter,
const QuantLib::Period & swapObsLag,
const QuantLib::Rate zeroCouponRate,
const QuantLib::Period & curveObsLag,
const QuantLib::DayCounter & curveDayCounter,
const QuantLib::ext::shared_ptr< QuantLib::ZeroInflationIndex > & index,
const bool interpolated,
const QuantLib::ext::shared_ptr< QuantLib::Seasonality > & seasonality = nullptr )

Computes the base rate for curve construction so that zero inflation rate is constant up to the first pillar Accounts for the acctual accrued inflation between the ZCIIS base date and the curve base date (e.g. last published fixing date) If curve base date and ZCIIS are the same, then the base rate is the ZCIIS rate

◆ isCPIVolSurfaceLogNormal()

bool isCPIVolSurfaceLogNormal ( const QuantLib::ext::shared_ptr< QuantLib::CPIVolatilitySurface > & surface)

checks if the vols are normal or lognormal if the volsurface is not derived from QuantExt::CPIVolatilitySurface we default to lognormal vols