28 ext::shared_ptr<GeneralizedBlackScholesProcess> process,
int series)
29 : process_(
std::move(process)), series_(series) {
36 "this engine handles only european options");
38 ext::shared_ptr<PlainVanillaPayoff>
payoff =
39 ext::dynamic_pointer_cast<PlainVanillaPayoff>(
arguments_.payoff);
44 "strike must be positive");
47 QL_REQUIRE(spot > 0.0,
"negative or null underlying given");
58 switch (
payoff->optionType()) {
60 switch (barrierType) {
69 QL_FAIL(
"unsupported double-barrier type: "
72 QL_FAIL(
"unknown double-barrier type: "
77 switch (barrierType) {
86 QL_FAIL(
"unsupported double-barrier type: "
89 QL_FAIL(
"unknown double-barrier type: "
105 ext::shared_ptr<PlainVanillaPayoff>
payoff =
106 ext::dynamic_pointer_cast<PlainVanillaPayoff>(
arguments_.payoff);
159 ext::shared_ptr<StrikedTypePayoff>
payoff =
160 ext::dynamic_pointer_cast<StrikedTypePayoff>(
arguments_.payoff);
197 return std::max(0.0, kov);
233 return std::max(0.0, kov);
Analytic double barrier european option engines.
Black-formula calculator class.
CumulativeNormalDistribution f_
Time residualTime() const
Volatility volatility() const
Real vanillaEquivalent() const
DiscountFactor dividendDiscount() const
void calculate() const override
Real stdDeviation() const
Real volatilitySquared() const
Rate riskFreeRate() const
ext::shared_ptr< GeneralizedBlackScholesProcess > process_
Rate dividendYield() const
AnalyticDoubleBarrierEngine(ext::shared_ptr< GeneralizedBlackScholesProcess > process, int series=5)
DiscountFactor riskFreeDiscount() const
Black 1976 calculator class.
DoubleBarrier::Type barrierType
bool triggered(Real underlying) const
DoubleBarrierOption::results results_
DoubleBarrierOption::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 Time
continuous quantity with 1-year units
Real DiscountFactor
discount factor between dates
Real Volatility
volatility
ext::shared_ptr< QuantLib::Payoff > payoff
@ KOKI
lower barrier KI, upper KO