QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.38
Loading...
Searching...
No Matches
Public Member Functions | List of all members
InflationIndex Class Referenceabstract

Base class for inflation-rate indexes,. More...

#include <inflationindex.hpp>

+ Inheritance diagram for InflationIndex:
+ Collaboration diagram for InflationIndex:

Public Member Functions

 InflationIndex (std::string familyName, Region region, bool revised, Frequency frequency, const Period &availabilitiyLag, Currency currency)
 
Index interface
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...
 
Real fixing (const Date &fixingDate, bool forecastTodaysFixing=false) const override=0
 
Real pastFixing (const Date &fixingDate) const override=0
 returns a past fixing at the given date More...
 
void addFixing (const Date &fixingDate, Rate fixing, bool forceOverwrite=false) override
 
- 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...
 
virtual Real pastFixing (const Date &fixingDate) const
 returns a past 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...
 
void update () override
 
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 ()=default
 
 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 ()
 

Inspectors

Date referenceDate_
 
std::string familyName_
 
Region region_
 
bool revised_
 
Frequency frequency_
 
Period availabilityLag_
 
Currency currency_
 
std::string name_
 
std::string familyName () const
 
Region region () const
 
bool revised () const
 
Frequency frequency () const
 
Period availabilityLag () const
 
Currency currency () const
 

Additional Inherited Members

- Public Types inherited from Observer
typedef set_type::iterator iterator
 
- Protected Member Functions inherited from Index
ext::shared_ptr< Observablenotifier () const
 

Detailed Description

Base class for inflation-rate indexes,.

Definition at line 84 of file inflationindex.hpp.

Constructor & Destructor Documentation

◆ InflationIndex()

InflationIndex ( std::string  familyName,
Region  region,
bool  revised,
Frequency  frequency,
const Period availabilitiyLag,
Currency  currency 
)

Definition at line 119 of file inflationindex.cpp.

+ Here is the call graph for this function:

Member Function Documentation

◆ name()

std::string name ( ) const
overridevirtual

Returns the name of the index.

Warning:
This method is used for output and comparison between indexes. It is not meant to be used for writing switch-on-type code.

Implements Index.

Definition at line 295 of file inflationindex.hpp.

+ Here is the caller graph for this function:

◆ fixingCalendar()

Calendar fixingCalendar ( ) const
overridevirtual

Inflation indices are not associated to a particular day, but to months or quarters. Therefore, they do not have fixing calendars. Since we're forced by the base Index interface to add one, this method returns a NullCalendar instance.

Implements Index.

Definition at line 132 of file inflationindex.cpp.

◆ isValidFixingDate()

bool isValidFixingDate ( const Date fixingDate) const
overridevirtual

returns TRUE if the fixing date is a valid one

Implements Index.

Definition at line 104 of file inflationindex.hpp.

◆ fixing()

Real fixing ( const Date fixingDate,
bool  forecastTodaysFixing = false 
) const
overridepure virtual

Forecasting index values requires an inflation term structure, with a base date that is earlier than its asof date. This must be so because indices are available only with a lag. Usually, it makes sense for the base date to be the first day of the month of the last published fixing.

Implements Index.

Implemented in ZeroInflationIndex, and YoYInflationIndex.

+ Here is the caller graph for this function:

◆ pastFixing()

Real pastFixing ( const Date fixingDate) const
overridepure virtual

returns a past fixing at the given date

Reimplemented from Index.

Implemented in ZeroInflationIndex, and YoYInflationIndex.

◆ addFixing()

void addFixing ( const Date fixingDate,
Rate  fixing,
bool  forceOverwrite = false 
)
overridevirtual

Reimplemented from Index.

Definition at line 137 of file inflationindex.cpp.

+ Here is the call graph for this function:

◆ familyName()

std::string familyName ( ) const

Definition at line 299 of file inflationindex.hpp.

◆ region()

Region region ( ) const

Definition at line 303 of file inflationindex.hpp.

◆ revised()

bool revised ( ) const

Definition at line 307 of file inflationindex.hpp.

◆ frequency()

Frequency frequency ( ) const

Definition at line 311 of file inflationindex.hpp.

◆ availabilityLag()

Period availabilityLag ( ) const

The availability lag describes when the index might be available; for instance, the inflation value for January may only be available in April. This doesn't mean that that inflation value is considered as the April fixing; it remains the January fixing, independently of the lag in availability.

Definition at line 315 of file inflationindex.hpp.

◆ currency()

Currency currency ( ) const

Definition at line 319 of file inflationindex.hpp.

Member Data Documentation

◆ referenceDate_

Date referenceDate_
protected

Definition at line 139 of file inflationindex.hpp.

◆ familyName_

std::string familyName_
protected

Definition at line 140 of file inflationindex.hpp.

◆ region_

Region region_
protected

Definition at line 141 of file inflationindex.hpp.

◆ revised_

bool revised_
protected

Definition at line 142 of file inflationindex.hpp.

◆ frequency_

Frequency frequency_
protected

Definition at line 143 of file inflationindex.hpp.

◆ availabilityLag_

Period availabilityLag_
protected

Definition at line 144 of file inflationindex.hpp.

◆ currency_

Currency currency_
protected

Definition at line 145 of file inflationindex.hpp.

◆ name_

std::string name_
private

Definition at line 148 of file inflationindex.hpp.