QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
blackdeltacalculator.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) 2010 Dimitri Reiswich
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 blackdeltacalculator.hpp
21 \brief Black-Scholes formula delta calculator class
22*/
23
24#ifndef quantlib_black_delta_calculator_hpp
25#define quantlib_black_delta_calculator_hpp
26
31
32namespace QuantLib {
33
34 //! Black delta calculator class
35 /*! Class includes many operations needed for different applications
36 in FX markets, which has special quoation mechanisms, since
37 every price can be expressed in both numeraires.
38 */
40 public:
41 // A parsimonious constructor is chosen, which for example
42 // doesn't need a strike. The reason for this is, that we'd
43 // like this class to calculate deltas for different strikes
44 // many times, e.g. in a numerical routine, which will be the
45 // case in the smile setup procedure.
48 Real spot,
49 DiscountFactor dDiscount, // domestic discount
50 DiscountFactor fDiscount, // foreign discount
51 Real stdDev);
52
53 // Give strike, receive delta according to specified type
54 Real deltaFromStrike(Real strike) const;
55 // Give delta according to specified type, receive strike
56 Real strikeFromDelta(Real delta) const;
57
58 Real cumD1(Real strike) const; // N(d1) or N(-d1)
59 Real cumD2(Real strike) const; // N(d2) or N(-d2)
60
61 Real nD1(Real strike) const; // n(d1)
62 Real nD2(Real strike) const; // n(d2)
63
66
67 // The following function can be calculated without an explicit strike
69
70 private:
71 // alternative delta type
73
74
78
82 };
83
84
86 public:
88 Option::Type ot,
90 Real spot,
91 DiscountFactor dDiscount, // domestic discount
92 DiscountFactor fDiscount, // foreign discount
93 Real stdDev,
94 Real delta);
95
96 Real operator()(Real strike) const;
97
98 private:
101 };
102
103
105 public:
107 Option::Type ot,
109 Real spot,
110 DiscountFactor dDiscount, // domestic discount
111 DiscountFactor fDiscount, // foreign discount
112 Real stdDev);
113
114 Real operator()(Real strike) const;
115
116 private:
119 };
120
121}
122
123
124#endif
Black-formula calculator class.
Brent 1-D solver.
Black delta calculator class.
Real atmStrike(DeltaVolQuote::AtmType atmT) const
Real strikeFromDelta(Real delta) const
Real deltaFromStrike(Real strike) const
void setDeltaType(DeltaVolQuote::DeltaType dt)
Class for the quotation of delta vs vol.
QL_REAL Real
real number
Definition: types.hpp:50
Real DiscountFactor
discount factor between dates
Definition: types.hpp:66
QL_INTEGER Integer
integer number
Definition: types.hpp:35
Definition: any.hpp:35
normal, cumulative and inverse cumulative distributions