QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.38
Loading...
Searching...
No Matches
pdebsm.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) 2005 Joseph Wang
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 pdebsm.hpp
21 \brief Black-Scholes-Merton PDE
22*/
23
24#ifndef quantlib_pdebsm_hpp
25#define quantlib_pdebsm_hpp
26
29#include <utility>
30
31namespace QuantLib {
32
34
35 /*! \deprecated Part of the old FD framework; copy this function
36 in your codebase if needed.
37 Deprecated in version 1.37.
38 */
39 class [[deprecated("Part of the old FD framework; copy this function in your codebase if needed")]] PdeBSM : public PdeSecondOrderParabolic {
40 public:
41 typedef ext::shared_ptr<GeneralizedBlackScholesProcess> argument_type;
43 PdeBSM(argument_type process) : process_(std::move(process)){};
44 Real diffusion(Time t, Real x) const override { return process_->diffusion(t, x); }
45 Real drift(Time t, Real x) const override { return process_->drift(t, x); }
46 Real discount(Time t, Real) const override {
47 if (std::fabs(t) < 1e-8) t = 0;
48 return process_->riskFreeRate()->
49 forwardRate(t,t,Continuous,NoFrequency,true);
50 }
51
52 private:
54 };
55
57
58}
59
60
61#endif
Black-Scholes processes.
Real diffusion(Time t, Real x) const override
Definition: pdebsm.hpp:44
PdeBSM(argument_type process)
Definition: pdebsm.hpp:43
const argument_type process_
Definition: pdebsm.hpp:53
Real drift(Time t, Real x) const override
Definition: pdebsm.hpp:45
Real discount(Time t, Real) const override
Definition: pdebsm.hpp:46
LogGrid grid_type
Definition: pdebsm.hpp:42
ext::shared_ptr< GeneralizedBlackScholesProcess > argument_type
Definition: pdebsm.hpp:41
const DefaultType & t
@ NoFrequency
null frequency
Definition: frequency.hpp:37
Real Time
continuous quantity with 1-year units
Definition: types.hpp:62
QL_REAL Real
real number
Definition: types.hpp:50
Definition: any.hpp:37
STL namespace.
General class for one dimensional PDE's.
#define QL_DEPRECATED_DISABLE_WARNING
Definition: qldefines.hpp:216
#define QL_DEPRECATED_ENABLE_WARNING
Definition: qldefines.hpp:217