20#include <ql/time/calendars/nullcalendar.hpp>
24using QuantLib::Calendar;
25using QuantLib::NullCalendar;
31 const Date& expiryDate,
32 const QuantLib::ext::shared_ptr<CommodityFuturesIndex>& offPeakIndex,
33 const QuantLib::ext::shared_ptr<CommodityFuturesIndex>& peakIndex,
35 const Calendar& peakCalendar,
36 const Handle<PriceTermStructure>& priceCurve)
38 offPeakIndex_(offPeakIndex), peakIndex_(peakIndex), offPeakHours_(offPeakHours),
39 peakCalendar_(peakCalendar) {
43 io::iso_date(
expiryDate_) <<
") should equal the off-peak index expiry date (" <<
46 io::iso_date(
expiryDate_) <<
") should equal the peak index expiry date (" <<
47 io::iso_date(
peakIndex_->expiryDate()) <<
").");
48 QL_REQUIRE(
offPeakIndex_, msgPrefix <<
"the off-peak index should not be null.");
49 QL_REQUIRE(
peakIndex_, msgPrefix <<
"the peak index should not be null.");
69 const boost::optional<Handle<PriceTermStructure>>& ts)
const {
71 const auto& ed = expiry == Date() ?
expiryDate() : expiry;
73 auto peakIndex = QuantLib::ext::dynamic_pointer_cast<CommodityFuturesIndex>(
peakIndex_->clone(ed));
const QuantLib::Date & expiryDate() const
const Handle< QuantExt::PriceTermStructure > & priceCurve() const
std::string underlyingName() const
const QuantLib::ext::shared_ptr< CommodityFuturesIndex > & offPeakIndex() const
OffPeakPowerIndex(const std::string &underlyingName, const QuantLib::Date &expiryDate, const QuantLib::ext::shared_ptr< CommodityFuturesIndex > &offPeakIndex, const QuantLib::ext::shared_ptr< CommodityFuturesIndex > &peakIndex, QuantLib::Real offPeakHours, const QuantLib::Calendar &peakCalendar, const Handle< QuantExt::PriceTermStructure > &priceCurve=Handle< QuantExt::PriceTermStructure >())
Constructor.
QuantLib::Calendar peakCalendar_
const QuantLib::ext::shared_ptr< CommodityFuturesIndex > & peakIndex() const
QuantLib::ext::shared_ptr< CommodityFuturesIndex > peakIndex_
QuantLib::ext::shared_ptr< CommodityFuturesIndex > offPeakIndex_
QuantLib::ext::shared_ptr< CommodityIndex > clone(const QuantLib::Date &expiryDate, const boost::optional< QuantLib::Handle< PriceTermStructure > > &ts=boost::none) const override
Implement the base clone.
QuantLib::Real offPeakHours_
const QuantLib::Calendar & peakCalendar() const
Real pastFixing(const Date &fixingDate) const override
returns a past fixing at the given date
QuantLib::Real offPeakHours() const
commodity future index for off peak power prices.