Commodity Index. More...
#include <qle/indexes/commodityindex.hpp>
Public Member Functions | |
CommodityIndex (const std::string &underlyingName, const QuantLib::Date &expiryDate, const Calendar &fixingCalendar, const Handle< QuantExt::PriceTermStructure > &priceCurve=Handle< QuantExt::PriceTermStructure >()) | |
CommodityIndex (const std::string &underlyingName, const QuantLib::Date &expiryDate, const Calendar &fixingCalendar, bool keepDays, const Handle< QuantExt::PriceTermStructure > &priceCurve=Handle< QuantExt::PriceTermStructure >()) | |
Index interface | |
std::string | name () const override |
Calendar | fixingCalendar () const override |
bool | isValidFixingDate (const Date &fixingDate) const override |
Real | fixing (const Date &fixingDate, bool forecastTodaysFixing=false) const override |
Observer interface | |
void | update () override |
Inspectors | |
std::string | underlyingName () const |
const Handle< QuantExt::PriceTermStructure > & | priceCurve () const |
bool | isFuturesIndex () const |
const QuantLib::Date & | expiryDate () const |
bool | keepDays () const |
Public Member Functions inherited from EqFxIndexBase | |
virtual | ~EqFxIndexBase () |
virtual Real | forecastFixing (const Time &fixingTime) const =0 |
returns the fixing at the given time More... | |
virtual Real | pastFixing (const Date &fixingDate) const =0 |
returns a past fixing at the given date More... | |
Fixing calculations | |
std::string | underlyingName_ |
Date | expiryDate_ |
Calendar | fixingCalendar_ |
Handle< QuantExt::PriceTermStructure > | curve_ |
std::string | name_ |
bool | isFuturesIndex_ |
bool | keepDays_ |
virtual Real | forecastFixing (const Date &fixingDate) const |
virtual Real | forecastFixing (const Time &fixingTime) const override |
returns the fixing at the given time More... | |
virtual Real | pastFixing (const Date &fixingDate) const override |
returns a past fixing at the given date More... | |
virtual QuantLib::ext::shared_ptr< CommodityIndex > | clone (const QuantLib::Date &expiryDate=QuantLib::Date(), const boost::optional< QuantLib::Handle< PriceTermStructure > > &ts=boost::none) const =0 |
void | init () |
Commodity Index.
This index can represent both spot and futures prices. In the latter case the constructor needs to be called with the futures expiry date. If the expiry date is set to Date(), the index is interpreted as spot index.
If it is spot index, the index name() is set to the underlying name passed to the constructor prefixed by "COMM-".
If it is a futures index and keepDays_
is false
, we set the name() to "COMM-" + underlyingName + "-" + "yyyy-mm", where "yyyy" is the expiry date's year and "mm" is the expiry date's month. The index forecast for fixing Date yields the price curve's forecast to the futures expiry instead which is beyond the fixing date. If keepDays_
is true
, the date suffix in the name is "yyyy-mm-dd" i.e. we keep the full date. This is useful for commodities whose expiry cycle is less than one month e.g. daily.
Definition at line 53 of file commodityindex.hpp.
CommodityIndex | ( | const std::string & | underlyingName, |
const QuantLib::Date & | expiryDate, | ||
const Calendar & | fixingCalendar, | ||
const Handle< QuantExt::PriceTermStructure > & | priceCurve = Handle< QuantExt::PriceTermStructure >() |
||
) |
spot quote is interpreted as of today
CommodityIndex | ( | const std::string & | underlyingName, |
const QuantLib::Date & | expiryDate, | ||
const Calendar & | fixingCalendar, | ||
bool | keepDays, | ||
const Handle< QuantExt::PriceTermStructure > & | priceCurve = Handle< QuantExt::PriceTermStructure >() |
||
) |
|
override |
Definition at line 62 of file commodityindex.hpp.
|
override |
|
override |
Definition at line 64 of file commodityindex.hpp.
|
override |
Definition at line 71 of file commodityindex.cpp.
|
override |
Definition at line 69 of file commodityindex.hpp.
std::string underlyingName | ( | ) | const |
Definition at line 73 of file commodityindex.hpp.
const Handle< QuantExt::PriceTermStructure > & priceCurve | ( | ) | const |
Definition at line 74 of file commodityindex.hpp.
bool isFuturesIndex | ( | ) | const |
Definition at line 75 of file commodityindex.hpp.
const QuantLib::Date & expiryDate | ( | ) | const |
bool keepDays | ( | ) | const |
Definition at line 77 of file commodityindex.hpp.
|
virtual |
Definition at line 116 of file commodityindex.cpp.
|
overridevirtual |
returns the fixing at the given time
Implements EqFxIndexBase.
Definition at line 110 of file commodityindex.cpp.
|
overridevirtual |
returns a past 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 EqFxIndexBase.
Reimplemented in OffPeakPowerIndex.
Definition at line 105 of file commodityindex.cpp.
|
pure virtual |
Returns a copy of itself with a potentially different expiry date and pricing curve.
If the expiryDate
is an empty Date
, it is ignored and the CommodityIndex instance's expiry date is used. If the ts
is uninitialised, it is ignored and the CommodityIndex instance's price curve is used.
Implemented in OffPeakPowerIndex, CommodityBasisFutureIndex, CommoditySpotIndex, and CommodityFuturesIndex.
|
protected |
Definition at line 47 of file commodityindex.cpp.
|
protected |
Definition at line 96 of file commodityindex.hpp.
|
protected |
Definition at line 97 of file commodityindex.hpp.
|
protected |
Definition at line 98 of file commodityindex.hpp.
|
protected |
Definition at line 99 of file commodityindex.hpp.
|
protected |
Definition at line 100 of file commodityindex.hpp.
|
protected |
Definition at line 101 of file commodityindex.hpp.
|
protected |
Definition at line 103 of file commodityindex.hpp.