Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
averageoffpeakpowerhelper.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2021 Quaternion Risk Management Ltd
3 All rights reserved.
4
5 This file is part of ORE, a free-software/open-source library
6 for transparent pricing and risk analysis - http://opensourcerisk.org
7
8 ORE is free software: you can redistribute it and/or modify it
9 under the terms of the Modified BSD License. You should have received a
10 copy of the license along with this program.
11 The license is also available online at <http://opensourcerisk.org>
12
13 This program is distributed on the basis that it will form a useful
14 contribution to risk analytics and model standardisation, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 FITNESS FOR A PARTICULAR PURPOSE. See the license for more details.
17*/
18
19/*! \file qle/termstructures/averageoffpeakpowerhelper.hpp
20 \brief Price helper for average of off-peak electricity prices over a period.
21 \ingroup termstructures
22*/
23
24#ifndef quantext_average_off_peak_power_helper_hpp
25#define quantext_average_off_peak_power_helper_hpp
26
30#include <ql/termstructures/bootstraphelper.hpp>
31
32namespace QuantExt {
33
34typedef QuantLib::BootstrapHelper<PriceTermStructure> PriceHelper;
35
36//! Helper for bootstrapping using prices that are the average of future settlement prices over a period.
37//! \ingroup termstructures
39public:
40 //! \name Constructors
41 //@{
42 /*! \param price The average price quote.
43 \param index The commodity index. Used to convey the off-peak commodity's name and calendar. The
44 underlying averaging cashflow may reference more than one commodity future indices.
45 \param start The start date of the averaging period. The averaging period includes the
46 start date if it is a pricing date according to the \p calendar.
47 \param end The end date of the averaging period. The averaging period includes the
48 end date if it is a pricing date according to the \p calendar.
49 \param calc A FutureExpiryCalculator instance.
50 \param peakIndex The commodity index for the peak electricity prices.
51 \param peakCalendar The calendar used to determine peak dates in the averaging period.
52 \param peakHoursPerDay The number of peak hours per day.
53 */
54 AverageOffPeakPowerHelper(const QuantLib::Handle<QuantLib::Quote>& price,
55 const QuantLib::ext::shared_ptr<CommodityIndex>& index,
56 const QuantLib::Date& start,
57 const QuantLib::Date& end,
58 const ext::shared_ptr<FutureExpiryCalculator>& calc,
59 const QuantLib::ext::shared_ptr<CommodityIndex>& peakIndex,
60 const QuantLib::Calendar& peakCalendar,
61 QuantLib::Natural peakHoursPerDay = 16);
62
63 /*! \param price The average price.
64 \param index The commodity index. Used to convey the off-peak commodity's name and calendar. The
65 underlying averaging cashflow may reference more than one commodity future indices.
66 \param start The start date of the averaging period. The averaging period includes the
67 start date if it is a pricing date according to the \p calendar.
68 \param end The end date of the averaging period. The averaging period includes the
69 end date if it is a pricing date according to the \p calendar.
70 \param calc A FutureExpiryCalculator instance.
71 \param peakIndex The commodity index for the peak electricity prices.
72 \param peakCalendar The calendar used to determine peak dates in the averaging period.
73 \param peakHoursPerDay The number of peak hours per day.
74 */
75 AverageOffPeakPowerHelper(QuantLib::Real price,
76 const QuantLib::ext::shared_ptr<CommodityIndex>& index,
77 const QuantLib::Date& start,
78 const QuantLib::Date& end,
79 const ext::shared_ptr<FutureExpiryCalculator>& calc,
80 const QuantLib::ext::shared_ptr<CommodityIndex>& peakIndex,
81 const QuantLib::Calendar& peakCalendar,
82 QuantLib::Natural peakHoursPerDay = 16);
83 //@}
84
85 //! \name PriceHelper interface
86 //@{
87 QuantLib::Real impliedQuote() const override;
88 void setTermStructure(PriceTermStructure* ts) override;
89 //@}
90
91 //! \name Visitability
92 //@{
93 void accept(QuantLib::AcyclicVisitor& v) override;
94 //@}
95
96 void deepUpdate() override;
97
98private:
99 //! Shared initialisation method.
100 void init(const QuantLib::ext::shared_ptr<CommodityIndex>& index,
101 const QuantLib::Date& start,
102 const QuantLib::Date& end,
103 const ext::shared_ptr<FutureExpiryCalculator>& calc,
104 const QuantLib::ext::shared_ptr<CommodityIndex>& peakIndex,
105 const QuantLib::Calendar& peakCalendar,
106 QuantLib::Natural peakHoursPerDay);
107
108 QuantLib::ext::shared_ptr<CommodityIndexedAverageCashFlow> businessOffPeak_;
109 QuantLib::ext::shared_ptr<CommodityIndexedAverageCashFlow> holidayOffPeak_;
110 QuantLib::ext::shared_ptr<CommodityIndexedAverageCashFlow> holidayPeak_;
111 QuantLib::Natural peakDays_;
112 QuantLib::Natural nonPeakDays_;
113
114 QuantLib::RelinkableHandle<PriceTermStructure> termStructureHandle_;
115};
116
117}
118
119#endif
AverageOffPeakPowerHelper(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::ext::shared_ptr< CommodityIndex > &peakIndex, const QuantLib::Calendar &peakCalendar, QuantLib::Natural peakHoursPerDay=16)
AverageOffPeakPowerHelper(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::ext::shared_ptr< CommodityIndex > &peakIndex, const QuantLib::Calendar &peakCalendar, QuantLib::Natural peakHoursPerDay=16)
void accept(QuantLib::AcyclicVisitor &v) override
QuantLib::ext::shared_ptr< CommodityIndexedAverageCashFlow > holidayOffPeak_
QuantLib::Real impliedQuote() const override
QuantLib::ext::shared_ptr< CommodityIndexedAverageCashFlow > businessOffPeak_
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::ext::shared_ptr< CommodityIndex > &peakIndex, const QuantLib::Calendar &peakCalendar, QuantLib::Natural peakHoursPerDay)
Shared initialisation method.
QuantLib::RelinkableHandle< PriceTermStructure > termStructureHandle_
QuantLib::ext::shared_ptr< CommodityIndexedAverageCashFlow > holidayPeak_
void setTermStructure(PriceTermStructure *ts) override
Cash flow dependent on the average commodity spot price or future's settlement price over a period....
Base class for classes that perform date calculations for future contracts.
QuantLib::BootstrapHelper< PriceTermStructure > PriceHelper
Term structure of prices.