22#include <ql/exercise.hpp>
23#include <ql/instruments/impliedvolatility.hpp>
24#include <ql/instruments/vanillaoption.hpp>
25#include <ql/pricingengines/vanilla/analyticeuropeanengine.hpp>
26#include <ql/pricingengines/vanilla/analyticdividendeuropeanengine.hpp>
27#include <ql/pricingengines/vanilla/fdblackscholesvanillaengine.hpp>
33 const ext::shared_ptr<StrikedTypePayoff>& payoff,
34 const ext::shared_ptr<Exercise>& exercise)
40 const ext::shared_ptr<GeneralizedBlackScholesProcess>& process,
46 accuracy, maxEvaluations, minVol, maxVol);
51 const ext::shared_ptr<GeneralizedBlackScholesProcess>& process,
58 QL_REQUIRE(!
isExpired(),
"option expired");
60 ext::shared_ptr<SimpleQuote> volQuote(
new SimpleQuote);
62 ext::shared_ptr<GeneralizedBlackScholesProcess> newProcess =
66 std::unique_ptr<PricingEngine>
engine;
69 if (dividends.empty())
70 engine = std::make_unique<AnalyticEuropeanEngine>(newProcess);
72 engine = std::make_unique<AnalyticDividendEuropeanEngine>(newProcess, dividends);
76 if (dividends.empty())
77 engine = std::make_unique<FdBlackScholesVanillaEngine>(newProcess);
79 engine = std::make_unique<FdBlackScholesVanillaEngine>(newProcess, dividends);
82 QL_FAIL(
"unknown exercise type");
100 QL_DEPRECATED_DISABLE_WARNING
102 QL_DEPRECATED_ENABLE_WARNING
virtual void setupArguments(PricingEngine::arguments *) const
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
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
VanillaOption(const ext::shared_ptr< StrikedTypePayoff > &, const ext::shared_ptr< Exercise > &)
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)
Real Volatility
volatility
std::size_t Size
size of a container
std::vector< ext::shared_ptr< Dividend > > DividendSchedule