ratehelpers.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) 2005, 2006, 2007 Eric Ehlers
5  Copyright (C) 2005 Aurelien Chanudet
6  Copyright (C) 2005 Plamen Neykov
7  Copyright (C) 2006, 2007, 2008, 2009, 2012, 2015 Ferdinando Ametrano
8  Copyright (C) 2007 Marco Bianchetti
9  Copyright (C) 2015 Maddalena Zanzi
10 
11  This file is part of QuantLib, a free-software/open-source library
12  for financial quantitative analysts and developers - http://quantlib.org/
13 
14  QuantLib is free software: you can redistribute it and/or modify it
15  under the terms of the QuantLib license. You should have received a
16  copy of the license along with this program; if not, please email
17  <quantlib-dev@lists.sf.net>. The license is also available online at
18  <http://quantlib.org/license.shtml>.
19 
20  This program is distributed in the hope that it will be useful, but WITHOUT
21  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
22  FOR A PARTICULAR PURPOSE. See the license for more details.
23 */
24 
25 #ifndef qla_ratehelpers_hpp
26 #define qla_ratehelpers_hpp
27 
28 #include <oh/libraryobject.hpp>
29 
30 #include <ql/types.hpp>
31 #include <ql/time/businessdayconvention.hpp>
32 #include <ql/time/frequency.hpp>
33 #include <ql/instruments/futures.hpp>
34 #include <ql/termstructures/bootstraphelper.hpp>
35 
36 namespace QuantLib {
37  class YieldTermStructure;
38 
39  template<class TS>
41 
43 
44  class Quote;
45  class Period;
46  class Calendar;
47  class DayCounter;
48  class IborIndex;
49  class OvernightIndex;
50  class SwapIndex;
51  class Schedule;
52  class Date;
53  class Bond;
54  template <class T>
55  class Handle;
56 
57 }
58 
59 namespace QuantLibAddin {
60 
61  class RateHelper : public ObjectHandler::LibraryObject<QuantLib::RateHelper> {
62  public:
67  };
68  std::string quoteName() { return quoteName_; }
69  protected:
71  std::string quoteName_;
72  };
73 
74  class DepositRateHelper : public RateHelper {
75  public:
77  const boost::shared_ptr<ObjectHandler::ValueObject>& properties,
79  const boost::shared_ptr<QuantLib::IborIndex>& iborIndex,
80  bool permanent);
82  const boost::shared_ptr<ObjectHandler::ValueObject>& properties,
84  const QuantLib::Period& p,
85  QuantLib::Natural settlementDays,
86  const QuantLib::Calendar& calendar,
87  QuantLib::BusinessDayConvention convention,
88  bool endOfMonth,
89  const QuantLib::DayCounter& dayCounter,
90  bool permanent);
91  };
92 
93  class FuturesRateHelper : public RateHelper {
94  public:
96  const boost::shared_ptr<ObjectHandler::ValueObject>& properties,
98  QuantLib::Futures::Type type,
99  const QuantLib::Date& immDate,
100  const boost::shared_ptr<QuantLib::IborIndex>& iborIndex,
101  const QuantLib::Handle<QuantLib::Quote>& convAdj,
102  bool permanent);
104  const boost::shared_ptr<ObjectHandler::ValueObject>& properties,
106  QuantLib::Futures::Type type,
107  const QuantLib::Date& immDate,
108  QuantLib::Natural lengthInMonths,
109  const QuantLib::Calendar& calendar,
110  QuantLib::BusinessDayConvention convention,
111  bool endOfMonth,
112  const QuantLib::DayCounter& dayCounter,
113  const QuantLib::Handle<QuantLib::Quote>& convAdj,
114  bool permanent);
116  const boost::shared_ptr<ObjectHandler::ValueObject>& properties,
118  QuantLib::Futures::Type type,
119  const QuantLib::Date& immDate,
120  const QuantLib::Date& endDate,
121  const QuantLib::DayCounter& dayCounter,
122  const QuantLib::Handle<QuantLib::Quote>& convAdj,
123  bool permanent);
124  };
125 
126  class SwapRateHelper : public RateHelper {
127  public:
129  const boost::shared_ptr<ObjectHandler::ValueObject>& properties,
131  const boost::shared_ptr<QuantLib::SwapIndex>& swapIndex,
132  const QuantLib::Handle<QuantLib::Quote>& spread,
133  const QuantLib::Period& forwardStart,
135  QuantLib::Pillar::Choice pillarChoice,
136  QuantLib::Date customPillar,
137  bool permanent);
139  const boost::shared_ptr<ObjectHandler::ValueObject>& properties,
141  QuantLib::Natural settlementDays,
142  const QuantLib::Period& p,
143  const QuantLib::Calendar& calendar,
144  const QuantLib::Frequency& fixedFrequency,
145  QuantLib::BusinessDayConvention fixedConvention,
146  const QuantLib::DayCounter& fixedDayCounter,
147  const boost::shared_ptr<QuantLib::IborIndex>& iborIndex,
148  const QuantLib::Handle<QuantLib::Quote>& spread,
149  const QuantLib::Period& forwardStart,
151  QuantLib::Pillar::Choice pillarChoice,
152  QuantLib::Date customPillar,
153  bool permanent);
154  };
155 
156  class FraRateHelper : public RateHelper {
157  public:
159  const boost::shared_ptr<ObjectHandler::ValueObject>& properties,
161  QuantLib::Period periodToStart,
162  const boost::shared_ptr<QuantLib::IborIndex>& iborIndex,
163  QuantLib::Pillar::Choice pillarChoice,
164  QuantLib::Date customPillar,
165  bool permanent);
167  const boost::shared_ptr<ObjectHandler::ValueObject>& properties,
169  QuantLib::Period periodToStart,
170  QuantLib::Natural lengthInMonths,
171  QuantLib::Natural fixingDays,
172  const QuantLib::Calendar& calendar,
173  QuantLib::BusinessDayConvention convention,
174  bool endOfMonth,
175  const QuantLib::DayCounter& dayCounter,
176  QuantLib::Pillar::Choice pillarChoice,
177  QuantLib::Date customPillar,
178  bool permanent);
179  };
180 
181  class OISRateHelper : public RateHelper {
182  public:
184  const boost::shared_ptr<ObjectHandler::ValueObject>& properties,
185  QuantLib::Natural settlementDays,
186  const QuantLib::Period& tenor, // swap maturity
187  const QuantLib::Handle<QuantLib::Quote>& fixedRate,
188  const boost::shared_ptr<QuantLib::OvernightIndex>& overnightIndex,
190  bool telescopicValueDates,
191  QuantLib::Natural paymentLag,
192  bool permanent);
193  };
194 
196  public:
198  const boost::shared_ptr<ObjectHandler::ValueObject>& properties,
199  const QuantLib::Date& startDate,
200  const QuantLib::Date& endDate,
201  const QuantLib::Handle<QuantLib::Quote>& fixedRate,
202  const boost::shared_ptr<QuantLib::OvernightIndex>& overnightIndex,
204  bool permanent);
205  };
206 
207  class BondHelper : public RateHelper {
208  public:
209  BondHelper(
210  const boost::shared_ptr<ObjectHandler::ValueObject>& properties,
212  const boost::shared_ptr<QuantLib::Bond>& bond,
213  const bool useCleanPrice,
214  bool permanent);
215  };
216 
218  public:
220  const boost::shared_ptr<ObjectHandler::ValueObject>& properties,
222  QuantLib::Natural settlementDays,
223  QuantLib::Real faceAmount,
224  const boost::shared_ptr<QuantLib::Schedule>& schedule,
225  const std::vector<QuantLib::Rate>& coupons,
226  const QuantLib::DayCounter& accrualDayCounter,
227  QuantLib::BusinessDayConvention paymentConvention,
228  QuantLib::Real redemption,
229  const QuantLib::Date& issueDate,
230  const QuantLib::Calendar& paymentCalendar,
231  const QuantLib::Period& exCouponPeriod,
232  const QuantLib::Calendar& exCouponCalendar,
233  const QuantLib::BusinessDayConvention exCouponConvention,
234  bool exCouponEndOfMonth,
235  const bool useCleanPrice,
236  bool permanent);
237  };
238 
239  class FxSwapRateHelper : public RateHelper {
240  public:
242  const boost::shared_ptr<ObjectHandler::ValueObject>& properties,
243  const QuantLib::Handle<QuantLib::Quote>& fwdPoint,
244  const QuantLib::Handle<QuantLib::Quote>& spotFx,
245  const QuantLib::Period& tenor,
246  QuantLib::Natural fixingDays,
247  const QuantLib::Calendar& calendar,
248  QuantLib::BusinessDayConvention convention,
249  bool endOfMonth,
250  bool isFxBaseCurrencyCollateralCurrency,
251  const QuantLib::Handle<QuantLib::YieldTermStructure>& collateralCurve,
252  bool permanent);
253 
254  };
255 
256 
257 
258  // Processes the set of curve bootstrapping instruments
259  // and selects a subset according to the given rules and parameters
260  std::vector<std::string> qlRateHelperSelection(
261  const std::vector<boost::shared_ptr<QuantLibAddin::RateHelper> >& qlarhs,
262  const std::vector<QuantLib::Natural>& priority,
263  QuantLib::Natural nImmFutures,
264  QuantLib::Natural nSerialFutures,
265  QuantLib::Natural frontFuturesRollingDays,
266  RateHelper::DepoInclusionCriteria depoInclusionCriteria,
267  const std::vector<QuantLib::Natural>& minDistance);
268 
269  // Returns the rate, if any, associated to the given rate helper
270  QuantLib::Real qlRateHelperRate(
271  const boost::shared_ptr<QuantLibAddin::RateHelper>& qlarh);
272 
273 }
274 
275 #endif
Definition: basketlossmodels.hpp:32
@ DeposBeforeFirstFuturesStartDatePlusOne
Definition: ratehelpers.hpp:65
SwapRateHelper(const boost::shared_ptr< ObjectHandler::ValueObject > &properties, const QuantLib::Handle< QuantLib::Quote > &quote, const boost::shared_ptr< QuantLib::SwapIndex > &swapIndex, const QuantLib::Handle< QuantLib::Quote > &spread, const QuantLib::Period &forwardStart, const QuantLib::Handle< QuantLib::YieldTermStructure > &discount, QuantLib::Pillar::Choice pillarChoice, QuantLib::Date customPillar, bool permanent)
FuturesRateHelper(const boost::shared_ptr< ObjectHandler::ValueObject > &properties, const QuantLib::Handle< QuantLib::Quote > &price, QuantLib::Futures::Type type, const QuantLib::Date &immDate, const boost::shared_ptr< QuantLib::IborIndex > &iborIndex, const QuantLib::Handle< QuantLib::Quote > &convAdj, bool permanent)
Definition: ratehelpers.hpp:156
Definition: ratehelpers.hpp:126
FixedRateBondHelper(const boost::shared_ptr< ObjectHandler::ValueObject > &properties, const QuantLib::Handle< QuantLib::Quote > &price, QuantLib::Natural settlementDays, QuantLib::Real faceAmount, const boost::shared_ptr< QuantLib::Schedule > &schedule, const std::vector< QuantLib::Rate > &coupons, const QuantLib::DayCounter &accrualDayCounter, QuantLib::BusinessDayConvention paymentConvention, QuantLib::Real redemption, const QuantLib::Date &issueDate, const QuantLib::Calendar &paymentCalendar, const QuantLib::Period &exCouponPeriod, const QuantLib::Calendar &exCouponCalendar, const QuantLib::BusinessDayConvention exCouponConvention, bool exCouponEndOfMonth, const bool useCleanPrice, bool permanent)
DatedOISRateHelper(const boost::shared_ptr< ObjectHandler::ValueObject > &properties, const QuantLib::Date &startDate, const QuantLib::Date &endDate, const QuantLib::Handle< QuantLib::Quote > &fixedRate, const boost::shared_ptr< QuantLib::OvernightIndex > &overnightIndex, const QuantLib::Handle< QuantLib::YieldTermStructure > &discount, bool permanent)
Definition: ratehelpers.hpp:217
QuantLib::Real qlRateHelperRate(const boost::shared_ptr< QuantLibAddin::RateHelper > &qlarh)
@ AllDepos
Definition: ratehelpers.hpp:63
OH_LIB_CTOR(RateHelper, QuantLib::RateHelper)
OISRateHelper(const boost::shared_ptr< ObjectHandler::ValueObject > &properties, QuantLib::Natural settlementDays, const QuantLib::Period &tenor, const QuantLib::Handle< QuantLib::Quote > &fixedRate, const boost::shared_ptr< QuantLib::OvernightIndex > &overnightIndex, const QuantLib::Handle< QuantLib::YieldTermStructure > &discount, bool telescopicValueDates, QuantLib::Natural paymentLag, bool permanent)
DepoInclusionCriteria
Definition: ratehelpers.hpp:63
Definition: ratehelpers.hpp:93
BondHelper(const boost::shared_ptr< ObjectHandler::ValueObject > &properties, const QuantLib::Handle< QuantLib::Quote > &price, const boost::shared_ptr< QuantLib::Bond > &bond, const bool useCleanPrice, bool permanent)
Definition: ratehelpers.hpp:74
FxSwapRateHelper(const boost::shared_ptr< ObjectHandler::ValueObject > &properties, const QuantLib::Handle< QuantLib::Quote > &fwdPoint, const QuantLib::Handle< QuantLib::Quote > &spotFx, const QuantLib::Period &tenor, QuantLib::Natural fixingDays, const QuantLib::Calendar &calendar, QuantLib::BusinessDayConvention convention, bool endOfMonth, bool isFxBaseCurrencyCollateralCurrency, const QuantLib::Handle< QuantLib::YieldTermStructure > &collateralCurve, bool permanent)
Definition: ratehelpers.hpp:207
@ DeposBeforeFirstFuturesExpiryDate
Definition: ratehelpers.hpp:66
Definition: ratehelpers.hpp:195
Definition: ratehelpers.hpp:40
std::string quoteName_
Definition: ratehelpers.hpp:71
Definition: abcd.hpp:38
Definition: ratehelpers.hpp:181
Definition: ratehelpers.hpp:61
Definition: abcd.hpp:30
@ DeposBeforeFirstFuturesStartDate
Definition: ratehelpers.hpp:64
std::vector< std::string > qlRateHelperSelection(const std::vector< boost::shared_ptr< QuantLibAddin::RateHelper > > &qlarhs, const std::vector< QuantLib::Natural > &priority, QuantLib::Natural nImmFutures, QuantLib::Natural nSerialFutures, QuantLib::Natural frontFuturesRollingDays, RateHelper::DepoInclusionCriteria depoInclusionCriteria, const std::vector< QuantLib::Natural > &minDistance)
std::string quoteName()
Definition: ratehelpers.hpp:68
BootstrapHelper< YieldTermStructure > RateHelper
Definition: ratehelpers.hpp:40
FraRateHelper(const boost::shared_ptr< ObjectHandler::ValueObject > &properties, const QuantLib::Handle< QuantLib::Quote > &rate, QuantLib::Period periodToStart, const boost::shared_ptr< QuantLib::IborIndex > &iborIndex, QuantLib::Pillar::Choice pillarChoice, QuantLib::Date customPillar, bool permanent)
DepositRateHelper(const boost::shared_ptr< ObjectHandler::ValueObject > &properties, const QuantLib::Handle< QuantLib::Quote > &rate, const boost::shared_ptr< QuantLib::IborIndex > &iborIndex, bool permanent)
Definition: ratehelpers.hpp:239