35 const ext::shared_ptr<StrikedTypePayoff>&
payoff,
36 const ext::shared_ptr<Exercise>& exercise)
38 barrierType_(barrierType), barrier_(barrier), rebate_(rebate) {}
45 QL_REQUIRE(moreArgs !=
nullptr,
"wrong argument type");
54 const ext::shared_ptr<GeneralizedBlackScholesProcess>& process,
60 accuracy, maxEvaluations, minVol, maxVol);
65 const ext::shared_ptr<GeneralizedBlackScholesProcess>& process,
73 ext::shared_ptr<SimpleQuote> volQuote(
new SimpleQuote);
75 ext::shared_ptr<GeneralizedBlackScholesProcess> newProcess =
79 std::unique_ptr<PricingEngine>
engine;
82 if (dividends.empty())
83 engine = std::make_unique<AnalyticBarrierEngine>(newProcess);
85 engine = std::make_unique<FdBlackScholesBarrierEngine>(newProcess, dividends);
89 QL_FAIL(
"engine not available for non-European barrier option");
92 QL_FAIL(
"unknown exercise type");
110 OneAssetOption::arguments::validate();
112 switch (barrierType) {
127 switch (arguments_.barrierType) {
130 return underlying < arguments_.barrier;
133 return underlying > arguments_.barrier;
Analytic barrier option engines.
Barrier option on a single asset.
Arguments for barrier option calculation
void validate() const override
Barrier-option engine base class
bool triggered(Real underlying) const
Barrier::Type barrierType_
void setupArguments(PricingEngine::arguments *) const override
Volatility impliedVolatility(Real price, const ext::shared_ptr< GeneralizedBlackScholesProcess > &process, Real accuracy=1.0e-4, Size maxEvaluations=100, Volatility minVol=1.0e-7, Volatility maxVol=4.0) const
BarrierOption(Barrier::Type barrierType, Real barrier, Real rebate, const ext::shared_ptr< StrikedTypePayoff > &payoff, const ext::shared_ptr< Exercise > &exercise)
virtual void setupArguments(PricingEngine::arguments *) const
template class providing a null value for a given type.
Base class for options on a single asset.
bool isExpired() const override
returns whether the instrument might have value greater than zero.
ext::shared_ptr< Exercise > exercise_
market element returning a stored value
static ext::shared_ptr< GeneralizedBlackScholesProcess > clone(const ext::shared_ptr< GeneralizedBlackScholesProcess > &, const ext::shared_ptr< SimpleQuote > &)
static Volatility calculate(const Instrument &instrument, const PricingEngine &engine, SimpleQuote &volQuote, Real targetValue, Real accuracy, Natural maxEvaluations, Volatility minVol, Volatility maxVol)
#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.
Finite-differences Black/Scholes barrier-option engine.
Real Volatility
volatility
std::size_t Size
size of a container
Utilities for implied-volatility calculation.
ext::shared_ptr< QuantLib::Payoff > payoff
std::vector< ext::shared_ptr< Dividend > > DividendSchedule
Placeholder for enumerated barrier types.