#include <qle/termstructures/averagefuturepricehelper.hpp>
|
|
| | AverageFuturePriceHelper (const QuantLib::Handle< QuantLib::Quote > &price, const QuantLib::ext::shared_ptr< CommodityIndex > &index, const QuantLib::Date &start, const QuantLib::Date &end, const ext::shared_ptr< FutureExpiryCalculator > &calc, const QuantLib::Calendar &calendar=QuantLib::Calendar(), QuantLib::Natural deliveryDateRoll=0, QuantLib::Natural futureMonthOffset=0, bool useBusinessDays=true, QuantLib::Natural dailyExpiryOffset=QuantLib::Null< QuantLib::Natural >()) |
| |
| | AverageFuturePriceHelper (QuantLib::Real price, const QuantLib::ext::shared_ptr< CommodityIndex > &index, const QuantLib::Date &start, const QuantLib::Date &end, const ext::shared_ptr< FutureExpiryCalculator > &calc, const QuantLib::Calendar &calendar=QuantLib::Calendar(), QuantLib::Natural deliveryDateRoll=0, QuantLib::Natural futureMonthOffset=0, bool useBusinessDays=true, QuantLib::Natural dailyExpiryOffset=QuantLib::Null< QuantLib::Natural >()) |
| |
|
| QuantLib::Real | impliedQuote () const override |
| |
| void | setTermStructure (PriceTermStructure *ts) override |
| |
|
| void | accept (QuantLib::AcyclicVisitor &v) override |
| |
Helper for bootstrapping using prices that are the average of future settlement prices over a period.
Definition at line 38 of file averagefuturepricehelper.hpp.
◆ AverageFuturePriceHelper() [1/2]
| AverageFuturePriceHelper |
( |
const QuantLib::Handle< QuantLib::Quote > & |
price, |
|
|
const QuantLib::ext::shared_ptr< CommodityIndex > & |
index, |
|
|
const QuantLib::Date & |
start, |
|
|
const QuantLib::Date & |
end, |
|
|
const ext::shared_ptr< FutureExpiryCalculator > & |
calc, |
|
|
const QuantLib::Calendar & |
calendar = QuantLib::Calendar(), |
|
|
QuantLib::Natural |
deliveryDateRoll = 0, |
|
|
QuantLib::Natural |
futureMonthOffset = 0, |
|
|
bool |
useBusinessDays = true, |
|
|
QuantLib::Natural |
dailyExpiryOffset = QuantLib::Null< QuantLib::Natural >() |
|
) |
| |
- Parameters
-
| price | The average price quote. |
| index | The commodity index. Used to convey the commodity's name and calendar. The underlying averaging cashflow may reference more than one commodity future indices. |
| start | The start date of the averaging period. The averaging period includes the start date if it is a pricing date according to the calendar. |
| end | The end date of the averaging period. The averaging period includes the end date if it is a pricing date according to the calendar. |
| calc | A FutureExpiryCalculator instance. |
| calendar | The calendar used to determine pricing dates in the averaging period. If not provided, the index calendar is used. |
| deliveryDateRoll | The number of pricing days before the prompt future expiry date on which to roll to using the next future contract in the averaging. |
| futureMonthOffset | Use a positive integer to select a non-prompt future contract in the averaging. |
| useBusinessDays | If set to false, the averaging happens on the complement of the pricing calendar dates in the period. This is useful for some electricity futures. |
| dailyExpiryOffset | If set to Null<Natural>(), this is ignored. If set to a positive integer, it is the number of business days on the index calendar to offset each daily expiry date on each pricing date. |
◆ AverageFuturePriceHelper() [2/2]
| AverageFuturePriceHelper |
( |
QuantLib::Real |
price, |
|
|
const QuantLib::ext::shared_ptr< CommodityIndex > & |
index, |
|
|
const QuantLib::Date & |
start, |
|
|
const QuantLib::Date & |
end, |
|
|
const ext::shared_ptr< FutureExpiryCalculator > & |
calc, |
|
|
const QuantLib::Calendar & |
calendar = QuantLib::Calendar(), |
|
|
QuantLib::Natural |
deliveryDateRoll = 0, |
|
|
QuantLib::Natural |
futureMonthOffset = 0, |
|
|
bool |
useBusinessDays = true, |
|
|
QuantLib::Natural |
dailyExpiryOffset = QuantLib::Null< QuantLib::Natural >() |
|
) |
| |
- Parameters
-
| price | The average price. |
| index | The commodity index. Used to convey the commodity's name and calendar. The underlying averaging cashflow may reference more than one commodity future indices. |
| start | The start date of the averaging period. The averaging period includes the start date if it is a pricing date according to the calendar. |
| end | The end date of the averaging period. The averaging period includes the end date if it is a pricing date according to the calendar. |
| calc | A FutureExpiryCalculator instance. |
| calendar | The calendar used to determine pricing dates in the averaging period. If not provided, the index calendar is used. |
| deliveryDateRoll | The number of pricing days before the prompt future expiry date on which to roll to using the next future contract in the averaging. |
| futureMonthOffset | Use a positive integer to select a non-prompt future contract in the averaging. |
| useBusinessDays | If set to false, the averaging happens on the complement of the pricing calendar dates in the period. This is useful for some electricity futures. |
| dailyExpiryOffset | If set to Null<Natural>(), this is ignored. If set to a positive integer, it is the number of business days on the index calendar to offset each daily expiry date on each pricing date. |
◆ impliedQuote()
| Real impliedQuote |
( |
| ) |
const |
|
override |
Definition at line 88 of file averagefuturepricehelper.cpp.
88 {
89 QL_REQUIRE(termStructure_, "AverageFuturePriceHelper term structure not set.");
92}
QuantLib::ext::shared_ptr< CommodityIndexedAverageCashFlow > averageCashflow_
◆ setTermStructure()
Definition at line 94 of file averagefuturepricehelper.cpp.
94 {
95 QuantLib::ext::shared_ptr<PriceTermStructure> temp(ts, null_deleter());
96
98 PriceHelper::setTermStructure(ts);
99}
QuantLib::RelinkableHandle< PriceTermStructure > termStructureHandle_
◆ accept()
| void accept |
( |
QuantLib::AcyclicVisitor & |
v | ) |
|
|
override |
Definition at line 101 of file averagefuturepricehelper.cpp.
101 {
102 if (auto vis = dynamic_cast<Visitor<AverageFuturePriceHelper>*>(&v))
103 vis->visit(*this);
104 else
105 PriceHelper::accept(v);
106}
◆ averageCashflow()
◆ deepUpdate()
◆ init()
| void init |
( |
const QuantLib::ext::shared_ptr< CommodityIndex > & |
index, |
|
|
const QuantLib::Date & |
start, |
|
|
const QuantLib::Date & |
end, |
|
|
const ext::shared_ptr< FutureExpiryCalculator > & |
calc, |
|
|
const QuantLib::Calendar & |
calendar, |
|
|
QuantLib::Natural |
deliveryDateRoll, |
|
|
QuantLib::Natural |
futureMonthOffset, |
|
|
bool |
useBusinessDays, |
|
|
QuantLib::Natural |
dailyExpiryOffset |
|
) |
| |
|
private |
Shared initialisation method.
Definition at line 61 of file averagefuturepricehelper.cpp.
64 {
65
66
67
69
70
71
73 registerWith(indexClone);
74
75
76 averageCashflow_ = QuantLib::ext::make_shared<CommodityIndexedAverageCashFlow>(1.0, start, end, end, indexClone,
77 calendar, 0.0, 1.0, true, deliveryDateRoll, futureMonthOffset, calc, true, false, useBusinessDays,
79
80
81
82
84 earliestDate_ = mp.begin()->second->expiryDate();
85 pillarDate_ = mp.rbegin()->second->expiryDate();
86}
◆ averageCashflow_
◆ termStructureHandle_