/src/quantlib/ql/instruments/bonds/cpibond.hpp
Line | Count | Source |
1 | | /* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
2 | | |
3 | | /* |
4 | | Copyright (C) 2010, 2011 Chris Kenyon |
5 | | |
6 | | This file is part of QuantLib, a free-software/open-source library |
7 | | for financial quantitative analysts and developers - http://quantlib.org/ |
8 | | |
9 | | QuantLib is free software: you can redistribute it and/or modify it |
10 | | under the terms of the QuantLib license. You should have received a |
11 | | copy of the license along with this program; if not, please email |
12 | | <quantlib-dev@lists.sf.net>. The license is also available online at |
13 | | <https://www.quantlib.org/license.shtml>. |
14 | | |
15 | | This program is distributed in the hope that it will be useful, but WITHOUT |
16 | | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
17 | | FOR A PARTICULAR PURPOSE. See the license for more details. |
18 | | */ |
19 | | |
20 | | /*! \file cpibond.hpp |
21 | | \brief zero-inflation-indexed-ratio-with-base bond |
22 | | */ |
23 | | |
24 | | #ifndef quantlib_cpibond_hpp |
25 | | #define quantlib_cpibond_hpp |
26 | | |
27 | | |
28 | | #include <ql/instruments/bond.hpp> |
29 | | #include <ql/time/dategenerationrule.hpp> |
30 | | #include <ql/time/daycounter.hpp> |
31 | | #include <ql/interestrate.hpp> |
32 | | #include <ql/cashflows/cpicoupon.hpp> |
33 | | |
34 | | namespace QuantLib { |
35 | | |
36 | | class Schedule; |
37 | | |
38 | | //! cpi bond; if there is only one date in the schedule it |
39 | | //! is a zero bond returning an inflated notional. |
40 | | /*! \ingroup instruments |
41 | | |
42 | | */ |
43 | | class CPIBond : public Bond { |
44 | | public: |
45 | | CPIBond(Natural settlementDays, |
46 | | Real faceAmount, |
47 | | Real baseCPI, |
48 | | const Period& observationLag, |
49 | | ext::shared_ptr<ZeroInflationIndex> cpiIndex, |
50 | | CPI::InterpolationType observationInterpolation, |
51 | | Schedule schedule, |
52 | | const std::vector<Rate>& coupons, |
53 | | const DayCounter& accrualDayCounter, |
54 | | BusinessDayConvention paymentConvention = ModifiedFollowing, |
55 | | const Date& issueDate = Date(), |
56 | | const Calendar& paymentCalendar = Calendar(), |
57 | | const Period& exCouponPeriod = Period(), |
58 | | const Calendar& exCouponCalendar = Calendar(), |
59 | | BusinessDayConvention exCouponConvention = Unadjusted, |
60 | | bool exCouponEndOfMonth = false); |
61 | | |
62 | | /*! \deprecated Use the overload without the growthOnly parameter. |
63 | | Deprecated in version 1.40. |
64 | | */ |
65 | | [[deprecated("Use the overload without the growthOnly parameter")]] |
66 | | CPIBond(Natural settlementDays, |
67 | | Real faceAmount, |
68 | | bool growthOnly, |
69 | | Real baseCPI, |
70 | | const Period& observationLag, |
71 | | ext::shared_ptr<ZeroInflationIndex> cpiIndex, |
72 | | CPI::InterpolationType observationInterpolation, |
73 | | Schedule schedule, |
74 | | const std::vector<Rate>& coupons, |
75 | | const DayCounter& accrualDayCounter, |
76 | | BusinessDayConvention paymentConvention = ModifiedFollowing, |
77 | | const Date& issueDate = Date(), |
78 | | const Calendar& paymentCalendar = Calendar(), |
79 | | const Period& exCouponPeriod = Period(), |
80 | | const Calendar& exCouponCalendar = Calendar(), |
81 | | BusinessDayConvention exCouponConvention = Unadjusted, |
82 | | bool exCouponEndOfMonth = false); |
83 | | |
84 | 0 | Frequency frequency() const { return frequency_; } |
85 | 0 | const DayCounter& dayCounter() const { return dayCounter_; } |
86 | 0 | bool growthOnly() const { return growthOnly_; } |
87 | 0 | Real baseCPI() const { return baseCPI_; } |
88 | 0 | Period observationLag() const { return observationLag_; } |
89 | 0 | const ext::shared_ptr<ZeroInflationIndex>& cpiIndex() const { return cpiIndex_; } |
90 | 0 | CPI::InterpolationType observationInterpolation() const { return observationInterpolation_; } |
91 | | |
92 | | protected: |
93 | | Frequency frequency_; |
94 | | DayCounter dayCounter_; |
95 | | bool growthOnly_; |
96 | | Real baseCPI_; |
97 | | Period observationLag_; |
98 | | ext::shared_ptr<ZeroInflationIndex> cpiIndex_; |
99 | | CPI::InterpolationType observationInterpolation_; |
100 | | }; |
101 | | |
102 | | |
103 | | } |
104 | | |
105 | | |
106 | | |
107 | | |
108 | | |
109 | | |
110 | | #endif |