| 1 | /* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
| 2 | |
| 3 | /* |
| 4 | Copyright (C) 2004, 2007 StatPro Italia srl |
| 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 dividendvanillaoption.hpp |
| 21 | \brief Vanilla option on a single asset with discrete dividends |
| 22 | */ |
| 23 | |
| 24 | #ifndef quantlib_dividend_vanilla_option_hpp |
| 25 | #define quantlib_dividend_vanilla_option_hpp |
| 26 | |
| 27 | #include <ql/instruments/oneassetoption.hpp> |
| 28 | #include <ql/instruments/dividendschedule.hpp> |
| 29 | #include <ql/instruments/payoffs.hpp> |
| 30 | |
| 31 | namespace QuantLib { |
| 32 | |
| 33 | class GeneralizedBlackScholesProcess; |
| 34 | |
| 35 | //! Single-asset vanilla option (no barriers) with discrete dividends |
| 36 | /*! \deprecated Use VanillaOption instead and pass the dividends |
| 37 | to the desired engine. |
| 38 | Deprecated in version 1.30. |
| 39 | */ |
| 40 | class QL_DEPRECATED DividendVanillaOption : public OneAssetOption { |
| 41 | public: |
| 42 | class arguments; |
| 43 | class engine; |
| 44 | DividendVanillaOption( |
| 45 | const ext::shared_ptr<StrikedTypePayoff>& payoff, |
| 46 | const ext::shared_ptr<Exercise>& exercise, |
| 47 | const std::vector<Date>& dividendDates, |
| 48 | const std::vector<Real>& dividends); |
| 49 | /*! \warning see VanillaOption for notes on implied-volatility |
| 50 | calculation. |
| 51 | */ |
| 52 | Volatility impliedVolatility( |
| 53 | Real price, |
| 54 | const ext::shared_ptr<GeneralizedBlackScholesProcess>& process, |
| 55 | Real accuracy = 1.0e-4, |
| 56 | Size maxEvaluations = 100, |
| 57 | Volatility minVol = 1.0e-7, |
| 58 | Volatility maxVol = 4.0) const; |
| 59 | protected: |
| 60 | void setupArguments(PricingEngine::arguments*) const override; |
| 61 | |
| 62 | private: |
| 63 | DividendSchedule cashFlow_; |
| 64 | }; |
| 65 | |
| 66 | class DividendVanillaOption::arguments : public OneAssetOption::arguments { |
| 67 | public: |
| 68 | DividendSchedule cashFlow; |
| 69 | arguments() = default; |
| 70 | void validate() const override; |
| 71 | }; |
| 72 | |
| 73 | QL_DEPRECATED_DISABLE_WARNING |
| 74 | class DividendVanillaOption::engine |
| 75 | : public GenericEngine<DividendVanillaOption::arguments, |
| 76 | DividendVanillaOption::results> {}; |
| 77 | QL_DEPRECATED_ENABLE_WARNING |
| 78 | |
| 79 | } |
| 80 | |
| 81 | |
| 82 | #endif |
| 83 | |
| 84 | |