31 ext::shared_ptr<GeneralizedBlackScholesProcess> process,
34 : process_(
std::move(process)), currentAverage_(
std::move(currentAverage)),
35 startDate_(startDate) {
42 "not an Arithmetic average option");
44 "not an European Option");
45 QL_REQUIRE(startDate_ <= process_->riskFreeRate()->referenceDate(),
46 "startDate must be earlier than or equal to reference date");
54 ext::shared_ptr<StrikedTypePayoff>
payoff =
55 ext::dynamic_pointer_cast<StrikedTypePayoff>(
arguments_.payoff);
69 process_->blackVolatility()->blackVol(maturity, strike);
77 Real b = riskFreeRate - dividendYield;
80 ?
Real((spot/(
T*
b))*(exp((
b-riskFreeRate)*T2)-exp(-riskFreeRate*T2)))
81 :
Real(spot*T2/
T * std::exp(-riskFreeRate*T2));
86 "current average required");
94 Real M = (2*spot*spot/(
b+volatility*volatility)) *
95 (((exp((2*
b+volatility*volatility)*T2)-1)
96 / (2*
b+volatility*volatility))-m);
100 Real V = log(D)-2*(riskFreeRate*T2+log(Se));
102 Real d1 = (1/sqrt(V))*((log(D)/2)-log(X));
103 Real d2 = d1-sqrt(V);
109 - Se + X*exp(-riskFreeRate*T2);
Black-formula calculator class.
void calculate() const override
Handle< Quote > currentAverage_
ext::shared_ptr< GeneralizedBlackScholesProcess > process_
ContinuousArithmeticAsianLevyEngine(ext::shared_ptr< GeneralizedBlackScholesProcess > process, Handle< Quote > currentAverage, Date startDate)
Average::Type averageType
Cumulative normal distribution function.
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.
ContinuousAveragingAsianOption::results results_
ContinuousAveragingAsianOption::arguments arguments_
Shared handle to an observable.
std::pair< iterator, bool > registerWith(const ext::shared_ptr< Observable > &)
Levy engine for continuous arithmetic Asian options.
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
Option exercise classes and payoff function.
ext::function< Real(Real)> b
@ NoFrequency
null frequency
Real Time
continuous quantity with 1-year units
Real Volatility
volatility
ext::shared_ptr< QuantLib::Payoff > payoff
normal, cumulative and inverse cumulative distributions