QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
fdblackscholesvanillaengine.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 Ralph Schreyer
6 Copyright (C) 2008, 2009 Klaus Spanderen
7
8 This file is part of QuantLib, a free-software/open-source library
9 for financial quantitative analysts and developers - http://quantlib.org/
10
11 QuantLib is free software: you can redistribute it and/or modify it
12 under the terms of the QuantLib license. You should have received a
13 copy of the license along with this program; if not, please email
14 <quantlib-dev@lists.sf.net>. The license is also available online at
15 <http://quantlib.org/license.shtml>.
16
17 This program is distributed in the hope that it will be useful, but WITHOUT
18 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
19 FOR A PARTICULAR PURPOSE. See the license for more details.
20*/
21
26#ifndef quantlib_fd_black_scholes_vanilla_engine_hpp
27#define quantlib_fd_black_scholes_vanilla_engine_hpp
28
29#include <ql/pricingengine.hpp>
30#include <ql/instruments/dividendvanillaoption.hpp>
31#include <ql/methods/finitedifferences/solvers/fdmbackwardsolver.hpp>
32
33namespace QuantLib {
34
35 class FdmQuantoHelper;
36 class GeneralizedBlackScholesProcess;
37
38 QL_DEPRECATED_DISABLE_WARNING
39
41
48 QL_DEPRECATED_ENABLE_WARNING
49 public:
51
53 ext::shared_ptr<GeneralizedBlackScholesProcess>,
54 Size tGrid = 100,
55 Size xGrid = 100,
56 Size dampingSteps = 0,
57 const FdmSchemeDesc& schemeDesc = FdmSchemeDesc::Douglas(),
58 bool localVol = false,
59 Real illegalLocalVolOverwrite = -Null<Real>(),
60 CashDividendModel cashDividendModel = Spot);
61
63 ext::shared_ptr<GeneralizedBlackScholesProcess>,
64 DividendSchedule dividends,
65 Size tGrid = 100,
66 Size xGrid = 100,
67 Size dampingSteps = 0,
68 const FdmSchemeDesc& schemeDesc = FdmSchemeDesc::Douglas(),
69 bool localVol = false,
70 Real illegalLocalVolOverwrite = -Null<Real>(),
71 CashDividendModel cashDividendModel = Spot);
72
74 ext::shared_ptr<GeneralizedBlackScholesProcess>,
75 ext::shared_ptr<FdmQuantoHelper> quantoHelper,
76 Size tGrid = 100,
77 Size xGrid = 100,
78 Size dampingSteps = 0,
79 const FdmSchemeDesc& schemeDesc = FdmSchemeDesc::Douglas(),
80 bool localVol = false,
81 Real illegalLocalVolOverwrite = -Null<Real>(),
82 CashDividendModel cashDividendModel = Spot);
83
85 ext::shared_ptr<GeneralizedBlackScholesProcess>,
86 DividendSchedule dividends,
87 ext::shared_ptr<FdmQuantoHelper> quantoHelper,
88 Size tGrid = 100,
89 Size xGrid = 100,
90 Size dampingSteps = 0,
91 const FdmSchemeDesc& schemeDesc = FdmSchemeDesc::Douglas(),
92 bool localVol = false,
93 Real illegalLocalVolOverwrite = -Null<Real>(),
94 CashDividendModel cashDividendModel = Spot);
95
96 void calculate() const override;
97
98 private:
99 ext::shared_ptr<GeneralizedBlackScholesProcess> process_;
106 ext::shared_ptr<FdmQuantoHelper> quantoHelper_;
108 };
109
110
112 public:
114 ext::shared_ptr<GeneralizedBlackScholesProcess> process);
115
117 const ext::shared_ptr<FdmQuantoHelper>& quantoHelper);
118
122 Size dampingSteps);
123
125 const FdmSchemeDesc& schemeDesc);
126
129 Real illegalLocalVolOverwrite);
130
132 const std::vector<Date>& dividendDates,
133 const std::vector<Real>& dividendAmounts);
134
137
138 operator ext::shared_ptr<PricingEngine>() const;
139 private:
140 ext::shared_ptr<GeneralizedBlackScholesProcess> process_;
142 bool explicitDividends_ = false;
143 Size tGrid_ = 100, xGrid_ = 100, dampingSteps_ = 0;
144 ext::shared_ptr<FdmSchemeDesc> schemeDesc_;
145 bool localVol_ = false;
147 ext::shared_ptr<FdmQuantoHelper> quantoHelper_;
149 };
150
151}
152
153#endif
Finite-differences Black Scholes vanilla option engine.
ext::shared_ptr< GeneralizedBlackScholesProcess > process_
ext::shared_ptr< FdmQuantoHelper > quantoHelper_
MakeFdBlackScholesVanillaEngine & withIllegalLocalVolOverwrite(Real illegalLocalVolOverwrite)
MakeFdBlackScholesVanillaEngine & withLocalVol(bool localVol)
MakeFdBlackScholesVanillaEngine & withCashDividendModel(FdBlackScholesVanillaEngine::CashDividendModel cashDividendModel)
MakeFdBlackScholesVanillaEngine & withTGrid(Size tGrid)
FdBlackScholesVanillaEngine::CashDividendModel cashDividendModel_
MakeFdBlackScholesVanillaEngine & withDampingSteps(Size dampingSteps)
MakeFdBlackScholesVanillaEngine & withQuantoHelper(const ext::shared_ptr< FdmQuantoHelper > &quantoHelper)
MakeFdBlackScholesVanillaEngine & withXGrid(Size xGrid)
MakeFdBlackScholesVanillaEngine & withCashDividends(const std::vector< Date > &dividendDates, const std::vector< Real > &dividendAmounts)
ext::shared_ptr< GeneralizedBlackScholesProcess > process_
MakeFdBlackScholesVanillaEngine & withFdmSchemeDesc(const FdmSchemeDesc &schemeDesc)
template class providing a null value for a given type.
Definition: null.hpp:76
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 Douglas()