31 ext::shared_ptr<GeneralizedBlackScholesProcess> process)
32 : process_(
std::move(process)) {
38 ext::shared_ptr<PlainVanillaPayoff>
payoff =
39 ext::dynamic_pointer_cast<PlainVanillaPayoff>(
arguments_.payoff);
42 "strike must be positive");
45 "only european style option are supported");
49 QL_REQUIRE(spot > 0.0,
"negative or null underlying given");
54 switch (
payoff->optionType()) {
56 switch (barrierType) {
84 switch (barrierType) {
122 ext::shared_ptr<PlainVanillaPayoff>
payoff =
123 ext::dynamic_pointer_cast<PlainVanillaPayoff>(
arguments_.payoff);
129 return process_->blackVolatility()->blackVol(
135 return std::sqrt(
process_->blackVolatility()->blackVariance(
149 return process_->riskFreeRate()->zeroRate(
151 process_->riskFreeRate()->dayCounter(),
156 return process_->riskFreeRate()->discount(
161 return process_->dividendYield()->zeroRate(
163 process_->dividendYield()->dayCounter(),
168 return process_->dividendYield()->discount(
202 Real powHS0 = std::pow(HS, 2 *
mu());
203 Real powHS1 = powHS0 * HS * HS;
215 Real powHS0 = std::pow(HS, 2 *
mu());
216 Real powHS1 = powHS0 * HS * HS;
249 Real powHSplus = std::pow(HS, m + lambda);
250 Real powHSminus = std::pow(HS, m - lambda);
254 + lambda * sigmaSqrtT;
257 Real N2 =
f_(eta * (z - 2.0 * lambda * sigmaSqrtT));
260 return rebate() * ((N1 == 0.0 ?
Real(0.0) :
Real(powHSplus * N1)) + (N2 == 0.0 ?
Real(0.0) :
Real(powHSminus * N2)));
Analytic barrier option engines.
Real C(Real eta, Real phi) const
CumulativeNormalDistribution f_
Volatility volatility() const
DiscountFactor dividendDiscount() const
void calculate() const override
Real D(Real eta, Real phi) const
Real stdDeviation() const
Rate riskFreeRate() const
ext::shared_ptr< GeneralizedBlackScholesProcess > process_
Rate dividendYield() const
AnalyticBarrierEngine(ext::shared_ptr< GeneralizedBlackScholesProcess > process)
DiscountFactor riskFreeDiscount() const
Barrier::Type barrierType
bool triggered(Real underlying) const
BarrierOption::results results_
BarrierOption::arguments arguments_
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
#define QL_FAIL(message)
throw an error (possibly with file and line information)
Option exercise classes and payoff function.
@ NoFrequency
null frequency
Real DiscountFactor
discount factor between dates
Real Volatility
volatility
ext::shared_ptr< QuantLib::Payoff > payoff