28 ext::shared_ptr<GeneralizedBlackScholesProcess> process,
30 : process_(
std::move(process)), dividends_(
std::move(dividends)) {
37 "not an European option");
39 ext::shared_ptr<StrikedTypePayoff>
payoff =
40 ext::dynamic_pointer_cast<StrikedTypePayoff>(arguments_.payoff);
43 Date settlementDate =
process_->riskFreeRate()->referenceDate();
49 if ( cashFlowDate >= settlementDate
50 && cashFlowDate <= arguments_.exercise->lastDate()) {
53 process_->riskFreeRate()->discount(cashFlowDate) /
54 process_->dividendYield()->discount(cashFlowDate);
58 Real spot =
process_->stateVariable()->value() - riskless;
60 "negative or null underlying after subtracting dividends");
64 arguments_.exercise->lastDate());
66 process_->riskFreeRate()->discount(arguments_.exercise->lastDate());
67 Real forwardPrice = spot * dividendDiscount / riskFreeDiscount;
70 process_->blackVolatility()->blackVariance(
71 arguments_.exercise->lastDate(),
85 process_->blackVolatility()->referenceDate(),
86 arguments_.exercise->lastDate());
89 Real delta_theta = 0.0, delta_rho = 0.0;
93 if (
d >= settlementDate
94 && d <= arguments_.exercise->lastDate()) {
108 t =
process_->time(arguments_.exercise->lastDate());
111 delta_theta * black.
delta(spot);
117 delta_rho * black.
delta(spot);
Analytic discrete-dividend European engine.
Black-formula calculator class.
const Instrument::results * results_
void calculate() const override
DividendSchedule dividends_
AnalyticDividendEuropeanEngine(ext::shared_ptr< GeneralizedBlackScholesProcess > process, DividendSchedule dividends)
ext::shared_ptr< GeneralizedBlackScholesProcess > process_
Black 1976 calculator class.
virtual Real delta(Real spot) const
Real vega(Time maturity) const
virtual Real gamma(Real spot) const
virtual Real theta(Real spot, Time maturity) const
Real rho(Time maturity) const
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.
template class providing a null value for a given type.
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
Option exercise classes and payoff function.
LinearInterpolation variance
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
std::vector< ext::shared_ptr< Dividend > > DividendSchedule