31 ext::shared_ptr<GeneralizedBlackScholesProcess> process)
32 : process_(
std::move(process)) {
38 ext::shared_ptr<AmericanExercise> ex =
39 ext::dynamic_pointer_cast<AmericanExercise>(arguments_.exercise);
42 process_->blackVolatility()->referenceDate(),
43 "American option with window exercise not handled yet");
45 ext::shared_ptr<StrikedTypePayoff>
payoff =
46 ext::dynamic_pointer_cast<StrikedTypePayoff>(arguments_.payoff);
50 QL_REQUIRE(spot > 0.0,
"negative or null underlying given");
53 process_->blackVolatility()->blackVariance(ex->lastDate(),
55 Rate dividendDiscount =
56 process_->dividendYield()->discount(ex->lastDate());
57 Rate riskFreeDiscount =
58 process_->riskFreeRate()->discount(ex->lastDate());
60 if(ex->payoffAtExpiry()) {
74 process_->riskFreeRate()->referenceDate(),
75 arguments_.exercise->lastDate());
Analytical formulae for american exercise with payoff at expiry.
Analytical formulae for american exercise with payoff at hit.
analytic digital American option engine
const Instrument::results * results_
Analytic formula for American exercise payoff at-expiry options.
Analytic formula for American exercise payoff at-hit options.
Real rho(Time maturity) const
void calculate() const override
AnalyticDigitalAmericanEngine(ext::shared_ptr< GeneralizedBlackScholesProcess >)
ext::shared_ptr< GeneralizedBlackScholesProcess > process_
virtual bool knock_in() 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.
#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
ext::shared_ptr< QuantLib::Payoff > payoff