20#include <ql/cashflows/cashflowvectors.hpp>
21#include <ql/exercise.hpp>
22#include <ql/instruments/dividendvanillaoption.hpp>
23#include <ql/instruments/impliedvolatility.hpp>
24#include <ql/pricingengines/vanilla/analyticdividendeuropeanengine.hpp>
25#include <ql/pricingengines/vanilla/fdblackscholesvanillaengine.hpp>
26#include <ql/utilities/dataformatters.hpp>
32 const ext::shared_ptr<StrikedTypePayoff>& payoff,
33 const ext::shared_ptr<Exercise>& exercise,
34 const std::vector<Date>& dividendDates,
35 const std::vector<Real>& dividends)
42 const ext::shared_ptr<GeneralizedBlackScholesProcess>& process,
48 QL_REQUIRE(!
isExpired(),
"option expired");
50 ext::shared_ptr<SimpleQuote> volQuote(
new SimpleQuote);
52 ext::shared_ptr<GeneralizedBlackScholesProcess> newProcess =
56 std::unique_ptr<PricingEngine>
engine;
59 QL_DEPRECATED_DISABLE_WARNING
60 engine = std::make_unique<AnalyticDividendEuropeanEngine>(newProcess);
61 QL_DEPRECATED_ENABLE_WARNING
64 engine = std::make_unique<FdBlackScholesVanillaEngine>(newProcess);
67 QL_FAIL(
"engine not available for Bermudan option with dividends");
70 QL_FAIL(
"unknown exercise type");
88 QL_REQUIRE(
arguments !=
nullptr,
"wrong engine type");
95 OneAssetOption::arguments::validate();
100 QL_REQUIRE(
cashFlow[i]->date() <= exerciseDate,
103 <<
") is later than the exercise date ("
104 << exerciseDate <<
")");
DividendSchedule cashFlow
void validate() const override
DividendVanillaOption(const ext::shared_ptr< StrikedTypePayoff > &payoff, const ext::shared_ptr< Exercise > &exercise, const std::vector< Date > ÷ndDates, const std::vector< Real > ÷nds)
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
DividendSchedule cashFlow_
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_
ext::shared_ptr< Exercise > exercise() const
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)
detail::ordinal_holder ordinal(Size)
outputs naturals as 1st, 2nd, 3rd...
Real Volatility
volatility
std::size_t Size
size of a container
std::vector< ext::shared_ptr< Dividend > > DividendVector(const std::vector< Date > ÷ndDates, const std::vector< Real > ÷nds)
helper function building a sequence of fixed dividends