32 dDiscount_(dDiscount), fDiscount_(fDiscount),
33 stdDev_(stdDev), spot_(spot),
34 forward_(spot*fDiscount/dDiscount), phi_(
Integer(ot)) {
37 "positive spot value required: " <<
38 spot_ <<
" not allowed");
40 "positive domestic discount factor required: " <<
43 "positive foreign discount factor required: " <<
46 "non-negative standard deviation required: "
57 "positive strike value required: " <<
58 strike <<
" not allowed");
96 QL_REQUIRE(delta*
phi_>=0.0,
"Option type and delta are incoherent.");
101 "Spot delta out of range.");
109 "Forward delta out of range.");
135 Real accuracy = 1.0e-10;
148 res=solver.
solve(
f, accuracy, rightLimit, 0.0,
spot_*100.0);
159 leftLimit=solver.
solve(g, accuracy, rightLimit*0.5,
162 Real guess=leftLimit+(rightLimit-leftLimit)*0.5;
164 res=solver.
solve(
f, accuracy, guess, leftLimit, rightLimit);
204 "|PutDelta|=CallDelta=0.50 only possible for forward delta.");
219 Real cum_d1_pos_ = 1.0;
220 Real cum_d1_neg_ = 0.0;
256 n_d1_ =
f.derivative(d1_);
267 Real cum_d2_pos_= 1.0;
268 Real cum_d2_neg_= 0.0;
308 n_d2_ =
f.derivative(d2_);
336 bdc_(ot,dt,spot,dDiscount,fDiscount,stdDev), delta_(delta) {}
351 bdc_(ot,dt,spot,dDiscount,fDiscount,stdDev), stdDev_(stdDev) {}
Black-Scholes formula delta calculator class.
DeltaVolQuote::DeltaType dt_
Real atmStrike(DeltaVolQuote::AtmType atmT) const
Real nD2(Real strike) const
void setOptionType(Option::Type ot)
DiscountFactor fDiscount_
DiscountFactor dDiscount_
Real strikeFromDelta(Real delta) const
Real deltaFromStrike(Real strike) const
Real cumD2(Real strike) const
void setDeltaType(DeltaVolQuote::DeltaType dt)
BlackDeltaCalculator(Option::Type ot, DeltaVolQuote::DeltaType dt, Real spot, DiscountFactor dDiscount, DiscountFactor fDiscount, Real stdDev)
Real cumD1(Real strike) const
Real nD1(Real strike) const
BlackDeltaCalculator bdc_
BlackDeltaPremiumAdjustedMaxStrikeClass(Option::Type ot, DeltaVolQuote::DeltaType dt, Real spot, DiscountFactor dDiscount, DiscountFactor fDiscount, Real stdDev)
Real operator()(Real strike) const
BlackDeltaCalculator bdc_
BlackDeltaPremiumAdjustedSolverClass(Option::Type ot, DeltaVolQuote::DeltaType dt, Real spot, DiscountFactor dDiscount, DiscountFactor fDiscount, Real stdDev, Real delta)
Real operator()(Real strike) const
Cumulative normal distribution function.
Inverse cumulative normal distribution function.
void setMaxEvaluations(Size evaluations)
Real solve(const F &f, Real accuracy, Real guess, Real step) const
#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)
Real DiscountFactor
discount factor between dates
QL_INTEGER Integer
integer number