/src/quantlib/ql/instruments/cliquetoption.hpp
Line | Count | Source |
1 | | /* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
2 | | |
3 | | /* |
4 | | Copyright (C) 2003, 2004, 2007 StatPro Italia srl |
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 cliquetoption.hpp |
21 | | \brief Cliquet option |
22 | | */ |
23 | | |
24 | | #ifndef ql_cliquet_option_hpp |
25 | | #define ql_cliquet_option_hpp |
26 | | |
27 | | #include <ql/instruments/oneassetoption.hpp> |
28 | | #include <ql/instruments/payoffs.hpp> |
29 | | #include <ql/time/date.hpp> |
30 | | #include <vector> |
31 | | |
32 | | namespace QuantLib { |
33 | | |
34 | | class EuropeanExercise; |
35 | | |
36 | | //! cliquet (Ratchet) option |
37 | | /*! A cliquet option, also known as Ratchet option, is a series of |
38 | | forward-starting (a.k.a. deferred strike) options where the |
39 | | strike for each forward start option is set equal to a fixed |
40 | | percentage of the spot price at the beginning of each period. |
41 | | |
42 | | \todo |
43 | | - add local/global caps/floors |
44 | | - add accrued coupon and last fixing |
45 | | |
46 | | \ingroup instruments |
47 | | */ |
48 | | class CliquetOption : public OneAssetOption { |
49 | | public: |
50 | | class arguments; |
51 | | class engine; |
52 | | CliquetOption(const ext::shared_ptr<PercentageStrikePayoff>&, |
53 | | const ext::shared_ptr<EuropeanExercise>& maturity, |
54 | | std::vector<Date> resetDates); |
55 | | void setupArguments(PricingEngine::arguments*) const override; |
56 | | |
57 | | private: |
58 | | std::vector<Date> resetDates_; |
59 | | }; |
60 | | |
61 | | //! %Arguments for cliquet option calculation |
62 | | // should inherit from a strikeless version of VanillaOption::arguments |
63 | | class CliquetOption::arguments : public OneAssetOption::arguments { |
64 | | public: |
65 | 0 | arguments() : accruedCoupon(Null<Real>()), |
66 | 0 | lastFixing(Null<Real>()), |
67 | 0 | localCap(Null<Real>()), |
68 | 0 | localFloor(Null<Real>()), |
69 | 0 | globalCap(Null<Real>()), |
70 | 0 | globalFloor(Null<Real>()) {} |
71 | | void validate() const override; |
72 | | Real accruedCoupon, lastFixing; |
73 | | Real localCap, localFloor, globalCap, globalFloor; |
74 | | std::vector<Date> resetDates; |
75 | | }; |
76 | | |
77 | | //! Cliquet %engine base class |
78 | | class CliquetOption::engine |
79 | | : public GenericEngine<CliquetOption::arguments, |
80 | | CliquetOption::results> {}; |
81 | | |
82 | | } |
83 | | |
84 | | |
85 | | #endif |