QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
List of all members
YoYInflationIndex Class Reference

Base class for year-on-year inflation indices. More...

#include <inflationindex.hpp>

+ Inheritance diagram for YoYInflationIndex:
+ Collaboration diagram for YoYInflationIndex:

Public Member Functions

Constructors
 YoYInflationIndex (const ext::shared_ptr< ZeroInflationIndex > &underlyingIndex, bool interpolated, Handle< YoYInflationTermStructure > ts={})
 Constructor for year-on-year indices defined as a ratio. More...
 
 YoYInflationIndex (const std::string &familyName, const Region &region, bool revised, bool interpolated, Frequency frequency, const Period &availabilityLag, const Currency &currency, Handle< YoYInflationTermStructure > ts={})
 Constructor for quoted year-on-year indices. More...
 
QL_DEPRECATED YoYInflationIndex (const std::string &familyName, const Region &region, bool revised, bool interpolated, bool ratio, Frequency frequency, const Period &availabilityLag, const Currency &currency, Handle< YoYInflationTermStructure > ts={})
 Old generic constructor for year-on-year indices. More...
 
Index interface
Rate fixing (const Date &fixingDate, bool forecastTodaysFixing=false) const override
 
- Public Member Functions inherited from InflationIndex
 InflationIndex (std::string familyName, Region region, bool revised, Frequency frequency, const Period &availabilitiyLag, Currency currency)
 
std::string name () const override
 Returns the name of the index. More...
 
Calendar fixingCalendar () const override
 
bool isValidFixingDate (const Date &) const override
 returns TRUE if the fixing date is a valid one More...
 
void addFixing (const Date &fixingDate, Rate fixing, bool forceOverwrite=false) override
 
void update () override
 
std::string familyName () const
 
Region region () const
 
bool revised () const
 
Frequency frequency () const
 
Period availabilityLag () const
 
Currency currency () const
 
- Public Member Functions inherited from Index
 ~Index () override=default
 
virtual std::string name () const =0
 Returns the name of the index. More...
 
virtual Calendar fixingCalendar () const =0
 returns the calendar defining valid fixing dates More...
 
virtual bool isValidFixingDate (const Date &fixingDate) const =0
 returns TRUE if the fixing date is a valid one More...
 
bool hasHistoricalFixing (const Date &fixingDate) const
 returns whether a historical fixing was stored for the given date More...
 
virtual Real fixing (const Date &fixingDate, bool forecastTodaysFixing=false) const =0
 returns the fixing at the given date More...
 
const TimeSeries< Real > & timeSeries () const
 returns the fixing TimeSeries More...
 
virtual bool allowsNativeFixings ()
 check if index allows for native fixings. More...
 
virtual void addFixing (const Date &fixingDate, Real fixing, bool forceOverwrite=false)
 stores the historical fixing at the given date More...
 
void addFixings (const TimeSeries< Real > &t, bool forceOverwrite=false)
 stores historical fixings from a TimeSeries More...
 
template<class DateIterator , class ValueIterator >
void addFixings (DateIterator dBegin, DateIterator dEnd, ValueIterator vBegin, bool forceOverwrite=false)
 stores historical fixings at the given dates More...
 
void clearFixings ()
 clears all stored historical fixings More...
 
- Public Member Functions inherited from Observable
 Observable ()
 
 Observable (const Observable &)
 
Observableoperator= (const Observable &)
 
 Observable (Observable &&)=delete
 
Observableoperator= (Observable &&)=delete
 
virtual ~Observable ()=default
 
void notifyObservers ()
 
- Public Member Functions inherited from Observer
 Observer ()=default
 
 Observer (const Observer &)
 
Observeroperator= (const Observer &)
 
virtual ~Observer ()
 
std::pair< iterator, boolregisterWith (const ext::shared_ptr< Observable > &)
 
void registerWithObservables (const ext::shared_ptr< Observer > &)
 
Size unregisterWith (const ext::shared_ptr< Observable > &)
 
void unregisterWithAll ()
 
virtual void update ()=0
 
virtual void deepUpdate ()
 

Other methods

bool interpolated_
 
bool ratio_
 
ext::shared_ptr< ZeroInflationIndexunderlyingIndex_
 
Handle< YoYInflationTermStructureyoyInflation_
 
bool interpolated () const
 
bool ratio () const
 
