1 /* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 
3 /*
4  Copyright (C) 2010 Master IMAFA - Polytech'Nice Sophia - Université de Nice Sophia Antipolis
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 simplechooseroption.hpp
21     \brief Simple chooser option on a single asset
22 */
23 
24 #ifndef quantlib_simple_chooser_option_hpp
25 #define quantlib_simple_chooser_option_hpp
26 
27 #include <ql/instruments/oneassetoption.hpp>
28 
29 namespace QuantLib {
30 
31     //! Simple chooser option
32     /*! This option gives the holder the right to choose, at a future
33         date prior to exercise, whether the option should be a call or
34         a put.  The exercise date and strike are the same for both
35         call and put option.
36     */
37     class SimpleChooserOption : public OneAssetOption {
38       public:
39         class arguments;
40         class engine;
41         SimpleChooserOption(Date choosingDate,
42                             Real strike,
43                             const ext::shared_ptr<Exercise>& exercise);
44         void setupArguments(PricingEngine::arguments*) const;
45       protected:
46         Date choosingDate_;
47     };
48 
49     //! Extra %arguments for single chooser option
50     class SimpleChooserOption::arguments
51         : public OneAssetOption::arguments {
52       public:
arguments()53         arguments() : choosingDate(Null<Date>()) {}
54         void validate() const;
55         Date choosingDate;
56     };
57 
58     //! Simple chooser option %engine base class
59     class SimpleChooserOption::engine
60         : public GenericEngine<SimpleChooserOption::arguments,
61                                SimpleChooserOption::results> {};
62 
63 }
64 
65 #endif
66