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 <http://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
34namespace 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 bool growthOnly,
48 Real baseCPI,
49 const Period& observationLag,
50 ext::shared_ptr<ZeroInflationIndex> cpiIndex,
51 CPI::InterpolationType observationInterpolation,
52 const Schedule& schedule,
53 const std::vector<Rate>& coupons,
54 const DayCounter& accrualDayCounter,
55 BusinessDayConvention paymentConvention = ModifiedFollowing,
56 const Date& issueDate = Date(),
57 const Calendar& paymentCalendar = Calendar(),
58 const Period& exCouponPeriod = Period(),
59 const Calendar& exCouponCalendar = Calendar(),
60 BusinessDayConvention exCouponConvention = Unadjusted,
61 bool exCouponEndOfMonth = false);
62
63 Frequency frequency() const { return frequency_; }
64 const DayCounter& dayCounter() const { return dayCounter_; }
65 bool growthOnly() const { return growthOnly_; }
66 Real baseCPI() const { return baseCPI_; }
67 Period observationLag() const { return observationLag_; }
68 const ext::shared_ptr<ZeroInflationIndex>& cpiIndex() const { return cpiIndex_; }
69 CPI::InterpolationType observationInterpolation() const { return observationInterpolation_; }
70
71 protected:
72 Frequency frequency_;
73 DayCounter dayCounter_;
74 bool growthOnly_;
75 Real baseCPI_;
76 Period observationLag_;
77 ext::shared_ptr<ZeroInflationIndex> cpiIndex_;
78 CPI::InterpolationType observationInterpolation_;
79 };
80
81
82}
83
84
85
86
87
88
89#endif
90

source code of quantlib/ql/instruments/bonds/cpibond.hpp