32 "positive spot value required");
35 "positive discount required");
38 "positive dividend discount required");
41 "negative variance not allowed");
57 QL_FAIL(
"null discount not handled yet");
67 n_d1 =
f.derivative(
D1_);
68 n_d2 =
f.derivative(
D2_);
117 QL_FAIL(
"invalid option type");
138 ext::shared_ptr<CashOrNothingPayoff> coo =
139 ext::dynamic_pointer_cast<CashOrNothingPayoff>(
payoff);
140 if (coo !=
nullptr) {
141 K_ = coo->cashPayoff();
146 ext::shared_ptr<AssetOrNothingPayoff> aoo =
147 ext::dynamic_pointer_cast<AssetOrNothingPayoff>(
payoff);
148 if (aoo !=
nullptr) {
165 Real DforwardDs, DXDs;
188 Real DforwardDs, DXDs, D2forwardDs2, D2XDs2;
202 D2alphaDs2 *
forward_ + DalphaDs * DforwardDs
203 + DalphaDs * DforwardDs +
alpha_ * D2forwardDs2
204 + D2betaDs2 *
X_ + DbetaDs * DXDs
205 + DbetaDs * DXDs +
beta_ * D2XDs2
213 "negative maturity not allowed");
218 Real DforwardDr, DXDr;
227 return maturity *
K_ * (
Analytical formulae for american exercise with payoff at hit.
AmericanPayoffAtHit(Real spot, DiscountFactor discount, DiscountFactor dividendDiscount, Real variance, const ext::shared_ptr< StrikedTypePayoff > &payoff)
DiscountFactor dividendDiscount_
Real rho(Time maturity) const
Cumulative normal distribution function.
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
#define QL_FAIL(message)
throw an error (possibly with file and line information)
LinearInterpolation variance
Real Time
continuous quantity with 1-year units
Real DiscountFactor
discount factor between dates
ext::shared_ptr< QuantLib::Payoff > payoff
normal, cumulative and inverse cumulative distributions