Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
Public Member Functions | List of all members
OffPeakPowerIndex Class Reference

Off peak power index. More...

#include <qle/indexes/offpeakpowerindex.hpp>

+ Inheritance diagram for OffPeakPowerIndex:
+ Collaboration diagram for OffPeakPowerIndex:

Public Member Functions

 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. More...
 
Inspectors
const QuantLib::ext::shared_ptr< CommodityFuturesIndex > & offPeakIndex () const
 
const QuantLib::ext::shared_ptr< CommodityFuturesIndex > & peakIndex () const
 
QuantLib::Real offPeakHours () const
 
const QuantLib::Calendar & peakCalendar () const
 
QuantLib::ext::shared_ptr< CommodityIndexclone (const QuantLib::Date &expiryDate, const boost::optional< QuantLib::Handle< PriceTermStructure > > &ts=boost::none) const override
 Implement the base clone. More...
 
- Public Member Functions inherited from CommodityFuturesIndex
 CommodityFuturesIndex (const std::string &underlyingName, const Date &expiryDate, const Calendar &fixingCalendar, const Handle< QuantExt::PriceTermStructure > &priceCurve=Handle< QuantExt::PriceTermStructure >())
 
 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< CommodityIndexclone (const QuantLib::Date &expiryDate=QuantLib::Date(), const boost::optional< QuantLib::Handle< PriceTermStructure > > &ts=boost::none) const override
 Implement the base clone. More...
 
- Public Member Functions inherited from CommodityIndex
 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 >())
 
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
 
void update () override
 
std::string underlyingName () const
 
const Handle< QuantExt::PriceTermStructure > & priceCurve () const
 
bool isFuturesIndex () const
 
const QuantLib::Date & expiryDate () const
 
bool keepDays () const
 
virtual Real forecastFixing (const Date &fixingDate) const
 
virtual Real forecastFixing (const Time &fixingTime) const override
 returns the fixing at the given time More...
 
- 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...
 

CommodityIndex interface

QuantLib::ext::shared_ptr< CommodityFuturesIndexoffPeakIndex_
 
QuantLib::ext::shared_ptr< CommodityFuturesIndexpeakIndex_
 
QuantLib::Real offPeakHours_
 
QuantLib::Calendar peakCalendar_
 
Real pastFixing (const Date &fixingDate) const override
 returns a past fixing at the given date More...
 

Additional Inherited Members

- Protected Member Functions inherited from CommodityIndex
void init ()
 
- Protected Attributes inherited from CommodityIndex
std::string underlyingName_
 
Date expiryDate_
 
Calendar fixingCalendar_
 
Handle< QuantExt::PriceTermStructurecurve_
 
std::string name_
 
bool isFuturesIndex_
 
bool keepDays_
 

Detailed Description

Off peak power index.

A commodity index to represent daily off-peak power prices.

In general, when used in derivatives the off-peak power value for a given date will be:

  1. the average of Locational Marginal Prices (LMPs) over the off-peak hours, generally 8, on peak calendar business days
  2. the average of LMPs over all hours on peak calendar holidays

There are generally two types of daily futures in the power markets:

  1. those that average the LMPs over the peak hours, generally 16, on every calendar day
  2. those that average the LMPs over the off-peak hours, generally 8, on every calendar day

This off peak power index uses the prices of both of these daily future contracts to construct the index that is used in derivatives that reference off-peak power prices. The off-peak future is used directly on peak calendar business days. On peak calendar holidays, the weighted average of the daily off-peak future price and daily peak future price is used where the weights are the number of off-peak hours and peak hours respectively divided by 24.

Definition at line 50 of file offpeakpowerindex.hpp.

Constructor & Destructor Documentation

◆ OffPeakPowerIndex()

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.

Definition at line 30 of file offpeakpowerindex.cpp.

