QuantLib
: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
ql
pricingengines
americanpayoffatexpiry.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) 2004 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 americanpayoffatexpiry.hpp
21
\brief Analytical formulae for american exercise with payoff at expiry
22
*/
23
24
#ifndef quantlib_americanpayoffatexpiry_h
25
#define quantlib_americanpayoffatexpiry_h
26
27
#include <
ql/instruments/payoffs.hpp
>
28
29
namespace
QuantLib
{
30
31
//! Analytic formula for American exercise payoff at-expiry options
32
/*! \todo calculate greeks */
33
class
AmericanPayoffAtExpiry
{
34
public
:
35
AmericanPayoffAtExpiry
(
36
Real
spot,
37
DiscountFactor
discount,
38
DiscountFactor
dividendDiscount,
39
Real
variance
,
40
const
ext::shared_ptr<StrikedTypePayoff>&
payoff
,
41
bool
knock_in =
true
);
42
Real
value
()
const
;
43
private
:
44
Real
spot_
;
45
DiscountFactor
discount_
,
dividendDiscount_
;
46
Real
variance_
;
47
48
Real
forward_
;
49
Volatility
stdDev_
;
50
51
Real
strike_
,
K_
;
52
53
Real
mu_
,
log_H_S_
;
54
55
Real
D1_
,
D2_
,
cum_d1_
,
cum_d2_
,
n_d1_
,
n_d2_
;
56
57
bool
inTheMoney_
;
58
Real
Y_
,
X_
;
59
bool
knock_in_
;
60
};
61
62
63
// inline definitions
64
65
inline
Real
AmericanPayoffAtExpiry::value
()
const
{
66
return
discount_
*
K_
* (
X_
*
cum_d1_
+
Y_
*
cum_d2_
);
67
}
68
69
}
70
71
72
#endif
QuantLib::AmericanPayoffAtExpiry
Analytic formula for American exercise payoff at-expiry options.
Definition:
americanpayoffatexpiry.hpp:33
QuantLib::AmericanPayoffAtExpiry::discount_
DiscountFactor discount_
Definition:
americanpayoffatexpiry.hpp:45
QuantLib::AmericanPayoffAtExpiry::variance_
Real variance_
Definition:
americanpayoffatexpiry.hpp:46
QuantLib::AmericanPayoffAtExpiry::mu_
Real mu_
Definition:
americanpayoffatexpiry.hpp:53
QuantLib::AmericanPayoffAtExpiry::cum_d2_
Real cum_d2_
Definition:
americanpayoffatexpiry.hpp:55
QuantLib::AmericanPayoffAtExpiry::log_H_S_
Real log_H_S_
Definition:
americanpayoffatexpiry.hpp:53
QuantLib::AmericanPayoffAtExpiry::n_d1_
Real n_d1_
Definition:
americanpayoffatexpiry.hpp:55
QuantLib::AmericanPayoffAtExpiry::X_
Real X_
Definition:
americanpayoffatexpiry.hpp:58
QuantLib::AmericanPayoffAtExpiry::forward_
Real forward_
Definition:
americanpayoffatexpiry.hpp:48
QuantLib::AmericanPayoffAtExpiry::K_
Real K_
Definition:
americanpayoffatexpiry.hpp:51
QuantLib::AmericanPayoffAtExpiry::value
Real value() const
Definition:
americanpayoffatexpiry.hpp:65
QuantLib::AmericanPayoffAtExpiry::knock_in_
bool knock_in_
Definition:
americanpayoffatexpiry.hpp:59
QuantLib::AmericanPayoffAtExpiry::inTheMoney_
bool inTheMoney_
Definition:
americanpayoffatexpiry.hpp:57
QuantLib::AmericanPayoffAtExpiry::Y_
Real Y_
Definition:
americanpayoffatexpiry.hpp:58
QuantLib::AmericanPayoffAtExpiry::dividendDiscount_
DiscountFactor dividendDiscount_
Definition:
americanpayoffatexpiry.hpp:45
QuantLib::AmericanPayoffAtExpiry::cum_d1_
Real cum_d1_
Definition:
americanpayoffatexpiry.hpp:55
QuantLib::AmericanPayoffAtExpiry::spot_
Real spot_
Definition:
americanpayoffatexpiry.hpp:44
QuantLib::AmericanPayoffAtExpiry::n_d2_
Real n_d2_
Definition:
americanpayoffatexpiry.hpp:55
QuantLib::AmericanPayoffAtExpiry::stdDev_
Volatility stdDev_
Definition:
americanpayoffatexpiry.hpp:49
QuantLib::AmericanPayoffAtExpiry::D1_
Real D1_
Definition:
americanpayoffatexpiry.hpp:55
QuantLib::AmericanPayoffAtExpiry::D2_
Real D2_
Definition:
americanpayoffatexpiry.hpp:55
QuantLib::AmericanPayoffAtExpiry::strike_
Real strike_
Definition:
americanpayoffatexpiry.hpp:51
variance
LinearInterpolation variance
Definition:
fdmhestonvariancemesher.cpp:45
QuantLib::Real
QL_REAL Real
real number
Definition:
types.hpp:50
QuantLib::DiscountFactor
Real DiscountFactor
discount factor between dates
Definition:
types.hpp:66
QuantLib::Volatility
Real Volatility
volatility
Definition:
types.hpp:78
payoff
ext::shared_ptr< QuantLib::Payoff > payoff
Definition:
integralhestonvarianceoptionengine.cpp:350
QuantLib
Definition:
any.hpp:35
payoffs.hpp
Payoffs for various options.
Generated by
Doxygen
1.9.5