Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
cliquetoption.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2019 Quaternion Risk Management Ltd.
3 All rights reserved.
4
5 This file is part of ORE, a free-software/open-source library
6 for transparent pricing and risk analysis - http://opensourcerisk.org
7 ORE is free software: you can redistribute it and/or modify it
8 under the terms of the Modified BSD License. You should have received a
9 copy of the license along with this program.
10 The license is also available online at <http://opensourcerisk.org>
11
12 This program is distributed on the basis that it will form a useful
13 contribution to risk analytics and model standardisation, but WITHOUT
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the license for more details.
16*/
17
18/*! \file qle/instruments/cliquetoption.hpp
19 \brief Cliquet option
20*/
21
22#ifndef quantext_cliquet_option_hpp
23#define quantext_cliquet_option_hpp
24
25#include <ql/instruments/oneassetoption.hpp>
26#include <ql/instruments/payoffs.hpp>
27
28#include <ql/exercise.hpp>
29#include <ql/option.hpp>
30#include <ql/position.hpp>
31#include <set>
32
33namespace QuantExt {
34using namespace QuantLib;
35
36/*! The payoff on the payment date is given by
37 min( max( sum min( max( S(t) / S(t-1) - moneyness, localFloor ), localCap ), globalFloor), globalCap)
38*/
40public:
41 class arguments;
42 class engine;
43 CliquetOption(const QuantLib::ext::shared_ptr<PercentageStrikePayoff>& payoff,
44 const QuantLib::ext::shared_ptr<EuropeanExercise>& maturity, const std::set<Date>& valuationDates,
45 const Date& paymentDate, const Real notional, const Position::Type& longShort,
46 const Real localCap = Null<Real>(), const Real localFloor = Null<Real>(),
47 const Real globalCap = Null<Real>(), const Real globalFloor = Null<Real>(),
48 const Real premium = Null<Real>(), const Date& premiumPayDate = Date(),
49 const std::string& premiumCurrency = "");
50 bool isExpired() const override;
51 void setupArguments(PricingEngine::arguments*) const override;
52 //
53 const std::set<Date>& valuationDates() const { return valuationDates_; }
54
55private:
56 const std::set<Date> valuationDates_;
57 const Date paymentDate_;
58 const Real notional_;
59 const Position::Type longShort_;
61 const Date premiumPayDate_;
62 const std::string premiumCurrency_;
63};
64
65class CliquetOption::arguments : public OneAssetOption::arguments {
66public:
68 : valuationDates(std::set<Date>()), paymentDate(Date()), localCap(Null<Real>()), localFloor(Null<Real>()),
69 globalCap(Null<Real>()), globalFloor(Null<Real>()), premium(Null<Real>()), premiumPayDate(Date()) {}
70
71 void validate() const override;
72
73 Option::Type type;
74 Position::Type longShort;
76 std::set<Date> valuationDates;
80 std::string premiumCurrency;
81};
82
83//! Cliquet %engine base class
84class CliquetOption::engine : public GenericEngine<CliquetOption::arguments, CliquetOption::results> {};
85
86} // namespace QuantExt
87
88#endif
Cliquet engine base class.
const Position::Type longShort_
void setupArguments(PricingEngine::arguments *) const override
bool isExpired() const override
const std::set< Date > & valuationDates() const
const std::string premiumCurrency_
const std::set< Date > valuationDates_