QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
fdmhestonsolver.hpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3/*
4 Copyright (C) 2008 Andreas Gaida
5 Copyright (C) 2008, 2009 Ralph Schreyer
6 Copyright (C) 2008, 2009, 2011, 2014, 2015 Klaus Spanderen
7 Copyright (C) 2015 Johannes Göttker-Schnetmann
8
9 This file is part of QuantLib, a free-software/open-source library
10 for financial quantitative analysts and developers - http://quantlib.org/
11
12 QuantLib is free software: you can redistribute it and/or modify it
13 under the terms of the QuantLib license. You should have received a
14 copy of the license along with this program; if not, please email
15 <quantlib-dev@lists.sf.net>. The license is also available online at
16 <http://quantlib.org/license.shtml>.
17
18 This program is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
20 FOR A PARTICULAR PURPOSE. See the license for more details.
21*/
22
26#ifndef quantlib_fdm_heston_solver_hpp
27#define quantlib_fdm_heston_solver_hpp
28
29#include <ql/handle.hpp>
30#include <ql/patterns/lazyobject.hpp>
31#include <ql/methods/finitedifferences/utilities/fdmquantohelper.hpp>
32#include <ql/methods/finitedifferences/solvers/fdmsolverdesc.hpp>
33#include <ql/methods/finitedifferences/solvers/fdmbackwardsolver.hpp>
34#include <ql/methods/finitedifferences/utilities/fdmdirichletboundary.hpp>
35#include <ql/termstructures/volatility/equityfx/localvoltermstructure.hpp>
36
37namespace QuantLib {
38
39 class HestonProcess;
40 class Fdm2DimSolver;
41
42 class FdmHestonSolver : public LazyObject {
43 public:
45 FdmSolverDesc solverDesc,
46 const FdmSchemeDesc& schemeDesc = FdmSchemeDesc::Hundsdorfer(),
48 ext::shared_ptr<LocalVolTermStructure> leverageFct =
49 ext::shared_ptr<LocalVolTermStructure>(),
50 Real mixingFactor = 1.0);
51
52 Real valueAt(Real s, Real v) const;
53 Real thetaAt(Real s, Real v) const;
54
55 // First and second order derivative with respect to S_t.
56 // Please note that this is not the "model implied" delta or gamma.
57 // E.g. see Fabio Mercurio, Massimo Morini
58 // "A Note on Hedging with Local and Stochastic Volatility Models",
59 // http://papers.ssrn.com/sol3/papers.cfm?abstract_id=1294284
60 Real deltaAt(Real s, Real v) const;
61 Real gammaAt(Real s, Real v) const;
62
65
66 protected:
67 void performCalculations() const override;
68
69 private:
74 const ext::shared_ptr<LocalVolTermStructure> leverageFct_;
76
77 mutable ext::shared_ptr<Fdm2DimSolver> solver_;
78 };
79}
80
81#endif
ext::shared_ptr< Fdm2DimSolver > solver_
void performCalculations() const override
Real thetaAt(Real s, Real v) const
Real meanVarianceDeltaAt(Real s, Real v) const
const FdmSolverDesc solverDesc_
const ext::shared_ptr< LocalVolTermStructure > leverageFct_
Real gammaAt(Real s, Real v) const
const Handle< HestonProcess > process_
Real valueAt(Real s, Real v) const
Real deltaAt(Real s, Real v) const
const Handle< FdmQuantoHelper > quantoHelper_
Real meanVarianceGammaAt(Real s, Real v) const
const FdmSchemeDesc schemeDesc_
Shared handle to an observable.
Definition: handle.hpp:41
Framework for calculation on demand and result caching.
Definition: lazyobject.hpp:35
QL_REAL Real
real number
Definition: types.hpp:50
Definition: any.hpp:35
static FdmSchemeDesc Hundsdorfer()