QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.38
|
Base class for equity indexes. More...
#include <equityindex.hpp>
Public Member Functions | |
EquityIndex (std::string name, Calendar fixingCalendar, Currency currency, Handle< YieldTermStructure > interest={}, Handle< YieldTermStructure > dividend={}, Handle< Quote > spot={}) | |
EquityIndex (std::string name, Calendar fixingCalendar, Handle< YieldTermStructure > interest={}, Handle< YieldTermStructure > dividend={}, Handle< Quote > spot={}) | |
Index interface | |
std::string | name () const override |
Returns the name of the index. More... | |
Calendar | fixingCalendar () const override |
returns the calendar defining valid fixing dates More... | |
bool | isValidFixingDate (const Date &fixingDate) const override |
returns TRUE if the fixing date is a valid one More... | |
Real | fixing (const Date &fixingDate, bool forecastTodaysFixing=false) const override |
returns the fixing at the given date More... | |
Inspectors | |
Currency | currency () const |
The index currency. More... | |
Handle< YieldTermStructure > | equityInterestRateCurve () const |
the rate curve used to forecast fixings More... | |
Handle< YieldTermStructure > | equityDividendCurve () const |
the dividend curve used to forecast fixings More... | |
Handle< Quote > | spot () const |
index spot value More... | |
Fixing calculations | |
virtual Real | forecastFixing (const Date &fixingDate) const |
It can be overridden to implement particular conventions. More... | |
![]() | |
~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 |
virtual void | addFixing (const Date &fixingDate, Real fixing, bool forceOverwrite=false) |
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... | |
![]() | |
Observable ()=default | |
Observable (const Observable &) | |
Observable & | operator= (const Observable &) |
Observable (Observable &&)=delete | |
Observable & | operator= (Observable &&)=delete |
virtual | ~Observable ()=default |
void | notifyObservers () |
![]() | |
Observer ()=default | |
Observer (const Observer &) | |
Observer & | operator= (const Observer &) |
virtual | ~Observer () |
std::pair< iterator, bool > | registerWith (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 | |
std::string | name_ |
Calendar | fixingCalendar_ |
Currency | currency_ |
Handle< YieldTermStructure > | interest_ |
Handle< YieldTermStructure > | dividend_ |
Handle< Quote > | spot_ |
virtual ext::shared_ptr< EquityIndex > | clone (const Handle< YieldTermStructure > &interest, const Handle< YieldTermStructure > ÷nd, const Handle< Quote > &spot) const |
Additional Inherited Members | |
![]() | |
typedef set_type::iterator | iterator |
![]() | |
ext::shared_ptr< Observable > | notifier () const |
Base class for equity indexes.
The equity index object allows to retrieve past fixings, as well as project future fixings using either both the risk free interest rate term structure and the dividend term structure, or just the interest rate term structure in which case one can provide a term structure of equity forwards implied from, e.g. option prices.
In case of the first method, the forward is calculated as:
\[ I(t, T) = I(t, t) \frac{P_{D}(t, T)}{P_{R}(t, T)}, \]
where \( I(t, t) \) is today's value of the index, \( P_{D}(t, T) \) is a discount factor of the dividend curve at future time \( T \), and \( P_{R}(t, T) \) is a discount factor of the risk free curve at future time \( T \).
In case of the latter method, the forward is calculated as:
\[ I(t, T) = I(t, t) \frac{1}{P_{F}(t, T)}, \]
where \( P_{F}(t, T) \) is a discount factor of the equity forward term structure.
To forecast future fixings, the user can either provide a handle to the current index spot. If spot handle is empty, today's fixing will be used, instead.
Definition at line 63 of file equityindex.hpp.
EquityIndex | ( | std::string | name, |
Calendar | fixingCalendar, | ||
Currency | currency, | ||
Handle< YieldTermStructure > | interest = {} , |
||
Handle< YieldTermStructure > | dividend = {} , |
||
Handle< Quote > | spot = {} |
||
) |
EquityIndex | ( | std::string | name, |
Calendar | fixingCalendar, | ||
Handle< YieldTermStructure > | interest = {} , |
||
Handle< YieldTermStructure > | dividend = {} , |
||
Handle< Quote > | spot = {} |
||
) |
Definition at line 34 of file equityindex.cpp.
|
overridevirtual |
Returns the name of the index.
Implements Index.
Definition at line 84 of file equityindex.hpp.
|
overridevirtual |
returns the calendar defining valid fixing dates
Implements Index.
Definition at line 85 of file equityindex.hpp.
returns TRUE if the fixing date is a valid one
Implements Index.
Definition at line 122 of file equityindex.hpp.
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.
Implements Index.
Definition at line 63 of file equityindex.cpp.
Currency currency | ( | ) | const |
The index currency.
Definition at line 92 of file equityindex.hpp.
Handle< YieldTermStructure > equityInterestRateCurve | ( | ) | const |
the rate curve used to forecast fixings
Definition at line 94 of file equityindex.hpp.
Handle< YieldTermStructure > equityDividendCurve | ( | ) | const |
the dividend curve used to forecast fixings
Definition at line 96 of file equityindex.hpp.
index spot value
Definition at line 98 of file equityindex.hpp.
It can be overridden to implement particular conventions.
Definition at line 86 of file equityindex.cpp.
|
virtual |
returns a copy of itself linked to different interest, dividend curves or spot quote
Definition at line 104 of file equityindex.cpp.
|
private |
Definition at line 114 of file equityindex.hpp.
|
private |
Definition at line 115 of file equityindex.hpp.
|
private |
Definition at line 116 of file equityindex.hpp.
|
private |
Definition at line 117 of file equityindex.hpp.
|
private |
Definition at line 118 of file equityindex.hpp.
Definition at line 119 of file equityindex.hpp.