QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
|
Base class for equity indexes. More...
#include <equityindex.hpp>
Public Member Functions | |
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... | |
Observer interface | |
void | update () override |
Inspectors | |
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... | |
virtual Real | pastFixing (const Date &fixingDate) 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 &) | |
Observable & | operator= (const Observable &) |
Observable (Observable &&)=delete | |
Observable & | operator= (Observable &&)=delete |
virtual | ~Observable ()=default |
void | notifyObservers () |
Public Member Functions inherited from Observer | |
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_ |
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 | |
Public Types inherited from Observer | |
typedef set_type::iterator | iterator |
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, | ||
Handle< YieldTermStructure > | interest = {} , |
||
Handle< YieldTermStructure > | dividend = {} , |
||
Handle< Quote > | spot = {} |
||
) |
|
overridevirtual |
Returns the name of the index.
Implements Index.
Definition at line 73 of file equityindex.hpp.
|
overridevirtual |
returns the calendar defining valid fixing dates
Implements Index.
Definition at line 74 of file equityindex.hpp.
returns TRUE if the fixing date is a valid one
Implements Index.
Definition at line 113 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 49 of file equityindex.cpp.
|
overridevirtual |
This method must be implemented in derived classes. An instance of Observer does not call this method directly: instead, it will be called by the observables the instance registered with when they need to notify any changes.
Implements Observer.
Definition at line 117 of file equityindex.hpp.
Handle< YieldTermStructure > equityInterestRateCurve | ( | ) | const |
the rate curve used to forecast fixings
Definition at line 85 of file equityindex.hpp.
Handle< YieldTermStructure > equityDividendCurve | ( | ) | const |
the dividend curve used to forecast fixings
Definition at line 87 of file equityindex.hpp.
index spot value
Definition at line 89 of file equityindex.hpp.
It can be overridden to implement particular conventions.
Definition at line 77 of file equityindex.cpp.
Definition at line 72 of file equityindex.cpp.
|
virtual |
returns a copy of itself linked to different interest, dividend curves or spot quote
Definition at line 95 of file equityindex.cpp.
|
private |
Definition at line 106 of file equityindex.hpp.
|
private |
Definition at line 107 of file equityindex.hpp.
|
private |
Definition at line 108 of file equityindex.hpp.
|
private |
Definition at line 109 of file equityindex.hpp.
Definition at line 110 of file equityindex.hpp.