QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
blackcalculator.hpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3/*
4 Copyright (C) 2003, 2004, 2005, 2006 Ferdinando Ametrano
5 Copyright (C) 2006 StatPro Italia srl
6
7 This file is part of QuantLib, a free-software/open-source library
8 for financial quantitative analysts and developers - http://quantlib.org/
9
10 QuantLib is free software: you can redistribute it and/or modify it
11 under the terms of the QuantLib license. You should have received a
12 copy of the license along with this program; if not, please email
13 <quantlib-dev@lists.sf.net>. The license is also available online at
14 <http://quantlib.org/license.shtml>.
15
16 This program is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18 FOR A PARTICULAR PURPOSE. See the license for more details.
19*/
20
25#ifndef quantlib_blackcalculator_hpp
26#define quantlib_blackcalculator_hpp
27
28#include <ql/instruments/payoffs.hpp>
29
30namespace QuantLib {
31
33
38 private:
39 class Calculator;
40 public:
41 BlackCalculator(const ext::shared_ptr<StrikedTypePayoff>& payoff,
42 Real forward,
43 Real stdDev,
44 Real discount = 1.0);
46 Real strike,
47 Real forward,
48 Real stdDev,
49 Real discount = 1.0);
50 virtual ~BlackCalculator() = default;
51
52 Real value() const;
53
55 Real deltaForward() const;
57 virtual Real delta(Real spot) const;
58
61 Real elasticityForward() const;
64 virtual Real elasticity(Real spot) const;
65
68 Real gammaForward() const;
71 virtual Real gamma(Real spot) const;
72
74 virtual Real theta(Real spot,
75 Time maturity) const;
78 virtual Real thetaPerDay(Real spot,
79 Time maturity) const;
80
82 Real vega(Time maturity) const;
83
85 Real rho(Time maturity) const;
86
88 Real dividendRho(Time maturity) const;
89
95
101
103 Real strikeSensitivity() const;
104
106 Real strikeGamma() const;
107
108 Real alpha() const;
109 Real beta() const;
110 protected:
111 void initialize(const ext::shared_ptr<StrikedTypePayoff>& p);
117 };
118
119 // inline
121 Time maturity) const {
122 return theta(spot, maturity)/365.0;
123 }
124
126 return cum_d2_;
127 }
128
130 return cum_d1_;
131 }
132
134 return alpha_;
135 }
136
138 return beta_;
139 }
140
141}
142
143#endif
Black 1976 calculator class.
Real dividendRho(Time maturity) const
virtual Real delta(Real spot) const
Real vega(Time maturity) const
void initialize(const ext::shared_ptr< StrikedTypePayoff > &p)
virtual Real gamma(Real spot) const
virtual ~BlackCalculator()=default
virtual Real elasticity(Real spot) const
virtual Real thetaPerDay(Real spot, Time maturity) const
virtual Real theta(Real spot, Time maturity) const
Real rho(Time maturity) const
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