#include <qle/cashflows/commodityindexedaveragecashflow.hpp>
Public Types | |
enum class | PaymentTiming { InAdvance , InArrears } |
Public Member Functions | |
CommodityIndexedAverageCashFlow (QuantLib::Real quantity, const QuantLib::Date &startDate, const QuantLib::Date &endDate, const QuantLib::Date &paymentDate, const ext::shared_ptr< CommodityIndex > &index, const QuantLib::Calendar &pricingCalendar=QuantLib::Calendar(), QuantLib::Real spread=0.0, QuantLib::Real gearing=1.0, bool useFuturePrice=false, QuantLib::Natural deliveryDateRoll=0, QuantLib::Natural futureMonthOffset=0, const ext::shared_ptr< FutureExpiryCalculator > &calc=nullptr, bool includeEndDate=true, bool excludeStartDate=true, bool useBusinessDays=true, CommodityQuantityFrequency quantityFrequency=CommodityQuantityFrequency::PerCalculationPeriod, QuantLib::Natural hoursPerDay=QuantLib::Null< QuantLib::Natural >(), QuantLib::Natural dailyExpiryOffset=QuantLib::Null< QuantLib::Natural >(), bool unrealisedQuantity=false, const boost::optional< std::pair< QuantLib::Calendar, QuantLib::Real > > &offPeakPowerData=boost::none, const ext::shared_ptr< FxIndex > &fxIndex=nullptr) | |
Constructor taking an explicit paymentDate . More... | |
CommodityIndexedAverageCashFlow (QuantLib::Real quantity, const QuantLib::Date &startDate, const QuantLib::Date &endDate, QuantLib::Natural paymentLag, QuantLib::Calendar paymentCalendar, QuantLib::BusinessDayConvention paymentConvention, const ext::shared_ptr< CommodityIndex > &index, const QuantLib::Calendar &pricingCalendar=QuantLib::Calendar(), QuantLib::Real spread=0.0, QuantLib::Real gearing=1.0, PaymentTiming paymentTiming=PaymentTiming::InArrears, bool useFuturePrice=false, QuantLib::Natural deliveryDateRoll=0, QuantLib::Natural futureMonthOffset=0, const ext::shared_ptr< FutureExpiryCalculator > &calc=nullptr, bool includeEndDate=true, bool excludeStartDate=true, const QuantLib::Date &paymentDateOverride=Date(), bool useBusinessDays=true, CommodityQuantityFrequency quantityFrequency=CommodityQuantityFrequency::PerCalculationPeriod, QuantLib::Natural hoursPerDay=QuantLib::Null< QuantLib::Natural >(), QuantLib::Natural dailyExpiryOffset=QuantLib::Null< QuantLib::Natural >(), bool unrealisedQuantity=false, const boost::optional< std::pair< QuantLib::Calendar, QuantLib::Real > > &offPeakPowerData=boost::none, const ext::shared_ptr< FxIndex > &fxIndex=nullptr) | |
Constructor that deduces payment date from endDate using payment conventions. More... | |
Inspectors | |
const QuantLib::Date & | startDate () const |
const QuantLib::Date & | endDate () const |
ext::shared_ptr< CommodityIndex > | index () const |
QuantLib::Natural | deliveryDateRoll () const |
QuantLib::Natural | futureMonthOffset () const |
bool | useBusinessDays () const |
CommodityQuantityFrequency | quantityFrequency () const |
QuantLib::Natural | hoursPerDay () const |
QuantLib::Natural | dailyExpiryOffset () const |
bool | unrealisedQuantity () const |
const boost::optional< std::pair< QuantLib::Calendar, QuantLib::Real > > & | offPeakPowerData () const |
const std::vector< std::pair< QuantLib::Date, ext::shared_ptr< CommodityIndex > > > & | indices () const override |
QuantLib::Real | periodQuantity () const override |
Event interface | |
QuantLib::Date | date () const override |
CashFlow interface | |
QuantLib::Real | amount () const override |
Visitability | |
void | accept (QuantLib::AcyclicVisitor &v) override |
Public Member Functions inherited from CommodityCashFlow | |
CommodityCashFlow (QuantLib::Real quantity, QuantLib::Real spread, QuantLib::Real gearing, bool useFuturePrice, const ext::shared_ptr< CommodityIndex > &index, const ext::shared_ptr< FxIndex > &fxIndex) | |
QuantLib::Real | quantity () const |
QuantLib::Real | spread () const |
QuantLib::Real | gearing () const |
bool | useFuturePrice () const |
ext::shared_ptr< CommodityIndex > | index () const |
ext::shared_ptr< FxIndex > | fxIndex () const |
virtual const std::vector< std::pair< QuantLib::Date, ext::shared_ptr< CommodityIndex > > > & | indices () const =0 |
Return a map of pricing date and corresponding commodity index. More... | |
virtual QuantLib::Date | lastPricingDate () const =0 |
virtual QuantLib::Real | periodQuantity () const =0 |
virtual QuantLib::Real | fixing () const =0 |
void | accept (QuantLib::AcyclicVisitor &v) override |
CommodityCashFlow interface | |
QuantLib::Date | startDate_ |
QuantLib::Date | endDate_ |
QuantLib::Date | paymentDate_ |
QuantLib::Calendar | pricingCalendar_ |
QuantLib::Natural | deliveryDateRoll_ |
QuantLib::Natural | futureMonthOffset_ |
bool | includeEndDate_ |
bool | excludeStartDate_ |
std::vector< std::pair< QuantLib::Date, ext::shared_ptr< CommodityIndex > > > | indices_ |
bool | useBusinessDays_ |
CommodityQuantityFrequency | quantityFrequency_ |
QuantLib::Natural | hoursPerDay_ |
QuantLib::Natural | dailyExpiryOffset_ |
bool | unrealisedQuantity_ |
QuantLib::Real | periodQuantity_ |
boost::optional< std::pair< QuantLib::Calendar, QuantLib::Real > > | offPeakPowerData_ |
QuantLib::Real | averagePrice_ |
std::map< QuantLib::Date, QuantLib::Real > | weights_ |
QuantLib::Date | lastPricingDate () const override |
QuantLib::Real | fixing () const override |
void | performCalculations () const override |
void | init (const ext::shared_ptr< FutureExpiryCalculator > &calc) |
Shared initialisation. More... | |
void | updateQuantity () |
Set the period quantity based on the quantity and quantity frequency parameter. More... | |
Additional Inherited Members | |
Protected Attributes inherited from CommodityCashFlow | |
QuantLib::Real | quantity_ |
QuantLib::Real | spread_ |
QuantLib::Real | gearing_ |
bool | useFuturePrice_ |
ext::shared_ptr< CommodityIndex > | index_ |
ext::shared_ptr< FxIndex > | fxIndex_ |
QuantLib::Real | amount_ |
Cash flow dependent on the average of commodity spot prices or futures settlement prices over a period.
The cash flow takes a start date and an end date. The set of valid pricing dates is determined from and including the start date to but excluding the end date. The cash flow amount is then the arithmetic average of the commodity spot prices or next commodity future settlement prices on each valid pricing date times the quantity. The next commodity future is determined relative to each pricing date so the settlement prices for multiple commodity contracts may be involved in the averaging.
Definition at line 46 of file commodityindexedaveragecashflow.hpp.
|
strong |
Enumerator | |
---|---|
InAdvance | |
InArrears |
Definition at line 49 of file commodityindexedaveragecashflow.hpp.
CommodityIndexedAverageCashFlow | ( | QuantLib::Real | quantity, |
const QuantLib::Date & | startDate, | ||
const QuantLib::Date & | endDate, | ||
const QuantLib::Date & | paymentDate, | ||
const ext::shared_ptr< CommodityIndex > & | index, | ||
const QuantLib::Calendar & | pricingCalendar = QuantLib::Calendar() , |
||
QuantLib::Real | spread = 0.0 , |
||
QuantLib::Real | gearing = 1.0 , |
||
bool | useFuturePrice = false , |
||
QuantLib::Natural | deliveryDateRoll = 0 , |
||
QuantLib::Natural | futureMonthOffset = 0 , |
||
const ext::shared_ptr< FutureExpiryCalculator > & | calc = nullptr , |
||
bool | includeEndDate = true , |
||
bool | excludeStartDate = true , |
||
bool | useBusinessDays = true , |
||
CommodityQuantityFrequency | quantityFrequency = CommodityQuantityFrequency::PerCalculationPeriod , |
||
QuantLib::Natural | hoursPerDay = QuantLib::Null< QuantLib::Natural >() , |
||
QuantLib::Natural | dailyExpiryOffset = QuantLib::Null< QuantLib::Natural >() , |
||
bool | unrealisedQuantity = false , |
||
const boost::optional< std::pair< QuantLib::Calendar, QuantLib::Real > > & | offPeakPowerData = boost::none , |
||
const ext::shared_ptr< FxIndex > & | fxIndex = nullptr |
||
) |
Constructor taking an explicit paymentDate
.
CommodityIndexedAverageCashFlow | ( | QuantLib::Real | quantity, |
const QuantLib::Date & | startDate, | ||
const QuantLib::Date & | endDate, | ||
QuantLib::Natural | paymentLag, | ||
QuantLib::Calendar | paymentCalendar, | ||
QuantLib::BusinessDayConvention | paymentConvention, | ||
const ext::shared_ptr< CommodityIndex > & | index, | ||
const QuantLib::Calendar & | pricingCalendar = QuantLib::Calendar() , |
||
QuantLib::Real | spread = 0.0 , |
||
QuantLib::Real | gearing = 1.0 , |
||
PaymentTiming | paymentTiming = PaymentTiming::InArrears , |
||
bool | useFuturePrice = false , |
||
QuantLib::Natural | deliveryDateRoll = 0 , |
||
QuantLib::Natural | futureMonthOffset = 0 , |
||
const ext::shared_ptr< FutureExpiryCalculator > & | calc = nullptr , |
||
bool | includeEndDate = true , |
||
bool | excludeStartDate = true , |
||
const QuantLib::Date & | paymentDateOverride = Date() , |
||
bool | useBusinessDays = true , |
||
CommodityQuantityFrequency | quantityFrequency = CommodityQuantityFrequency::PerCalculationPeriod , |
||
QuantLib::Natural | hoursPerDay = QuantLib::Null< QuantLib::Natural >() , |
||
QuantLib::Natural | dailyExpiryOffset = QuantLib::Null< QuantLib::Natural >() , |
||
bool | unrealisedQuantity = false , |
||
const boost::optional< std::pair< QuantLib::Calendar, QuantLib::Real > > & | offPeakPowerData = boost::none , |
||
const ext::shared_ptr< FxIndex > & | fxIndex = nullptr |
||
) |
Constructor that deduces payment date from endDate
using payment conventions.
const QuantLib::Date & startDate | ( | ) | const |
Definition at line 84 of file commodityindexedaveragecashflow.hpp.
const QuantLib::Date & endDate | ( | ) | const |
Definition at line 85 of file commodityindexedaveragecashflow.hpp.
ext::shared_ptr< CommodityIndex > index | ( | ) | const |
Definition at line 86 of file commodityindexedaveragecashflow.hpp.
QuantLib::Natural deliveryDateRoll | ( | ) | const |
Definition at line 87 of file commodityindexedaveragecashflow.hpp.
QuantLib::Natural futureMonthOffset | ( | ) | const |
Definition at line 88 of file commodityindexedaveragecashflow.hpp.
bool useBusinessDays | ( | ) | const |
Definition at line 89 of file commodityindexedaveragecashflow.hpp.
CommodityQuantityFrequency quantityFrequency | ( | ) | const |
Definition at line 90 of file commodityindexedaveragecashflow.hpp.
QuantLib::Natural hoursPerDay | ( | ) | const |
Definition at line 91 of file commodityindexedaveragecashflow.hpp.
QuantLib::Natural dailyExpiryOffset | ( | ) | const |
Definition at line 92 of file commodityindexedaveragecashflow.hpp.
bool unrealisedQuantity | ( | ) | const |
Definition at line 93 of file commodityindexedaveragecashflow.hpp.
const boost::optional< std::pair< QuantLib::Calendar, QuantLib::Real > > & offPeakPowerData | ( | ) | const |
Definition at line 94 of file commodityindexedaveragecashflow.hpp.
|
overridevirtual |
Return the index used to get the price for each pricing date in the period. The map keys are the pricing dates. For a given key date, the map value holds the commodity index used to give the price on that date. If the averaging does not reference future contract settlement prices, i.e. useFirstFuture()
is false
, the commodity index is simply the commodity spot index passed in the constructor. If the averaging references future contract settlement prices, i.e. useFirstFuture()
is true
, the commodity index is the commodity future contract index relevant for that pricing date.
Implements CommodityCashFlow.
Definition at line 105 of file commodityindexedaveragecashflow.hpp.
|
overridevirtual |
Quantity for the full calculation period i.e. the effective quantity after taking into account the quantity frequency setting.
Implements CommodityCashFlow.
Definition at line 110 of file commodityindexedaveragecashflow.hpp.
|
override |
Definition at line 115 of file commodityindexedaveragecashflow.hpp.
|
override |
Definition at line 108 of file commodityindexedaveragecashflow.cpp.
|
override |
Definition at line 118 of file commodityindexedaveragecashflow.cpp.
|
overridevirtual |
Implements CommodityCashFlow.
Definition at line 131 of file commodityindexedaveragecashflow.hpp.
|
overridevirtual |
Implements CommodityCashFlow.
Definition at line 113 of file commodityindexedaveragecashflow.cpp.
|
overrideprivate |
Definition at line 84 of file commodityindexedaveragecashflow.cpp.
|
private |
Shared initialisation.
Definition at line 125 of file commodityindexedaveragecashflow.cpp.
|
private |
Set the period quantity based on the quantity and quantity frequency parameter.
Definition at line 218 of file commodityindexedaveragecashflow.cpp.
|
private |
Definition at line 145 of file commodityindexedaveragecashflow.hpp.
|
private |
Definition at line 146 of file commodityindexedaveragecashflow.hpp.
|
private |
Definition at line 147 of file commodityindexedaveragecashflow.hpp.
|
private |
Definition at line 148 of file commodityindexedaveragecashflow.hpp.
|
private |
Definition at line 149 of file commodityindexedaveragecashflow.hpp.
|
private |
Definition at line 150 of file commodityindexedaveragecashflow.hpp.
|
private |
Definition at line 151 of file commodityindexedaveragecashflow.hpp.
|
private |
Definition at line 152 of file commodityindexedaveragecashflow.hpp.
|
private |
Definition at line 153 of file commodityindexedaveragecashflow.hpp.
|
private |
Definition at line 154 of file commodityindexedaveragecashflow.hpp.
|
private |
Definition at line 155 of file commodityindexedaveragecashflow.hpp.
|
private |
Definition at line 156 of file commodityindexedaveragecashflow.hpp.
|
private |
Definition at line 157 of file commodityindexedaveragecashflow.hpp.
|
private |
Definition at line 158 of file commodityindexedaveragecashflow.hpp.
|
private |
Definition at line 159 of file commodityindexedaveragecashflow.hpp.
|
private |
Definition at line 160 of file commodityindexedaveragecashflow.hpp.
|
mutableprivate |
Definition at line 161 of file commodityindexedaveragecashflow.hpp.
|
private |
Definition at line 164 of file commodityindexedaveragecashflow.hpp.