QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.38
Loading...
Searching...
No Matches
oisratehelper.hpp
Go to the documentation of this file.
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3/*
4 Copyright (C) 2009, 2012 Roland Lichters
5 Copyright (C) 2009, 2012 Ferdinando Ametrano
6
7 This file is part of QuantLib, a free-software/open-source library
8 for financial quantitative analysts and developers - http://quantlib.org/
9
10 QuantLib is free software: you can redistribute it and/or modify it
11 under the terms of the QuantLib license. You should have received a
12 copy of the license along with this program; if not, please email
13 <quantlib-dev@lists.sf.net>. The license is also available online at
14 <http://quantlib.org/license.shtml>.
15
16 This program is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18 FOR A PARTICULAR PURPOSE. See the license for more details.
19*/
20
21/*! \file oisratehelper.hpp
22 \brief Overnight Indexed Swap (aka OIS) rate helpers
23*/
24
25#ifndef quantlib_oisratehelper_hpp
26#define quantlib_oisratehelper_hpp
27
30#include <ql/optional.hpp>
31#include <variant>
32
33namespace QuantLib {
34
35 class FloatingRateCouponPricer;
36
37 //! Rate helper for bootstrapping over Overnight Indexed Swap rates
39 public:
40 OISRateHelper(Natural settlementDays,
41 const Period& tenor, // swap maturity
42 const Handle<Quote>& fixedRate,
43 const ext::shared_ptr<OvernightIndex>& overnightIndex,
44 // exogenous discounting curve
45 Handle<YieldTermStructure> discountingCurve = {},
46 bool telescopicValueDates = false,
47 Integer paymentLag = 0,
48 BusinessDayConvention paymentConvention = Following,
49 Frequency paymentFrequency = Annual,
50 Calendar paymentCalendar = Calendar(),
51 const Period& forwardStart = 0 * Days,
52 const std::variant<Spread, Handle<Quote>>& overnightSpread = Spread(0.0),
54 Date customPillarDate = Date(),
56 ext::optional<bool> endOfMonth = ext::nullopt,
57 ext::optional<Frequency> fixedPaymentFrequency = ext::nullopt,
58 Calendar fixedCalendar = Calendar(),
59 Natural lookbackDays = Null<Natural>(),
60 Natural lockoutDays = 0,
61 bool applyObservationShift = false,
62 ext::shared_ptr<FloatingRateCouponPricer> pricer = {},
64 Calendar overnightCalendar = Calendar());
65
66 OISRateHelper(const Date& startDate,
67 const Date& endDate,
68 const Handle<Quote>& fixedRate,
69 const ext::shared_ptr<OvernightIndex>& overnightIndex,
70 // exogenous discounting curve
71 Handle<YieldTermStructure> discountingCurve = {},
72 bool telescopicValueDates = false,
73 Integer paymentLag = 0,
74 BusinessDayConvention paymentConvention = Following,
75 Frequency paymentFrequency = Annual,
76 Calendar paymentCalendar = Calendar(),
77 const std::variant<Spread, Handle<Quote>>& overnightSpread = Spread(0.0),
79 Date customPillarDate = Date(),
81 ext::optional<bool> endOfMonth = ext::nullopt,
82 ext::optional<Frequency> fixedPaymentFrequency = ext::nullopt,
83 Calendar fixedCalendar = Calendar(),
84 Natural lookbackDays = Null<Natural>(),
85 Natural lockoutDays = 0,
86 bool applyObservationShift = false,
87 ext::shared_ptr<FloatingRateCouponPricer> pricer = {},
89 Calendar overnightCalendar = Calendar());
90
91 //! \name RateHelper interface
92 //@{
93 Real impliedQuote() const override;
95 //@}
96 //! \name inspectors
97 //@{
98 // NOLINTNEXTLINE(cppcoreguidelines-noexcept-swap,performance-noexcept-swap)
99 ext::shared_ptr<OvernightIndexedSwap> swap() const { return swap_; }
100 //@}
101 //! \name Visitability
102 //@{
103 void accept(AcyclicVisitor&) override;
104 //@}
105 protected:
106 void initialize(const ext::shared_ptr<OvernightIndex>& overnightIndex,
107 Date customPillarDate);
108 void initializeDates() override;
109
113 ext::shared_ptr<OvernightIndex> overnightIndex_;
114
115 ext::shared_ptr<OvernightIndexedSwap> swap_;
117
121
130 ext::optional<bool> endOfMonth_;
131 ext::optional<Frequency> fixedPaymentFrequency_;
137 ext::shared_ptr<FloatingRateCouponPricer> pricer_;
139
140 };
141
142 /*! \deprecated Use OISRateHelper instead.
143 Deprecated in version 1.37.
144 */
145 class [[deprecated("Use OISRateHelper instead")]] DatedOISRateHelper : public OISRateHelper {
146 public:
147 DatedOISRateHelper(const Date& startDate,
148 const Date& endDate,
149 const Handle<Quote>& fixedRate,
150 const ext::shared_ptr<OvernightIndex>& overnightIndex,
151 // exogenous discounting curve
152 Handle<YieldTermStructure> discountingCurve = {},
153 bool telescopicValueDates = false,
154 RateAveraging::Type averagingMethod = RateAveraging::Compound,
155 Integer paymentLag = 0,
156 BusinessDayConvention paymentConvention = Following,
157 Frequency paymentFrequency = Annual,
158 const Calendar& paymentCalendar = Calendar(),
159 Spread overnightSpread = {},
160 ext::optional<bool> endOfMonth = ext::nullopt,
161 ext::optional<Frequency> fixedPaymentFrequency = ext::nullopt,
162 const Calendar& fixedCalendar = Calendar(),
163 Natural lookbackDays = Null<Natural>(),
164 Natural lockoutDays = 0,
165 bool applyObservationShift = false,
166 const ext::shared_ptr<FloatingRateCouponPricer>& pricer = {});
167
168 /*! \deprecated Use the overload without forward start.
169 Deprecated in version 1.35.
170 */
171 [[deprecated("Use the overload without forward start")]]
172 DatedOISRateHelper(const Date& startDate,
173 const Date& endDate,
174 const Handle<Quote>& fixedRate,
175 const ext::shared_ptr<OvernightIndex>& overnightIndex,
176 // exogenous discounting curve
177 Handle<YieldTermStructure> discountingCurve,
178 bool telescopicValueDates,
179 RateAveraging::Type averagingMethod,
180 Integer paymentLag,
181 BusinessDayConvention paymentConvention,
182 Frequency paymentFrequency,
183 const Calendar& paymentCalendar,
184 const Period& forwardStart,
185 Spread overnightSpread = {},
186 ext::optional<bool> endOfMonth = ext::nullopt,
187 ext::optional<Frequency> fixedPaymentFrequency = ext::nullopt,
188 const Calendar& fixedCalendar = Calendar());
189 };
190
191}
192
193#endif
degenerate base class for the Acyclic Visitor pattern
Definition: visitor.hpp:33
calendar class
Definition: calendar.hpp:61
Concrete date class.
Definition: date.hpp:125
Shared handle to an observable.
Definition: handle.hpp:41
template class providing a null value for a given type.
Definition: null.hpp:59
Rate helper for bootstrapping over Overnight Indexed Swap rates.
ext::shared_ptr< OvernightIndex > overnightIndex_
RelinkableHandle< YieldTermStructure > discountRelinkableHandle_
void setTermStructure(YieldTermStructure *) override
void initialize(const ext::shared_ptr< OvernightIndex > &overnightIndex, Date customPillarDate)
RelinkableHandle< YieldTermStructure > termStructureHandle_
Pillar::Choice pillarChoice_
Handle< YieldTermStructure > discountHandle_
ext::shared_ptr< FloatingRateCouponPricer > pricer_
void accept(AcyclicVisitor &) override
ext::optional< bool > endOfMonth_
DateGeneration::Rule rule_
RateAveraging::Type averagingMethod_
void initializeDates() override
ext::shared_ptr< OvernightIndexedSwap > swap_
BusinessDayConvention paymentConvention_
Real impliedQuote() const override
Handle< Quote > overnightSpread_
ext::shared_ptr< OvernightIndexedSwap > swap() const
ext::optional< Frequency > fixedPaymentFrequency_
Bootstrap helper with date schedule relative to global evaluation date.
Relinkable handle to an observable.
Definition: handle.hpp:117
Interest-rate term structure.
Frequency
Frequency of events.
Definition: frequency.hpp:37
BusinessDayConvention
Business Day conventions.
@ Annual
once a year
Definition: frequency.hpp:39
QL_REAL Real
real number
Definition: types.hpp:50
unsigned QL_INTEGER Natural
positive integer
Definition: types.hpp:43
QL_INTEGER Integer
integer number
Definition: types.hpp:35
Real Spread
spreads on interest rates
Definition: types.hpp:74
constexpr const boost::none_t & nullopt
Definition: optional.hpp:44
Definition: any.hpp:37
Maps optional to either the boost or std implementation.
Overnight index swap paying compounded overnight vs. fixed.
deposit, FRA, futures, and various swap rate helpers
Choice
Alternatives ways of determining the pillar date.
@ LastRelevantDate
instruments maturity date