24#ifndef quantext_commodityindex_hpp
25#define quantext_commodityindex_hpp
27#include <ql/currency.hpp>
28#include <ql/handle.hpp>
29#include <ql/termstructures/yieldtermstructure.hpp>
30#include <ql/time/calendar.hpp>
57 const Handle<QuantExt::PriceTermStructure>&
priceCurve = Handle<QuantExt::PriceTermStructure>());
59 bool keepDays,
const Handle<QuantExt::PriceTermStructure>&
priceCurve = Handle<QuantExt::PriceTermStructure>());
65 Real
fixing(
const Date& fixingDate,
bool forecastTodaysFixing =
false)
const override;
69 void update()
override { notifyObservers(); }
82 virtual Real
forecastFixing(
const Time& fixingTime)
const override;
83 virtual Real
pastFixing(
const Date& fixingDate)
const override;
92 virtual QuantLib::ext::shared_ptr<CommodityIndex>
clone(
const QuantLib::Date&
expiryDate = QuantLib::Date(),
93 const boost::optional<QuantLib::Handle<PriceTermStructure>>& ts = boost::none)
const = 0;
99 Handle<QuantExt::PriceTermStructure>
curve_;
113 const Handle<QuantExt::PriceTermStructure>&
priceCurve = Handle<QuantExt::PriceTermStructure>())
115 QL_REQUIRE(
expiryDate_ == Date(),
"empty expiry date expected in CommoditySpotIndex");
119 QuantLib::ext::shared_ptr<CommodityIndex>
clone(
const QuantLib::Date&
expiryDate = QuantLib::Date(),
120 const boost::optional<QuantLib::Handle<PriceTermStructure>>& ts = boost::none)
const override;
127 const Handle<QuantExt::PriceTermStructure>&
priceCurve = Handle<QuantExt::PriceTermStructure>())
129 QL_REQUIRE(
expiryDate_ != Date(),
"non-empty expiry date expected CommodityFuturesIndex");
134 const Handle<QuantExt::PriceTermStructure>&
priceCurve = Handle<QuantExt::PriceTermStructure>())
136 QL_REQUIRE(
expiryDate_ != Date(),
"non-empty expiry date expected CommodityFuturesIndex");
140 QuantLib::ext::shared_ptr<CommodityIndex>
clone(
const QuantLib::Date&
expiryDate = QuantLib::Date(),
141 const boost::optional<QuantLib::Handle<PriceTermStructure>>& ts = boost::none)
const override;
CommodityFuturesIndex(const std::string &underlyingName, const Date &expiryDate, const Calendar &fixingCalendar, bool keepDays, const Handle< QuantExt::PriceTermStructure > &priceCurve=Handle< QuantExt::PriceTermStructure >())
QuantLib::ext::shared_ptr< CommodityIndex > clone(const QuantLib::Date &expiryDate=QuantLib::Date(), const boost::optional< QuantLib::Handle< PriceTermStructure > > &ts=boost::none) const override
Implement the base clone.
CommodityFuturesIndex(const std::string &underlyingName, const Date &expiryDate, const Calendar &fixingCalendar, const Handle< QuantExt::PriceTermStructure > &priceCurve=Handle< QuantExt::PriceTermStructure >())
virtual QuantLib::ext::shared_ptr< CommodityIndex > clone(const QuantLib::Date &expiryDate=QuantLib::Date(), const boost::optional< QuantLib::Handle< PriceTermStructure > > &ts=boost::none) const =0
CommodityIndex(const std::string &underlyingName, const QuantLib::Date &expiryDate, const Calendar &fixingCalendar, bool keepDays, const Handle< QuantExt::PriceTermStructure > &priceCurve=Handle< QuantExt::PriceTermStructure >())
bool isFuturesIndex() const
const QuantLib::Date & expiryDate() const
Calendar fixingCalendar() const override
virtual Real forecastFixing(const Date &fixingDate) const
std::string underlyingName_
CommodityIndex(const std::string &underlyingName, const QuantLib::Date &expiryDate, const Calendar &fixingCalendar, const Handle< QuantExt::PriceTermStructure > &priceCurve=Handle< QuantExt::PriceTermStructure >())
const Handle< QuantExt::PriceTermStructure > & priceCurve() const
std::string name() const override
Handle< QuantExt::PriceTermStructure > curve_
std::string underlyingName() const
bool isValidFixingDate(const Date &fixingDate) const override
virtual Real pastFixing(const Date &fixingDate) const override
returns a past fixing at the given date
Real fixing(const Date &fixingDate, bool forecastTodaysFixing=false) const override
CommoditySpotIndex(const std::string &underlyingName, const Calendar &fixingCalendar, const Handle< QuantExt::PriceTermStructure > &priceCurve=Handle< QuantExt::PriceTermStructure >())
QuantLib::ext::shared_ptr< CommodityIndex > clone(const QuantLib::Date &expiryDate=QuantLib::Date(), const boost::optional< QuantLib::Handle< PriceTermStructure > > &ts=boost::none) const override
Implement the base clone. The expiryDate is ignored for a CommoditySpotIndex.
A common base class for the FX and Equity Indices. Provides a forecast fixing method for time so the ...
Term structure of prices.