40 string msgPrefix = "Constructing " + underlyingName + ": ";
41 QL_REQUIRE(0.0 < offPeakHours_ && offPeakHours_ < 24.0, msgPrefix << "off-peak hours must be in (0, 24.0)");
42 QL_REQUIRE(expiryDate_ == offPeakIndex_->expiryDate(), msgPrefix << "the expiry date (" <<
43 io::iso_date(expiryDate_) << ") should equal the off-peak index expiry date (" <<
44 io::iso_date(offPeakIndex_->expiryDate()) << ").");
45 QL_REQUIRE(expiryDate_ == peakIndex_->expiryDate(), msgPrefix << "the 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.");
50}
CommodityFuturesIndex(const std::string &underlyingName, const Date &expiryDate, const Calendar &fixingCalendar, const Handle< QuantExt::PriceTermStructure > &priceCurve=Handle< QuantExt::PriceTermStructure >())
const QuantLib::Date & expiryDate() const
const Handle< QuantExt::PriceTermStructure > & priceCurve() const
std::string underlyingName() const
const QuantLib::ext::shared_ptr< CommodityFuturesIndex > & offPeakIndex() const
QuantLib::Calendar peakCalendar_
const QuantLib::ext::shared_ptr< CommodityFuturesIndex > & peakIndex() const
QuantLib::ext::shared_ptr< CommodityFuturesIndex > peakIndex_
QuantLib::ext::shared_ptr< CommodityFuturesIndex > offPeakIndex_
const QuantLib::Calendar & peakCalendar() const
QuantLib::Real offPeakHours() const
+ Here is the call graph for this function:

Member Function Documentation

◆ offPeakIndex()

const QuantLib::ext::shared_ptr< CommodityFuturesIndex > & offPeakIndex ( ) const

Definition at line 52 of file offpeakpowerindex.cpp.

52 {
53 return offPeakIndex_;
54}
+ Here is the caller graph for this function:

◆ peakIndex()

const QuantLib::ext::shared_ptr< CommodityFuturesIndex > & peakIndex ( ) const

Definition at line 56 of file offpeakpowerindex.cpp.

56 {
57 return peakIndex_;
58}
+ Here is the caller graph for this function:

◆ offPeakHours()

Real offPeakHours ( ) const

Definition at line 60 of file offpeakpowerindex.cpp.

60 {
61 return offPeakHours_;
62}

◆ peakCalendar()

const Calendar & peakCalendar ( ) const

Definition at line 64 of file offpeakpowerindex.cpp.

64 {
65 return peakCalendar_;
66}

◆ clone()

QuantLib::ext::shared_ptr< CommodityIndex > clone ( const QuantLib::Date &  expiryDate,
const boost::optional< QuantLib::Handle< PriceTermStructure > > &  ts = boost::none 
) const
overridevirtual

Implement the base clone.

Reimplemented from CommodityFuturesIndex.

Definition at line 68 of file offpeakpowerindex.cpp.

69 {
70 const auto& pts = ts ? *ts : priceCurve();
71 const auto& ed = expiry == Date() ? expiryDate() : expiry;
72 auto offPeakIndex = QuantLib::ext::dynamic_pointer_cast<CommodityFuturesIndex>(offPeakIndex_->clone(ed));
73 auto peakIndex = QuantLib::ext::dynamic_pointer_cast<CommodityFuturesIndex>(peakIndex_->clone(ed));
74 return QuantLib::ext::make_shared<OffPeakPowerIndex>(underlyingName(), ed, offPeakIndex,
76}
+ Here is the call graph for this function:

◆ pastFixing()

Real pastFixing ( const Date &  fixingDate) const
overrideprotectedvirtual

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.

Reimplemented from CommodityIndex.

Definition at line 78 of file offpeakpowerindex.cpp.

78 {
79 if (peakCalendar_.isBusinessDay(fixingDate))
80 return offPeakIndex_->fixing(fixingDate);
81 else
82 return (offPeakHours_ * offPeakIndex_->fixing(fixingDate) +
83 (24.0 - offPeakHours_) * peakIndex_->fixing(fixingDate)) / 24.0;
84}

Member Data Documentation

◆ offPeakIndex_

QuantLib::ext::shared_ptr<CommodityFuturesIndex> offPeakIndex_
private

Definition at line 80 of file offpeakpowerindex.hpp.

◆ peakIndex_

QuantLib::ext::shared_ptr<CommodityFuturesIndex> peakIndex_
private

Definition at line 81 of file offpeakpowerindex.hpp.

◆ offPeakHours_

QuantLib::Real offPeakHours_
private

Definition at line 82 of file offpeakpowerindex.hpp.

◆ peakCalendar_

QuantLib::Calendar peakCalendar_
private

Definition at line 83 of file offpeakpowerindex.hpp.