ext::shared_ptr< ZeroInflationIndexunderlyingIndex () const
 
Handle< YoYInflationTermStructureyoyInflationTermStructure () const
 
ext::shared_ptr< YoYInflationIndexclone (const Handle< YoYInflationTermStructure > &h) const
 
Rate forecastFixing (const Date &fixingDate) const
 

Additional Inherited Members

- Public Types inherited from Observer
typedef set_type::iterator iterator
 
- Protected Attributes inherited from InflationIndex
Date referenceDate_
 
std::string familyName_
 
Region region_
 
bool revised_
 
Frequency frequency_
 
Period availabilityLag_
 
Currency currency_
 

Detailed Description

Base class for year-on-year inflation indices.

These may be quoted indices published on, say, Bloomberg, or can be defined as the ratio of an index at different time points.

Definition at line 185 of file inflationindex.hpp.

Constructor & Destructor Documentation

◆ YoYInflationIndex() [1/3]

YoYInflationIndex ( const ext::shared_ptr< ZeroInflationIndex > &  underlyingIndex,
bool  interpolated,
Handle< YoYInflationTermStructure ts = {} 
)

Constructor for year-on-year indices defined as a ratio.

An index build with this constructor doesn't need to store past fixings of its own; they will be calculated as a ratio from the past fixings stored in the underlying index.

Definition at line 195 of file inflationindex.cpp.

+ Here is the call graph for this function:

◆ YoYInflationIndex() [2/3]

QL_DEPRECATED_DISABLE_WARNING YoYInflationIndex ( const std::string &  familyName,
const Region region,
bool  revised,
bool  interpolated,
Frequency  frequency,
const Period availabilityLag,
const Currency currency,
Handle< YoYInflationTermStructure ts = {} 
)

Constructor for quoted year-on-year indices.

An index built with this constructor needs its past fixings (i.e., the past year-on-year values) to be stored via the addFixing or addFixings method.

Definition at line 209 of file inflationindex.cpp.

◆ YoYInflationIndex() [3/3]

QL_DEPRECATED_ENABLE_WARNING YoYInflationIndex ( const std::string &  familyName,
const Region region,
bool  revised,
bool  interpolated,
bool  ratio,
Frequency  frequency,
const Period availabilityLag,
const Currency currency,
Handle< YoYInflationTermStructure ts = {} 
)

Old generic constructor for year-on-year indices.

An index built with this constructor needs its past fixings to be stored via the addFixing or addFixings method. Care must be taken about what to store: if ratio is false, the stored values must be the year-on-year values; if ratio is true, they must be the past fixings of the underlying index.

Deprecated:
Use one of the other constructors instead. Deprecated in version 1.31.

Definition at line 222 of file inflationindex.cpp.

+ Here is the call graph for this function:

Member Function Documentation

◆ fixing()

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

Implements InflationIndex.

Definition at line 240 of file inflationindex.cpp.

+ Here is the call graph for this function:

◆ interpolated()

bool interpolated ( ) const

Definition at line 323 of file inflationindex.hpp.

+ Here is the caller graph for this function:

◆ ratio()

bool ratio ( ) const

Definition at line 327 of file inflationindex.hpp.

+ Here is the caller graph for this function:

◆ underlyingIndex()

ext::shared_ptr< ZeroInflationIndex > underlyingIndex ( ) const

Definition at line 331 of file inflationindex.hpp.

◆ yoyInflationTermStructure()

Handle< YoYInflationTermStructure > yoyInflationTermStructure ( ) const

Definition at line 336 of file inflationindex.hpp.

◆ clone()

ext::shared_ptr< YoYInflationIndex > clone ( const Handle< YoYInflationTermStructure > &  h) const

Definition at line 316 of file inflationindex.cpp.

◆ forecastFixing()

Real forecastFixing ( const Date fixingDate) const
private

Definition at line 302 of file inflationindex.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ interpolated_

bool interpolated_
protected

Definition at line 259 of file inflationindex.hpp.

◆ ratio_

bool ratio_
private

Definition at line 263 of file inflationindex.hpp.

◆ underlyingIndex_

ext::shared_ptr<ZeroInflationIndex> underlyingIndex_
private

Definition at line 264 of file inflationindex.hpp.

◆ yoyInflation_

Handle<YoYInflationTermStructure> yoyInflation_
private

Definition at line 265 of file inflationindex.hpp.