| 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 klugeextouprocess.hpp |
| 21 | \brief joint Kluge process an d Ornstein Uhlenbeck process |
| 22 | */ |
| 23 | |
| 24 | #ifndef quantlib_kluge_ext_ou_process_hpp |
| 25 | #define quantlib_kluge_ext_ou_process_hpp |
| 26 | |
| 27 | #include <ql/stochasticprocess.hpp> |
| 28 | |
| 29 | namespace QuantLib { |
| 30 | |
| 31 | class ExtOUWithJumpsProcess; |
| 32 | class ExtendedOrnsteinUhlenbeckProcess; |
| 33 | |
| 34 | /*! This class describes a correlated Kluge - extended Ornstein-Uhlenbeck |
| 35 | process governed by |
| 36 | \f[ |
| 37 | \begin{array}{rcl} |
| 38 | P_t &=& \exp(p_t + X_t + Y_t) \\ |
| 39 | dX_t &=& -\alpha X_tdt + \sigma_x dW_t^x \\ |
| 40 | dY_t &=& -\beta Y_{t-}dt + J_tdN_t \\ |
| 41 | \omega(J) &=& \eta e^{-\eta J} \\ |
| 42 | G_t &=& \exp(g_t + U_t) \\ |
| 43 | dU_t &=& -\kappa U_tdt + \sigma_udW_t^u \\ |
| 44 | \rho &=& \mathrm{corr} (dW_t^x, dW_t^u) |
| 45 | \end{array} |
| 46 | \f] |
| 47 | */ |
| 48 | |
| 49 | /*! References: |
| 50 | B. Hambly, S. Howison, T. Kluge, Modelling spikes and pricing |
| 51 | swing options in electricity markets, |
| 52 | http://people.maths.ox.ac.uk/hambly/PDF/Papers/elec.pdf |
| 53 | */ |
| 54 | |
| 55 | |
| 56 | class KlugeExtOUProcess : public StochasticProcess { |
| 57 | public: |
| 58 | KlugeExtOUProcess(Real rho, |
| 59 | ext::shared_ptr<ExtOUWithJumpsProcess> kluge, |
| 60 | ext::shared_ptr<ExtendedOrnsteinUhlenbeckProcess> extOU); |
| 61 | |
| 62 | Size size() const override; |
| 63 | Size factors() const override; |
| 64 | |
| 65 | Array initialValues() const override; |
| 66 | Array drift(Time t, const Array& x) const override; |
| 67 | Matrix diffusion(Time t, const Array& x) const override; |
| 68 | Array evolve(Time t0, const Array& x0, Time dt, const Array& dw) const override; |
| 69 | |
| 70 | ext::shared_ptr<ExtOUWithJumpsProcess> getKlugeProcess() const; |
| 71 | ext::shared_ptr<ExtendedOrnsteinUhlenbeckProcess> getExtOUProcess() const; |
| 72 | |
| 73 | Real rho() const; |
| 74 | |
| 75 | private: |
| 76 | const Real rho_, sqrtMRho_; |
| 77 | const ext::shared_ptr<ExtOUWithJumpsProcess> klugeProcess_; |
| 78 | const ext::shared_ptr<ExtendedOrnsteinUhlenbeckProcess> ouProcess_; |
| 79 | }; |
| 80 | } |
| 81 | #endif |
| 82 | |