| 1 | /* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
| 2 | |
| 3 | /* |
| 4 | Copyright (C) 2004 Ferdinando Ametrano |
| 5 | Copyright (C) 2007 StatPro Italia srl |
| 6 | |
| 7 | This file is part of QuantLib, a free-software/open-source library |
| 8 | for financial quantitative analysts and developers - http://quantlib.org/ |
| 9 | |
| 10 | QuantLib is free software: you can redistribute it and/or modify it |
| 11 | under the terms of the QuantLib license. You should have received a |
| 12 | copy of the license along with this program; if not, please email |
| 13 | <quantlib-dev@lists.sf.net>. The license is also available online at |
| 14 | <http://quantlib.org/license.shtml>. |
| 15 | |
| 16 | This program is distributed in the hope that it will be useful, but WITHOUT |
| 17 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
| 18 | FOR A PARTICULAR PURPOSE. See the license for more details. |
| 19 | */ |
| 20 | |
| 21 | /*! \file jumpdiffusionengine.hpp |
| 22 | \brief Jump diffusion (Merton 1976) engine |
| 23 | */ |
| 24 | |
| 25 | #ifndef quantlib_jumpdiffusionengine_h |
| 26 | #define quantlib_jumpdiffusionengine_h |
| 27 | |
| 28 | #include <ql/instruments/vanillaoption.hpp> |
| 29 | #include <ql/processes/merton76process.hpp> |
| 30 | |
| 31 | namespace QuantLib { |
| 32 | |
| 33 | //! Jump-diffusion engine for vanilla options |
| 34 | /*! \ingroup vanillaengines |
| 35 | |
| 36 | \test |
| 37 | - the correctness of the returned value is tested by |
| 38 | reproducing results available in literature. |
| 39 | - the correctness of the returned greeks is tested by |
| 40 | reproducing numerical derivatives. |
| 41 | */ |
| 42 | class JumpDiffusionEngine : public VanillaOption::engine { |
| 43 | public: |
| 44 | JumpDiffusionEngine(ext::shared_ptr<Merton76Process>, |
| 45 | Real relativeAccuracy_ = 1e-4, |
| 46 | Size maxIterations = 100); |
| 47 | void calculate() const override; |
| 48 | |
| 49 | private: |
| 50 | ext::shared_ptr<Merton76Process> process_; |
| 51 | Real relativeAccuracy_; |
| 52 | Size maxIterations_; |
| 53 | }; |
| 54 | |
| 55 | } |
| 56 | |
| 57 | |
| 58 | |
| 59 | |
| 60 | |
| 61 | #endif |
| 62 | |