| 1 | /* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
| 2 | |
| 3 | /* |
| 4 | Copyright (C) 2011 Klaus Spanderen |
| 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 extouwithjumpsprocess.hpp |
| 21 | \brief Ornstein Uhlenbeck process plus exp jumps (Kluge Model) |
| 22 | */ |
| 23 | |
| 24 | #ifndef quantlib_ext_ou_with_jumps_process_hpp |
| 25 | #define quantlib_ext_ou_with_jumps_process_hpp |
| 26 | |
| 27 | #include <ql/stochasticprocess.hpp> |
| 28 | #include <ql/math/distributions/normaldistribution.hpp> |
| 29 | |
| 30 | namespace QuantLib { |
| 31 | |
| 32 | class ExtendedOrnsteinUhlenbeckProcess; |
| 33 | |
| 34 | /*! This class describes a Ornstein Uhlenbeck model plus exp jump, |
| 35 | an extension of the Lucia and Schwartz model |
| 36 | \f[ |
| 37 | \begin{array}{rcl} |
| 38 | S &=& exp(X_t + Y_t) \\ |
| 39 | dX_t &=& \alpha(\mu(t)-X_t)dt + \sigma dW_t \\ |
| 40 | dY_t &=& -\beta Y_{t-}dt + J_tdN_t \\ |
| 41 | \omega(J)&=& \eta_u e^{-\eta_u J} |
| 42 | \end{array} |
| 43 | \f] |
| 44 | |
| 45 | \ingroup processes |
| 46 | */ |
| 47 | |
| 48 | |
| 49 | /*! References: |
| 50 | T. Kluge, 2008. Pricing Swing Options and other |
| 51 | Electricity Derivatives, http://eprints.maths.ox.ac.uk/246/1/kluge.pdf |
| 52 | |
| 53 | B. Hambly, S. Howison, T. Kluge, Modelling spikes and pricing |
| 54 | swing options in electricity markets, |
| 55 | http://people.maths.ox.ac.uk/hambly/PDF/Papers/elec.pdf |
| 56 | */ |
| 57 | |
| 58 | |
| 59 | class ExtOUWithJumpsProcess : public StochasticProcess { |
| 60 | public: |
| 61 | ExtOUWithJumpsProcess(ext::shared_ptr<ExtendedOrnsteinUhlenbeckProcess> process, |
| 62 | Real Y0, |
| 63 | Real beta, |
| 64 | Real jumpIntensity, |
| 65 | Real eta); |
| 66 | |
| 67 | Size size() const override; |
| 68 | Size factors() const override; |
| 69 | |
| 70 | Array initialValues() const override; |
| 71 | Array drift(Time t, const Array& x) const override; |
| 72 | Matrix diffusion(Time t, const Array& x) const override; |
| 73 | Array evolve(Time t0, const Array& x0, Time dt, const Array& dw) const override; |
| 74 | |
| 75 | ext::shared_ptr<ExtendedOrnsteinUhlenbeckProcess> getExtendedOrnsteinUhlenbeckProcess() const; |
| 76 | |
| 77 | Real beta() const; |
| 78 | Real eta() const; |
| 79 | Real jumpIntensity() const; |
| 80 | |
| 81 | private: |
| 82 | const Real Y0_, beta_, jumpIntensity_, eta_; |
| 83 | const ext::shared_ptr<ExtendedOrnsteinUhlenbeckProcess> ouProcess_; |
| 84 | |
| 85 | const CumulativeNormalDistribution cumNormalDist_; |
| 86 | }; |
| 87 | } |
| 88 | #endif |
| 89 | |