28 ext::shared_ptr<GeneralizedBlackScholesProcess> process)
29 : process_(
std::move(process)) {
37 "this engine cannot price options already started");
42 "this engine cannot price capped/floored options");
45 "not an European option");
47 ext::shared_ptr<PercentageStrikePayoff> moneyness =
48 ext::dynamic_pointer_cast<PercentageStrikePayoff>(
53 resetDates.push_back(
arguments_.exercise->lastDate());
56 QL_REQUIRE(underlying > 0.0,
"negative or null underlying");
58 ext::shared_ptr<StrikedTypePayoff>
payoff(
67 for (
Size i = 1; i < resetDates.size(); i++) {
70 process_->riskFreeRate()->discount(resetDates[i-1]);
72 process_->riskFreeRate()->discount(resetDates[i]) /
73 process_->riskFreeRate()->discount(resetDates[i-1]);
75 process_->dividendYield()->discount(resetDates[i]) /
76 process_->dividendYield()->discount(resetDates[i-1]);
77 Real forward = (1.0/moneyness->strike())*qDiscount/rDiscount;
79 process_->blackVolatility()->blackForwardVariance(
80 resetDates[i-1],resetDates[i],
81 underlying * moneyness->strike());
94 discount * moneyness->strike() * black.
value();
98 process_->riskFreeRate()->referenceDate(),
100 results_.rho += discount * moneyness->strike() *
104 results_.dividendRho += discount * moneyness->strike() *
107 dt = voldc.
yearFraction(resetDates[i-1], resetDates[i]);
108 results_.vega += discount * moneyness->strike() * black.
vega(dt);
Black-formula calculator class.
Black 1976 calculator class.
Real dividendRho(Time maturity) const
Real vega(Time maturity) const
Real rho(Time maturity) const
std::vector< Date > resetDates
Time yearFraction(const Date &, const Date &, const Date &refPeriodStart=Date(), const Date &refPeriodEnd=Date()) const
Returns the period between two dates as a fraction of year.
CliquetOption::results results_
CliquetOption::arguments arguments_
template class providing a null value for a given type.
std::pair< iterator, bool > registerWith(const ext::shared_ptr< Observable > &)
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
Option exercise classes and payoff function.
LinearInterpolation variance
@ NoFrequency
null frequency
Real Time
continuous quantity with 1-year units
Real DiscountFactor
discount factor between dates
std::size_t Size
size of a container
ext::shared_ptr< QuantLib::Payoff > payoff