QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
fdhestonhullwhitevanillaengine.hpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3/*
4 Copyright (C) 2009 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
24#ifndef quantlib_fd_heston_hull_white_vanilla_engine_hpp
25#define quantlib_fd_heston_hull_white_vanilla_engine_hpp
26
27#include <ql/instruments/dividendvanillaoption.hpp>
28#include <ql/models/equity/hestonmodel.hpp>
29#include <ql/processes/hullwhiteprocess.hpp>
30#include <ql/pricingengines/genericmodelengine.hpp>
31#include <ql/methods/finitedifferences/solvers/fdmbackwardsolver.hpp>
32#include <ql/methods/finitedifferences/solvers/fdmhestonhullwhitesolver.hpp>
33
34namespace QuantLib {
35
36 QL_DEPRECATED_DISABLE_WARNING
37
39
46 : public GenericModelEngine<HestonModel,
47 DividendVanillaOption::arguments,
48 DividendVanillaOption::results> {
49 QL_DEPRECATED_ENABLE_WARNING
50 public:
52 const ext::shared_ptr<HestonModel>& model,
53 ext::shared_ptr<HullWhiteProcess> hwProcess,
54 Real corrEquityShortRate,
55 Size tGrid = 50,
56 Size xGrid = 100,
57 Size vGrid = 40,
58 Size rGrid = 20,
59 Size dampingSteps = 0,
60 bool controlVariate = true,
61 const FdmSchemeDesc& schemeDesc = FdmSchemeDesc::Hundsdorfer());
62
64 const ext::shared_ptr<HestonModel>& model,
65 ext::shared_ptr<HullWhiteProcess> hwProcess,
66 DividendSchedule dividends,
67 Real corrEquityShortRate,
68 Size tGrid = 50,
69 Size xGrid = 100,
70 Size vGrid = 40,
71 Size rGrid = 20,
72 Size dampingSteps = 0,
73 bool controlVariate = true,
74 const FdmSchemeDesc& schemeDesc = FdmSchemeDesc::Hundsdorfer());
75
76 void calculate() const override;
77
78 // multiple strikes caching engine
79 void update() override;
80 void enableMultipleStrikesCaching(const std::vector<Real>& strikes);
81
82 private:
83 const ext::shared_ptr<HullWhiteProcess> hwProcess_;
90 const bool controlVariate_;
91
92 std::vector<Real> strikes_;
93 QL_DEPRECATED_DISABLE_WARNING
94 mutable std::vector<std::pair<DividendVanillaOption::arguments,
97 QL_DEPRECATED_ENABLE_WARNING
98 };
99
100}
101
102#endif
Finite-differences Heston Hull-White vanilla option engine.
const ext::shared_ptr< HullWhiteProcess > hwProcess_
QL_DEPRECATED_DISABLE_WARNING std::vector< std::pair< DividendVanillaOption::arguments, DividendVanillaOption::results > > cachedArgs2results_
void enableMultipleStrikesCaching(const std::vector< Real > &strikes)
Base class for some pricing engine on a particular model.
QL_REAL Real
real number
Definition: types.hpp:50
std::size_t Size
size of a container
Definition: types.hpp:58
Definition: any.hpp:35
std::vector< ext::shared_ptr< Dividend > > DividendSchedule
static FdmSchemeDesc Hundsdorfer()