29 ext::shared_ptr<GeneralizedBlackScholesProcess> process)
30 : process_(
std::move(process)) {
35 ext::shared_ptr<PlainVanillaPayoff>
payoff =
39 "strike must be positive");
42 QL_REQUIRE(spot > 0.0,
"negative or null underlying given");
47 switch (
payoff->optionType()) {
50 switch (barrierType) {
52 switch (barrierRange) {
63 QL_FAIL(
"invalid barrier range");
68 switch (barrierRange) {
73 QL_FAIL(
"Down-and-in partial-time end barrier is not implemented");
75 QL_FAIL(
"invalid barrier range");
80 switch (barrierRange) {
91 QL_FAIL(
"invalid barrier range");
96 switch (barrierRange) {
101 QL_FAIL(
"Up-and-in partial-time end barrier is not implemented");
103 QL_FAIL(
"invalid barrier range");
107 QL_FAIL(
"unknown barrier type");
112 QL_FAIL(
"Partial-time barrier Put option is not implemented");
115 QL_FAIL(
"unknown option type");
124 switch (barrierType) {
140 QL_FAIL(
"invalid barrier type");
143 QL_FAIL(
"case of strike>barrier is not implemented for OutEnd B2 type");
174 ext::shared_ptr<EuropeanExercise> exercise =
177 ext::shared_ptr<PlainVanillaPayoff>
payoff =
183 ext::make_shared<AnalyticEuropeanEngine>(
process_));
185 return europeanOption.
NPV() -
CA(eta);
203 ext::shared_ptr<PlainVanillaPayoff>
payoff =
267 return CmlNormDist(a,
b);
289 return d1() - vol*std::sqrt(T2);
302 return e1() - vol*std::sqrt(T1);
326 return g1() - vol*std::sqrt(T2);
338 return g3()-vol*std::sqrt(T2);
342 return std::pow((H/
S),power);
Analytic European engine.
Analytic engine for partial-time barrier options.
bivariate cumulative normal distribution
Time residualTime() const
DiscountFactor dividendDiscount() const
AnalyticPartialTimeBarrierOptionEngine(ext::shared_ptr< GeneralizedBlackScholesProcess > process)
void calculate() const override
Real HS(Real S, Real H, Real power) const
Volatility volatility(Time t) const
Real stdDeviation() const
Real M(Real a, Real b, Real rho) const
Time coverEventTime() const
Rate riskFreeRate() const
ext::shared_ptr< GeneralizedBlackScholesProcess > process_
Real CIA(Integer n) const
Rate dividendYield() const
Real CoB2(PartialBarrier::Type barrierType) const
DiscountFactor riskFreeDiscount() const
Cumulative bivariate normal distribution function.
PartialTimeBarrierOption::results results_
PartialTimeBarrierOption::arguments arguments_
Real NPV() const
returns the net present value of the instrument.
void setPricingEngine(const ext::shared_ptr< PricingEngine > &)
set the pricing engine to be used.
std::pair< iterator, bool > registerWith(const ext::shared_ptr< Observable > &)
ext::shared_ptr< Exercise > exercise
ext::shared_ptr< Payoff > payoff
PartialBarrier::Range barrierRange
PartialBarrier::Type barrierType
Vanilla option (no discrete dividends, no barriers) on a single asset.
#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.
ext::function< Real(Real)> b
@ NoFrequency
null frequency
Real Time
continuous quantity with 1-year units
Real DiscountFactor
discount factor between dates
Real Volatility
volatility
QL_INTEGER Integer
integer number
ext::shared_ptr< QuantLib::Payoff > payoff