QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | List of all members
Index Class Referenceabstract

purely virtual base class for indexes More...

#include <ql/index.hpp>

+ Inheritance diagram for Index:
+ Collaboration diagram for Index:

Public Member Functions

 ~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 ()
 

Private Member Functions

void checkNativeFixingsAllowed ()
 check if index allows for native fixings More...
 

Detailed Description

purely virtual base class for indexes

Warning:
this class performs no check that the provided/requested fixings are for dates in the past, i.e. for dates less than or equal to the evaluation date. It is up to the client code to take care of possible inconsistencies due to "seeing in the future"

Definition at line 44 of file index.hpp.

Constructor & Destructor Documentation

◆ ~Index()

~Index ( )
overridedefault

Member Function Documentation

◆ name()

virtual std::string name ( ) const
pure virtual

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.

Implemented in EquityIndex, InflationIndex, and InterestRateIndex.

+ Here is the caller graph for this function:

◆ fixingCalendar()

virtual Calendar fixingCalendar ( ) const
pure virtual

returns the calendar defining valid fixing dates

Implemented in EquityIndex, InflationIndex, and InterestRateIndex.

◆ isValidFixingDate()

virtual bool isValidFixingDate ( const Date fixingDate) const
pure virtual

returns TRUE if the fixing date is a valid one

Implemented in InflationIndex, BMAIndex, EquityIndex, and InterestRateIndex.

+ Here is the caller graph for this function:

◆ hasHistoricalFixing()

bool hasHistoricalFixing ( const Date fixingDate) const

returns whether a historical fixing was stored for the given date

Definition at line 138 of file index.hpp.

+ Here is the call graph for this function:

◆ fixing()

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

returns the fixing at the given date

the date passed as arguments must be the actual calendar date of the fixing; no settlement days must be used.

Implemented in EquityIndex, ZeroInflationIndex, YoYInflationIndex, InterestRateIndex, and InflationIndex.

+ Here is the caller graph for this function:

◆ timeSeries()

const TimeSeries< Real > & timeSeries ( ) const

returns the fixing TimeSeries

Definition at line 65 of file index.hpp.

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

◆ allowsNativeFixings()

virtual bool allowsNativeFixings ( )
virtual

check if index allows for native fixings.

If this returns false, calls to addFixing and similar methods will raise an exception.

Reimplemented in SwapSpreadIndex.

Definition at line 72 of file index.hpp.

+ Here is the caller graph for this function:

◆ addFixing()

void addFixing ( const Date fixingDate,
Real  fixing,
bool  forceOverwrite = false 
)
virtual

stores the historical fixing at the given date

the date passed as arguments must be the actual calendar date of the fixing; no settlement days must be used.

Reimplemented in InflationIndex.

Definition at line 24 of file index.cpp.

+ Here is the call graph for this function:

◆ addFixings() [1/2]

void addFixings ( const TimeSeries< Real > &  t,
bool  forceOverwrite = false 
)

stores historical fixings from a TimeSeries

the dates in the TimeSeries must be the actual calendar dates of the fixings; no settlement days must be used.

Definition at line 33 of file index.cpp.

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

◆ addFixings() [2/2]

void addFixings ( DateIterator  dBegin,
DateIterator  dEnd,
ValueIterator  vBegin,
bool  forceOverwrite = false 
)

stores historical fixings at the given dates

the dates passed as arguments must be the actual calendar dates of the fixings; no settlement days must be used.

Definition at line 88 of file index.hpp.

+ Here is the call graph for this function:

◆ clearFixings()

void clearFixings ( )

clears all stored historical fixings

Definition at line 45 of file index.cpp.

+ Here is the call graph for this function:

◆ checkNativeFixingsAllowed()

void checkNativeFixingsAllowed ( )
private

check if index allows for native fixings

Definition at line 50 of file index.cpp.

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