QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
cpicapfloor.hpp
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
25#ifndef quantlib_cpicapfloor_hpp
26#define quantlib_cpicapfloor_hpp
27
28#include <ql/instrument.hpp>
29#include <ql/option.hpp>
30#include <ql/time/calendar.hpp>
31#include <ql/time/daycounter.hpp>
32#include <ql/indexes/inflationindex.hpp>
33#include <ql/cashflows/cpicoupon.hpp>
34
35namespace QuantLib {
36
38
62 class CPICapFloor : public Instrument {
63 public:
64 class arguments;
65 class engine;
66
69 const Date& startDate, // start date of contract (only)
70 Real baseCPI,
71 const Date& maturity, // this is pre-adjustment!
72 Calendar fixCalendar,
73 BusinessDayConvention fixConvention,
74 Calendar payCalendar,
75 BusinessDayConvention payConvention,
77 const ext::shared_ptr<ZeroInflationIndex>& inflationIndex,
79 CPI::InterpolationType observationInterpolation = CPI::AsIndex);
80
82
83 Option::Type type() const { return type_; }
84 Real nominal() const { return nominal_; }
86 Rate strike() const { return strike_; }
87 Date fixingDate() const;
88 Date payDate() const;
89 const ext::shared_ptr<ZeroInflationIndex>& index() const { return index_; }
92
94
95 bool isExpired() const override;
96 void setupArguments(PricingEngine::arguments*) const override;
98
99 protected:
110 ext::shared_ptr<ZeroInflationIndex> index_;
113 };
114
115
117 public:
126 ext::shared_ptr<ZeroInflationIndex> index;
129
130 void validate() const override;
131 };
132
133 class CPICapFloor::engine : public GenericEngine<CPICapFloor::arguments,
134 CPICapFloor::results> {};
135
136}
137
138
139#endif
140
BusinessDayConvention payConvention
CPI::InterpolationType observationInterpolation
ext::shared_ptr< ZeroInflationIndex > index
BusinessDayConvention fixConvention
void validate() const override
Definition: cpicapfloor.cpp:89
CPI cap or floor.
Definition: cpicapfloor.hpp:62
Date fixingDate() const
Definition: cpicapfloor.cpp:74
void setupArguments(PricingEngine::arguments *) const override
Definition: cpicapfloor.cpp:94
bool isExpired() const override
returns whether the instrument might have value greater than zero.
Definition: cpicapfloor.cpp:84
ext::shared_ptr< ZeroInflationIndex > index_
Period observationLag() const
Definition: cpicapfloor.hpp:90
Real nominal() const
Definition: cpicapfloor.hpp:84
Option::Type type() const
Definition: cpicapfloor.hpp:83
Date payDate() const
Definition: cpicapfloor.cpp:79
CPI::InterpolationType observationInterpolation_
BusinessDayConvention payConvention_
Rate strike() const
in the above formula.
Definition: cpicapfloor.hpp:86
BusinessDayConvention fixConvention_
const ext::shared_ptr< ZeroInflationIndex > & index() const
Definition: cpicapfloor.hpp:89
calendar class
Definition: calendar.hpp:61
Concrete date class.
Definition: date.hpp:125
template base class for option pricing engines
Abstract instrument class.
Definition: instrument.hpp:44
BusinessDayConvention
Business Day conventions.
QL_REAL Real
real number
Definition: types.hpp:50
Real Rate
interest rates
Definition: types.hpp:70
Definition: any.hpp:35
InterpolationType
when you observe an index, how do you interpolate between fixings?
@ AsIndex
same interpolation as index