QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
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 public:
35 typedef ext::shared_ptr<GeneralizedBlackScholesProcess>
38 PdeBSM(argument_type process) : process_(std::move(process)){};
39 Real diffusion(Time t, Real x) const override { return process_->diffusion(t, x); }
40 Real drift(Time t, Real x) const override { return process_->drift(t, x); }
41 Real discount(Time t, Real) const override {
42 if (std::fabs(t) < 1e-8) t = 0;
43 return process_->riskFreeRate()->
44 forwardRate(t,t,Continuous,NoFrequency,true);
45 }
46
47 private:
49 };
50
51}
52
53
54#endif
Black-Scholes processes.
Real diffusion(Time t, Real x) const override
Definition: pdebsm.hpp:39
PdeBSM(argument_type process)
Definition: pdebsm.hpp:38
const argument_type process_
Definition: pdebsm.hpp:48
Real drift(Time t, Real x) const override
Definition: pdebsm.hpp:40
Real discount(Time t, Real) const override
Definition: pdebsm.hpp:41
LogGrid grid_type
Definition: pdebsm.hpp:37
ext::shared_ptr< GeneralizedBlackScholesProcess > argument_type
Definition: pdebsm.hpp:36
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:35
STL namespace.
General class for one dimensional PDE's.