QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.38
|
base class for commodity indexes More...
#include <commodityindex.hpp>
Public Member Functions | |
CommodityIndex (std::string name, CommodityType commodityType, Currency currency, UnitOfMeasure unitOfMeasure, Calendar calendar, Real lotQuantity, ext::shared_ptr< CommodityCurve > forwardCurve, ext::shared_ptr< ExchangeContracts > exchangeContracts, int nearbyOffset) | |
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 |
![]() | |
~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 () |
Inspectors | |
std::string | name_ |
CommodityType | commodityType_ |
UnitOfMeasure | unitOfMeasure_ |
Currency | currency_ |
Calendar | calendar_ |
Real | lotQuantity_ |
ext::shared_ptr< CommodityCurve > | forwardCurve_ |
Real | forwardCurveUomConversionFactor_ = 1 |
ext::shared_ptr< ExchangeContracts > | exchangeContracts_ |
Integer | nearbyOffset_ |
const CommodityType & | commodityType () const |
const Currency & | currency () const |
const UnitOfMeasure & | unitOfMeasure () const |
const ext::shared_ptr< CommodityCurve > & | forwardCurve () const |
Real | lotQuantity () const |
Real | forwardPrice (const Date &date) const |
Date | lastQuoteDate () const |
bool | empty () const |
bool | forwardCurveEmpty () const |
const Calendar & | calendar () const |
Real | price (const Date &date) |
void | addQuote (const Date "eDate, Real quote) |
void | addQuotes (const std::map< Date, Real > "es) |
void | clearQuotes () |
bool | isValidQuoteDate (const Date "eDate) const |
const TimeSeries< Real > & | quotes () const |
std::ostream & | operator<< (std::ostream &, const CommodityIndex &) |
Additional Inherited Members | |
![]() | |
typedef set_type::iterator | iterator |
![]() | |
ext::shared_ptr< Observable > | notifier () const |
base class for commodity indexes
Definition at line 35 of file commodityindex.hpp.
CommodityIndex | ( | std::string | name, |
CommodityType | commodityType, | ||
Currency | currency, | ||
UnitOfMeasure | unitOfMeasure, | ||
Calendar | calendar, | ||
Real | lotQuantity, | ||
ext::shared_ptr< CommodityCurve > | forwardCurve, | ||
ext::shared_ptr< ExchangeContracts > | exchangeContracts, | ||
int | nearbyOffset | ||
) |
|
overridevirtual |
Returns the name of the index.
Implements Index.
Definition at line 154 of file commodityindex.hpp.
|
overridevirtual |
returns the calendar defining valid fixing dates
Implements Index.
Definition at line 158 of file commodityindex.hpp.
returns TRUE if the fixing date is a valid one
Implements Index.
Definition at line 162 of file commodityindex.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 166 of file commodityindex.hpp.
|
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 150 of file commodityindex.hpp.
const CommodityType & commodityType | ( | ) | const |
Definition at line 170 of file commodityindex.hpp.
const Currency & currency | ( | ) | const |
Definition at line 178 of file commodityindex.hpp.
const UnitOfMeasure & unitOfMeasure | ( | ) | const |
Definition at line 174 of file commodityindex.hpp.
const ext::shared_ptr< CommodityCurve > & forwardCurve | ( | ) | const |
Definition at line 187 of file commodityindex.hpp.
Real lotQuantity | ( | ) | const |
Definition at line 182 of file commodityindex.hpp.
Definition at line 191 of file commodityindex.hpp.
Date lastQuoteDate | ( | ) | const |
bool empty | ( | ) | const |
bool forwardCurveEmpty | ( | ) | const |
Definition at line 210 of file commodityindex.hpp.
const Calendar & calendar | ( | ) | const |
Definition at line 75 of file commodityindex.hpp.
Definition at line 83 of file commodityindex.hpp.
Definition at line 91 of file commodityindex.hpp.
Definition at line 99 of file commodityindex.hpp.
void clearQuotes | ( | ) |
Definition at line 109 of file commodityindex.hpp.
Definition at line 117 of file commodityindex.hpp.
const TimeSeries< Real > & quotes | ( | ) | const |
Definition at line 125 of file commodityindex.hpp.
|
friend |
Definition at line 52 of file commodityindex.cpp.
|
protected |
Definition at line 131 of file commodityindex.hpp.
|
protected |
Definition at line 132 of file commodityindex.hpp.
|
protected |
Definition at line 133 of file commodityindex.hpp.
|
protected |
Definition at line 134 of file commodityindex.hpp.
|
protected |
Definition at line 135 of file commodityindex.hpp.
|
protected |
Definition at line 136 of file commodityindex.hpp.
|
protected |
Definition at line 137 of file commodityindex.hpp.
|
protected |
Definition at line 138 of file commodityindex.hpp.
|
protected |
Definition at line 139 of file commodityindex.hpp.
|
protected |
Definition at line 140 of file commodityindex.hpp.