/src/quantlib/ql/instruments/multiassetoption.hpp
Line | Count | Source |
1 | | /* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
2 | | |
3 | | /* |
4 | | Copyright (C) 2000, 2001, 2002, 2003 RiskMap srl |
5 | | Copyright (C) 2004 Neil Firth |
6 | | Copyright (C) 2007 StatPro Italia srl |
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 | | <https://www.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 multiassetoption.hpp |
23 | | \brief Option on multiple assets |
24 | | */ |
25 | | |
26 | | #ifndef quantlib_multiasset_option_hpp |
27 | | #define quantlib_multiasset_option_hpp |
28 | | |
29 | | #include <ql/option.hpp> |
30 | | |
31 | | namespace QuantLib { |
32 | | |
33 | | //! Base class for options on multiple assets |
34 | | class MultiAssetOption : public Option { |
35 | | public: |
36 | | class engine; |
37 | | class results; |
38 | | MultiAssetOption(const ext::shared_ptr<Payoff>&, |
39 | | const ext::shared_ptr<Exercise>&); |
40 | | //! \name Instrument interface |
41 | | //@{ |
42 | | bool isExpired() const override; |
43 | | //@} |
44 | | //! \name greeks |
45 | | //@{ |
46 | | Real delta() const; |
47 | | Real gamma() const; |
48 | | Real theta() const; |
49 | | Real vega() const; |
50 | | Real rho() const; |
51 | | Real dividendRho() const; |
52 | | //@} |
53 | | void setupArguments(PricingEngine::arguments*) const override; |
54 | | void fetchResults(const PricingEngine::results*) const override; |
55 | | |
56 | | protected: |
57 | | void setupExpired() const override; |
58 | | // results |
59 | | mutable Real delta_, gamma_, theta_, |
60 | | vega_, rho_, dividendRho_; |
61 | | }; |
62 | | |
63 | | //! %Results from multi-asset option calculation |
64 | | class MultiAssetOption::results : public Instrument::results, |
65 | | public Greeks { |
66 | | public: |
67 | 0 | void reset() override { |
68 | 0 | Instrument::results::reset(); |
69 | 0 | Greeks::reset(); |
70 | 0 | } |
71 | | }; |
72 | | |
73 | | class MultiAssetOption::engine : |
74 | | public GenericEngine<MultiAssetOption::arguments, |
75 | | MultiAssetOption::results> {}; |
76 | | |
77 | | } |
78 | | |
79 | | |
80 | | #endif |
81 | | |