Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
YoYInflationIndexWrapper Class Reference

Wrapper that creates a yoy from a zc index. More...

#include <qle/indexes/inflationindexwrapper.hpp>

+ Inheritance diagram for YoYInflationIndexWrapper:
+ Collaboration diagram for YoYInflationIndexWrapper:

Public Member Functions

 YoYInflationIndexWrapper (const QuantLib::ext::shared_ptr< ZeroInflationIndex > zeroIndex, const bool interpolated, const Handle< YoYInflationTermStructure > &ts=Handle< YoYInflationTermStructure >())
 
Rate fixing (const Date &fixingDate, bool forecastTodaysFixing=false) const override
 
const QuantLib::ext::shared_ptr< ZeroInflationIndex > zeroIndex () const
 

Private Member Functions

Rate forecastFixing (const Date &fixingDate) const
 

Private Attributes

const QuantLib::ext::shared_ptr< ZeroInflationIndex > zeroIndex_
 

Detailed Description

Wrapper that creates a yoy from a zc index.

This creates a "ratio" - type YoYInflationIndex with the same family name as the zero index so that historical fixings can be reused. If a yoy ts is given, this is used to forecast fixings. If the ts is not given, the forecast falls back on the zero index, i.e. if the zero index has a curve attached a plain yoy rate without convexity adjustment is estimated using this index. The interpolation follows

Definition at line 67 of file inflationindexwrapper.hpp.

Constructor & Destructor Documentation

◆ YoYInflationIndexWrapper()

YoYInflationIndexWrapper ( const QuantLib::ext::shared_ptr< ZeroInflationIndex >  zeroIndex,
const bool  interpolated,
const Handle< YoYInflationTermStructure > &  ts = Handle<YoYInflationTermStructure>() 
)

Definition at line 64 of file inflationindexwrapper.cpp.

66 : YoYInflationIndex(zeroIndex, interpolated, ts),
68 registerWith(zeroIndex_);
69}
const QuantLib::ext::shared_ptr< ZeroInflationIndex > zeroIndex_
const QuantLib::ext::shared_ptr< ZeroInflationIndex > zeroIndex() const

Member Function Documentation

◆ fixing()

Rate fixing ( const Date &  fixingDate,
bool  forecastTodaysFixing = false 
) const
override
Warning:
the forecastTodaysFixing parameter (required by the Index interface) is currently ignored.

Definition at line 71 of file inflationindexwrapper.cpp.

71 {
72
73 // duplicated logic from YoYInflationIndex, this would not be necessary, if forecastFixing
74 // was defined virtual in InflationIndex
75 if (needsForecast(fixingDate)) {
76 return forecastFixing(fixingDate);
77 }
78 // historical fixing
79 return YoYInflationIndex::fixing(fixingDate);
80}
Rate forecastFixing(const Date &fixingDate) const
+ Here is the call graph for this function:

◆ zeroIndex()

const QuantLib::ext::shared_ptr< ZeroInflationIndex > zeroIndex ( ) const

Definition at line 73 of file inflationindexwrapper.hpp.

73{ return zeroIndex_; }

◆ forecastFixing()

Real forecastFixing ( const Date &  fixingDate) const
private

Definition at line 82 of file inflationindexwrapper.cpp.

82 {
83 if (!yoyInflationTermStructure().empty())
84 return YoYInflationIndex::fixing(fixingDate);
85 auto interpolation = YoYInflationIndex::interpolated() ? CPI::Linear : CPI::Flat;
86 Real f1 = CPI::laggedFixing(zeroIndex_, fixingDate, 0 * Days, interpolation);
87 Real f0 = CPI::laggedFixing(zeroIndex_, fixingDate - 1 * Years, 0 * Days, interpolation);
88 return (f1 - f0) / f0;
89}
+ Here is the caller graph for this function:

Member Data Documentation

◆ zeroIndex_

const QuantLib::ext::shared_ptr<ZeroInflationIndex> zeroIndex_
private

Definition at line 77 of file inflationindexwrapper.hpp.