QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
lookbackoption.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) 2006 Warren Chou
5 Copyright (C) 2007 StatPro Italia srl
6 Copyright (C) 2014 Francois Botha
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 lookbackoption.hpp
23 \brief Lookback option on a single asset
24*/
25
26#ifndef quantlib_lookback_option_hpp
27#define quantlib_lookback_option_hpp
28
31#include <ql/exercise.hpp>
32
33namespace QuantLib {
34
35 //! Continuous-floating lookback option
36 /*! \ingroup instruments */
38 public:
39 class arguments;
40 class engine;
42 Real currentMinmax,
43 const ext::shared_ptr<TypePayoff>& payoff,
44 const ext::shared_ptr<Exercise>& exercise);
45 void setupArguments(PricingEngine::arguments*) const override;
46
47 protected:
48 // arguments
50 };
51
52 //! Continuous-fixed lookback option
53 /*! \ingroup instruments */
55 public:
56 class arguments;
57 class engine;
59 Real currentMinmax,
60 const ext::shared_ptr<StrikedTypePayoff>& payoff,
61 const ext::shared_ptr<Exercise>& exercise);
62 void setupArguments(PricingEngine::arguments*) const override;
63
64 protected:
65 // arguments
67 };
68
69 //! Continuous-partial-floating lookback option
70 /*! From http://help.rmetrics.org/fExoticOptions/LookbackOptions.html :
71
72 For a partial-time floating strike lookback option, the
73 lookback period starts at time zero and ends at an arbitrary
74 date before expiration. Except for the partial lookback
75 period, the option is similar to a floating strike lookback
76 option. The partial-time floating strike lookback option is
77 cheaper than a similar standard floating strike lookback
78 option. Partial-time floating strike lookback options can be
79 priced analytically using a model introduced by Heynen and Kat
80 (1994).
81
82 \ingroup instruments
83 */
85 public:
86 class arguments;
87 class engine;
89 Real currentMinmax,
90 Real lambda,
91 Date lookbackPeriodEnd,
92 const ext::shared_ptr<TypePayoff>& payoff,
93 const ext::shared_ptr<Exercise>& exercise);
94 void setupArguments(PricingEngine::arguments*) const override;
95
96 protected:
97 // arguments
100 };
101
102 //! Continuous-partial-fixed lookback option
103 /*! From http://help.rmetrics.org/fExoticOptions/LookbackOptions.html :
104
105 For a partial-time fixed strike lookback option, the lookback
106 period starts at a predetermined date after the initialization
107 date of the option. The partial-time fixed strike lookback
108 call option payoff is given by the difference between the
109 maximum observed price of the underlying asset during the
110 lookback period and the fixed strike price. The partial-time
111 fixed strike lookback put option payoff is given by the
112 difference between the fixed strike price and the minimum
113 observed price of the underlying asset during the lookback
114 period. The partial-time fixed strike lookback option is
115 cheaper than a similar standard fixed strike lookback
116 option. Partial-time fixed strike lookback options can be
117 priced analytically using a model introduced by Heynen and Kat
118 (1994).
119
120 \ingroup instruments
121 */
123 public:
124 class arguments;
125 class engine;
127 Date lookbackPeriodStart,
128 const ext::shared_ptr<StrikedTypePayoff>& payoff,
129 const ext::shared_ptr<Exercise>& exercise);
130 void setupArguments(PricingEngine::arguments*) const override;
131
132 protected:
133 // arguments
135 };
136
137 //! %Arguments for continuous floating lookback option calculation
139 : public OneAssetOption::arguments {
140 public:
142 void validate() const override;
143 };
144
145 //! %Arguments for continuous fixed lookback option calculation
147 : public OneAssetOption::arguments {
148 public:
150 void validate() const override;
151 };
152
153 //! %Arguments for continuous partial floating lookback option calculation
156 public:
159 void validate() const override;
160 };
161
162 //! %Arguments for continuous partial fixed lookback option calculation
165 public:
167 void validate() const override;
168 };
169
170 //! %Continuous floating lookback %engine base class
172 : public GenericEngine<ContinuousFloatingLookbackOption::arguments,
173 ContinuousFloatingLookbackOption::results> {};
174
175 //! %Continuous fixed lookback %engine base class
177 : public GenericEngine<ContinuousFixedLookbackOption::arguments,
178 ContinuousFixedLookbackOption::results> {};
179
180 //! %Continuous partial floating lookback %engine base class
182 : public GenericEngine<ContinuousPartialFloatingLookbackOption::arguments,
183 ContinuousPartialFloatingLookbackOption::results> {};
184
185 //! %Continuous partial fixed lookback %engine base class
187 : public GenericEngine<ContinuousPartialFixedLookbackOption::arguments,
188 ContinuousPartialFixedLookbackOption::results> {};
189}
190
191
192#endif
Arguments for continuous fixed lookback option calculation
Continuous fixed lookback engine base class
Continuous-fixed lookback option.
void setupArguments(PricingEngine::arguments *) const override
Arguments for continuous floating lookback option calculation
Continuous floating lookback engine base class
Continuous-floating lookback option.
void setupArguments(PricingEngine::arguments *) const override
Arguments for continuous partial fixed lookback option calculation
Continuous partial fixed lookback engine base class
Continuous-partial-fixed lookback option.
void setupArguments(PricingEngine::arguments *) const override
Arguments for continuous partial floating lookback option calculation
Continuous partial floating lookback engine base class
Continuous-partial-floating lookback option.
void setupArguments(PricingEngine::arguments *) const override
Concrete date class.
Definition: date.hpp:125
template base class for option pricing engines
Base class for options on a single asset.
ext::shared_ptr< Payoff > payoff() const
Definition: option.hpp:45
ext::shared_ptr< Exercise > exercise() const
Definition: option.hpp:46
Option exercise classes and payoff function.
QL_REAL Real
real number
Definition: types.hpp:50
Definition: any.hpp:35
Option on a single asset.
Payoffs for various options.