QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
blackscholescalculator.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) 2006 Ferdinando Ametrano
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 blackscholescalculator.hpp
21 \brief Black-Scholes formula calculator class
22*/
23
24#ifndef quantlib_blackscholescalculator_hpp
25#define quantlib_blackscholescalculator_hpp
26
28
29namespace QuantLib {
30
31 //! Black-Scholes 1973 calculator class
33 public:
35 const ext::shared_ptr<StrikedTypePayoff>& payoff,
36 Real spot,
37 DiscountFactor growth,
38 Real stdDev,
39 DiscountFactor discount);
41 Real strike,
42 Real spot,
43 DiscountFactor growth,
44 Real stdDev,
45 DiscountFactor discount);
46 ~BlackScholesCalculator() override = default;
47 /*! Sensitivity to change in the underlying spot price. */
48 Real delta() const;
49 /*! Sensitivity in percent to a percent change in the
50 underlying spot price. */
51 Real elasticity() const;
52 /*! Second order derivative with respect to change in the
53 underlying spot price. */
54 Real gamma() const;
55 /*! Sensitivity to time to maturity. */
56 Real theta(Time maturity) const;
57 /*! Sensitivity to time to maturity per day
58 (assuming 365 day in a year). */
59 Real thetaPerDay(Time maturity) const;
60 // also un-hide overloads taking a spot
66 protected:
69 };
70
71 // inline
74 }
75
78 }
79
82 }
83
84 inline Real BlackScholesCalculator::theta(Time maturity) const {
85 return BlackCalculator::theta(spot_, maturity);
86 }
87
89 return BlackCalculator::thetaPerDay(spot_, maturity);
90 }
91
92}
93
94#endif
Black-formula calculator class.
Black 1976 calculator class.
virtual Real delta(Real spot) const
virtual Real gamma(Real spot) const
virtual Real elasticity(Real spot) const
virtual Real thetaPerDay(Real spot, Time maturity) const
virtual Real theta(Real spot, Time maturity) const
Black-Scholes 1973 calculator class.
~BlackScholesCalculator() override=default
Real Time
continuous quantity with 1-year units
Definition: types.hpp:62
QL_REAL Real
real number
Definition: types.hpp:50
Real DiscountFactor
discount factor between dates
Definition: types.hpp:66
Real theta
ext::shared_ptr< QuantLib::Payoff > payoff
Definition: any.hpp:35