QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
hestonslvprocess.hpp
Go to the documentation of this file.
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3/*
4 Copyright (C) 2015 Johannes Göttker-Schnetmann
5 Copyright (C) 2015 Klaus Spanderen
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 hestonslvprocess.hpp
22 \brief Heston stochastic local volatility process
23*/
24
25#ifndef quantlib_heston_slv_process_hpp
26#define quantlib_heston_slv_process_hpp
27
30
31namespace QuantLib {
32
34 public:
35 HestonSLVProcess(const ext::shared_ptr<HestonProcess>& hestonProcess,
36 ext::shared_ptr<LocalVolTermStructure> leverageFct,
37 Real mixingFactor = 1.0);
38
39 Size size() const override { return Size(2); }
40 Size factors() const override { return Size(2); }
41
42 void update() override;
43
44 Array initialValues() const override {
45 return hestonProcess_->initialValues();
46 }
47 Array apply(const Array& x0, const Array& dx) const override {
48 return hestonProcess_->apply(x0, dx);
49 }
50
51 Array drift(Time t, const Array& x) const override;
52 Matrix diffusion(Time t, const Array& x) const override;
53 Array evolve(Time t0, const Array& x0, Time dt, const Array& dw) const override;
54
55 Real v0() const { return v0_; }
56 Real rho() const { return rho_; }
57 Real kappa() const { return kappa_; }
58 Real theta() const { return theta_; }
59 Real sigma() const { return sigma_; }
60 Real mixingFactor() const { return mixingFactor_; }
61 ext::shared_ptr<LocalVolTermStructure> leverageFct() const {
62 return leverageFct_;
63 }
64
65 const Handle<Quote>& s0() const { return hestonProcess_->s0(); }
67 return hestonProcess_->dividendYield();
68 }
70 return hestonProcess_->riskFreeRate();
71 }
72
73 Time time(const Date& d) const override { return hestonProcess_->time(d); }
74
75 private:
77
78 const ext::shared_ptr<HestonProcess> hestonProcess_;
79 const ext::shared_ptr<LocalVolTermStructure> leverageFct_;
80
81 void setParameters();
82 };
83
84}
85
86#endif
1-D array used in linear algebra.
Definition: array.hpp:52
Concrete date class.
Definition: date.hpp:125
Shared handle to an observable.
Definition: handle.hpp:41
Array drift(Time t, const Array &x) const override
returns the drift part of the equation, i.e.,
Size size() const override
returns the number of dimensions of the stochastic process
Array evolve(Time t0, const Array &x0, Time dt, const Array &dw) const override
Matrix diffusion(Time t, const Array &x) const override
returns the diffusion part of the equation, i.e.
const Handle< YieldTermStructure > & dividendYield() const
const ext::shared_ptr< LocalVolTermStructure > leverageFct_
ext::shared_ptr< LocalVolTermStructure > leverageFct() const
Size factors() const override
returns the number of independent factors of the process
Time time(const Date &d) const override
Array initialValues() const override
returns the initial values of the state variables
Array apply(const Array &x0, const Array &dx) const override
const ext::shared_ptr< HestonProcess > hestonProcess_
const Handle< Quote > & s0() const
const Handle< YieldTermStructure > & riskFreeRate() const
Matrix used in linear algebra.
Definition: matrix.hpp:41
multi-dimensional stochastic process class.
const DefaultType & t
Date d
Real Time
continuous quantity with 1-year units
Definition: types.hpp:62
QL_REAL Real
real number
Definition: types.hpp:50
std::size_t Size
size of a container
Definition: types.hpp:58
Heston stochastic process.
Local volatility term structure base class.
Definition: any.hpp:35