1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3/*
4 Copyright (C) 2009 Dimitri Reiswich
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
20/*! \file compoundoption.hpp
21 \brief Compound option on a single asset
22*/
23
24#ifndef quantlib_compound_option_hpp
25#define quantlib_compound_option_hpp
26
27#include <ql/instruments/oneassetoption.hpp>
28#include <ql/instruments/payoffs.hpp>
29#include <ql/exercise.hpp>
30
31namespace QuantLib {
32
33 //! %Compound option (i.e., option on option) on a single asset.
34 /*! \ingroup instruments */
35 class CompoundOption : public OneAssetOption {
36 public:
37 class arguments;
38 class engine;
39 /*! The mother option is the compound option.
40 The daughter option is its underlying option.
41 */
42 CompoundOption(const ext::shared_ptr<StrikedTypePayoff>& motherPayoff,
43 const ext::shared_ptr<Exercise>& motherExercise,
44 ext::shared_ptr<StrikedTypePayoff> daughterPayoff,
45 ext::shared_ptr<Exercise> daughterExercise);
46 void setupArguments(PricingEngine::arguments*) const override;
47
48 private:
49 ext::shared_ptr<StrikedTypePayoff> daughterPayoff_;
50 ext::shared_ptr<Exercise> daughterExercise_;
51 };
52
53 class CompoundOption::arguments : public OneAssetOption::arguments {
54 public:
55 ext::shared_ptr<StrikedTypePayoff> daughterPayoff;
56 ext::shared_ptr<Exercise> daughterExercise;
57 void validate() const override;
58 };
59
60 //! %Compound-option %engine base class
61 class CompoundOption::engine : public GenericEngine<CompoundOption::arguments,
62 CompoundOption::results> {};
63
64}
65
66#endif
67

source code of quantlib/ql/instruments/compoundoption.hpp