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 31 namespace QuantLib { 32 33 //! %Compound option on a single asset. 34 /*! \ingroup instruments */ 35 class CompoundOption : public OneAssetOption { 36 public: 37 class arguments; 38 class engine; 39 // Mother is the compound Option. 40 // Daughter is the option which plays the role of the underlying. 41 CompoundOption(const ext::shared_ptr<StrikedTypePayoff>& motherPayoff, 42 const ext::shared_ptr<Exercise>& motherExercise, 43 const ext::shared_ptr<StrikedTypePayoff>& daughterPayoff, 44 const ext::shared_ptr<Exercise>& daughterExercise); 45 void setupArguments(PricingEngine::arguments*) const; 46 47 private: 48 ext::shared_ptr<StrikedTypePayoff> daughterPayoff_; 49 ext::shared_ptr<Exercise> daughterExercise_; 50 }; 51 52 class CompoundOption::arguments : public OneAssetOption::arguments { 53 public: 54 ext::shared_ptr<StrikedTypePayoff> daughterPayoff; 55 ext::shared_ptr<Exercise> daughterExercise; 56 void validate() const; 57 }; 58 59 //! %Compound-option %engine base class 60 class CompoundOption::engine 61 : public GenericEngine<CompoundOption::arguments, 62 CompoundOption::results> {}; 63 64 } 65 66 #endif 67