QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
zerocouponinflationswap.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) 2007, 2009 Chris Kenyon
5 Copyright (C) 2009 StatPro Italia srl
6 Copyright (C) 2021 Ralf Konrad Eckel
7
8 This file is part of QuantLib, a free-software/open-source library
9 for financial quantitative analysts and developers - http://quantlib.org/
10
11 QuantLib is free software: you can redistribute it and/or modify it
12 under the terms of the QuantLib license. You should have received a
13 copy of the license along with this program; if not, please email
14 <quantlib-dev@lists.sf.net>. The license is also available online at
15 <http://quantlib.org/license.shtml>.
16
17 This program is distributed in the hope that it will be useful, but WITHOUT
18 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
19 FOR A PARTICULAR PURPOSE. See the license for more details.
20 */
21
22/*! \file zerocouponinflationswap.hpp
23 \brief Zero-coupon inflation-indexed swap
24 */
25
26#ifndef quantlib_xxxzciis_hpp
27#define quantlib_xxxzciis_hpp
28
31#include <ql/time/calendar.hpp>
33
34
35namespace QuantLib {
36 //! Zero-coupon inflation-indexed swap
37 /*! Quoted as a fixed rate \f$ K \f$. At start:
38 \f[
39 P_n(0,T) N [(1+K)^{T}-1] =
40 P_n(0,T) N \left[ \frac{I(T)}{I(0)} -1 \right]
41 \f]
42 where \f$ T \f$ is the maturity time, \f$ P_n(0,t) \f$ is the
43 nominal discount factor at time \f$ t \f$, \f$ N \f$ is the
44 notional, and \f$ I(t) \f$ is the inflation index value at
45 time \f$ t \f$.
46
47 This inherits from swap and has two very simple legs: a fixed
48 leg, from the quote (K); and an indexed leg. At maturity the
49 two single cashflows are swapped. These are the notional
50 versus the inflation-indexed notional Because the coupons are
51 zero there are no accruals (and no coupons).
52
53 In this swap, the passed type (Payer or Receiver) refers to
54 the inflation leg.
55
56 Inflation is generally available on every day, including
57 holidays and weekends. Hence there is a variable to state
58 whether the observe/fix dates for inflation are adjusted or
59 not. The default is not to adjust.
60
61 A zero inflation swap is a simple enough instrument that the
62 standard discounting pricing engine that works for a vanilla
63 swap also works.
64
65 \note we do not need Schedules on the legs because they use
66 one or two dates only per leg.
67 */
69 public:
70 class arguments;
71 class engine;
72
75 const Date& startDate, // start date of contract (only)
76 const Date& maturity, // this is pre-adjustment!
77 Calendar fixCalendar,
78 BusinessDayConvention fixConvention,
81 const ext::shared_ptr<ZeroInflationIndex>& infIndex,
84 bool adjustInfObsDates = false,
85 Calendar infCalendar = Calendar(),
87
88 //! \name Inspectors
89 //@{
90 //! "Payer" or "Receiver" refers to the inflation leg
91 Type type() const { return type_; }
92 Real nominal() const { return nominal_; }
93 Date startDate() const override { return startDate_; }
94 Date maturityDate() const override { return maturityDate_; }
97 return fixConvention_;
98 }
99 DayCounter dayCounter() const { return dayCounter_; }
100 //! \f$ K \f$ in the above formula.
101 Rate fixedRate() const { return fixedRate_; }
102 ext::shared_ptr<ZeroInflationIndex> inflationIndex() const {
103 return infIndex_;
104 }
108 }
112 return infConvention_;
113 }
114 //! just one cashflow (that is not a coupon) in each leg
115 const Leg& fixedLeg() const;
116 //! just one cashflow (that is not a coupon) in each leg
117 const Leg& inflationLeg() const;
118 //@}
119
120 //! \name Results
121 //@{
122 Real fixedLegNPV() const;
123 Real inflationLegNPV() const;
124 Real fairRate() const;
125 //@}
126
127 protected:
134 ext::shared_ptr<ZeroInflationIndex> infIndex_;
142 };
143
144
146 public:
148 };
149
150
152 : public GenericEngine<ZeroCouponInflationSwap::arguments,
153 ZeroCouponInflationSwap::results> {};
154
155}
156
157
158#endif
calendar class
calendar class
Definition: calendar.hpp:61
Concrete date class.
Definition: date.hpp:125
day counter class
Definition: daycounter.hpp:44
template base class for option pricing engines
Interest rate swap.
Definition: swap.hpp:41
Zero-coupon inflation-indexed swap.
Rate fixedRate() const
in the above formula.
ext::shared_ptr< ZeroInflationIndex > inflationIndex() const
CPI::InterpolationType observationInterpolation() const
BusinessDayConvention fixedConvention() const
const Leg & fixedLeg() const
just one cashflow (that is not a coupon) in each leg
BusinessDayConvention inflationConvention() const
ext::shared_ptr< ZeroInflationIndex > infIndex_
Type type() const
"Payer" or "Receiver" refers to the inflation leg
const Leg & inflationLeg() const
just one cashflow (that is not a coupon) in each leg
day counter class
BusinessDayConvention
Business Day conventions.
QL_REAL Real
real number
Definition: types.hpp:50
Real Rate
interest rates
Definition: types.hpp:70
base classes for inflation indexes
Definition: any.hpp:35
std::vector< ext::shared_ptr< CashFlow > > Leg
Sequence of cash-flows.
Definition: cashflow.hpp:78
InterpolationType
when you observe an index, how do you interpolate between fixings?
Interest rate swap.