QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
fdhestonhullwhitevanillaengine.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) 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
20/*! \file fdhestonhullwhitevanillaengine.hpp
21 \brief Finite-differences Heston Hull-White vanilla option engine
22*/
23
24#ifndef quantlib_fd_heston_hull_white_vanilla_engine_hpp
25#define quantlib_fd_heston_hull_white_vanilla_engine_hpp
26
33
34namespace QuantLib {
35
36 //! Finite-differences Heston Hull-White vanilla option engine
37 /*! \ingroup vanillaengines
38
39 \test the correctness of the returned value is tested by
40 reproducing results available in web/literature
41 and comparison with Black/Heston pricing.
42 */
44 : public GenericModelEngine<HestonModel,
45 VanillaOption::arguments,
46 VanillaOption::results> {
47 public:
49 const ext::shared_ptr<HestonModel>& model,
50 ext::shared_ptr<HullWhiteProcess> hwProcess,
51 Real corrEquityShortRate,
52 Size tGrid = 50,
53 Size xGrid = 100,
54 Size vGrid = 40,
55 Size rGrid = 20,
56 Size dampingSteps = 0,
57 bool controlVariate = true,
58 const FdmSchemeDesc& schemeDesc = FdmSchemeDesc::Hundsdorfer());
59
61 const ext::shared_ptr<HestonModel>& model,
62 ext::shared_ptr<HullWhiteProcess> hwProcess,
63 DividendSchedule dividends,
64 Real corrEquityShortRate,
65 Size tGrid = 50,
66 Size xGrid = 100,
67 Size vGrid = 40,
68 Size rGrid = 20,
69 Size dampingSteps = 0,
70 bool controlVariate = true,
71 const FdmSchemeDesc& schemeDesc = FdmSchemeDesc::Hundsdorfer());
72
73 void calculate() const override;
74
75 // multiple strikes caching engine
76 void update() override;
77 void enableMultipleStrikesCaching(const std::vector<Real>& strikes);
78
79 private:
80 const ext::shared_ptr<HullWhiteProcess> hwProcess_;
86 const bool controlVariate_;
87
88 std::vector<Real> strikes_;
89 mutable std::vector<std::pair<VanillaOption::arguments,
92 };
93
94}
95
96#endif
Finite-differences Heston Hull-White vanilla option engine.
std::vector< std::pair< VanillaOption::arguments, VanillaOption::results > > cachedArgs2results_
const ext::shared_ptr< HullWhiteProcess > hwProcess_
void enableMultipleStrikesCaching(const std::vector< Real > &strikes)
Base class for some pricing engine on a particular model.
basic option arguments
Definition: option.hpp:57
Generic option engine based on a model.
QL_REAL Real
real number
Definition: types.hpp:50
std::size_t Size
size of a container
Definition: types.hpp:58
Heston model for the stochastic volatility of an asset.
Hull-White stochastic processes.
Definition: any.hpp:35
std::vector< ext::shared_ptr< Dividend > > DividendSchedule
static FdmSchemeDesc Hundsdorfer()
Vanilla option on a single asset.