24#ifndef quantlib_mc_european_gjrgarch_engine_hpp
25#define quantlib_mc_european_gjrgarch_engine_hpp
39 template <
class RNG = PseudoRandom,
class S = Statistics>
47 Size timeStepsPerYear,
48 bool antitheticVariate,
50 Real requiredTolerance,
54 ext::shared_ptr<path_pricer_type>
pathPricer()
const override;
58 template <
class RNG = PseudoRandom,
class S = Statistics>
71 operator ext::shared_ptr<PricingEngine>()
const;
96 template <
class RNG,
class S>
98 const ext::shared_ptr<GJRGARCHProcess>& process,
99 Size timeSteps,
Size timeStepsPerYear,
bool antitheticVariate,
100 Size requiredSamples,
Real requiredTolerance,
103 false, antitheticVariate, false,
104 requiredSamples, requiredTolerance,
108 template <
class RNG,
class S>
113 ext::shared_ptr<PlainVanillaPayoff>
payoff(
114 ext::dynamic_pointer_cast<PlainVanillaPayoff>(
115 this->arguments_.payoff));
118 ext::shared_ptr<GJRGARCHProcess> process =
119 ext::dynamic_pointer_cast<GJRGARCHProcess>(this->process_);
120 QL_REQUIRE(process,
"GJRGARCH process required");
122 return ext::shared_ptr<
127 process->riskFreeRate()->discount(
128 this->timeGrid().back())));
132 template <
class RNG,
class S>
134 ext::shared_ptr<GJRGARCHProcess> process)
138 template <
class RNG,
class S>
142 "number of steps per year already set");
147 template <
class RNG,
class S>
151 "number of steps already set");
152 stepsPerYear_ = steps;
156 template <
class RNG,
class S>
160 "tolerance already set");
165 template <
class RNG,
class S>
169 "number of samples already set");
171 "chosen random generator policy "
172 "does not allow an error estimate");
173 tolerance_ = tolerance;
177 template <
class RNG,
class S>
180 maxSamples_ = samples;
184 template <
class RNG,
class S>
191 template <
class RNG,
class S>
198 template <
class RNG,
class S>
201 operator ext::shared_ptr<PricingEngine>()
const {
203 "number of steps not given");
204 return ext::shared_ptr<PricingEngine>(
209 samples_, tolerance_,
220 :
payoff_(type, strike), discount_(discount) {
222 "strike less than zero not allowed");
227 const Path& path = multiPath[0];
EuropeanGJRGARCHPathPricer(Option::Type type, Real strike, DiscountFactor discount)
PlainVanillaPayoff payoff_
Real operator()(const MultiPath &Multipath) const override
Monte Carlo GJR-GARCH-model engine for European options.
MCVanillaEngine< MultiVariate, RNG, S >::path_pricer_type path_pricer_type
ext::shared_ptr< path_pricer_type > pathPricer() const override
MCEuropeanGJRGARCHEngine(const ext::shared_ptr< GJRGARCHProcess > &, Size timeSteps, Size timeStepsPerYear, bool antitheticVariate, Size requiredSamples, Real requiredTolerance, Size maxSamples, BigNatural seed)
Pricing engine for vanilla options using Monte Carlo simulation.
McSimulation< MC, RNG, S >::path_pricer_type path_pricer_type
Monte Carlo GJR-GARCH European engine factory.
MakeMCEuropeanGJRGARCHEngine & withAntitheticVariate(bool b=true)
MakeMCEuropeanGJRGARCHEngine & withSamples(Size samples)
MakeMCEuropeanGJRGARCHEngine & withStepsPerYear(Size steps)
ext::shared_ptr< GJRGARCHProcess > process_
MakeMCEuropeanGJRGARCHEngine & withAbsoluteTolerance(Real tolerance)
MakeMCEuropeanGJRGARCHEngine(ext::shared_ptr< GJRGARCHProcess >)
MakeMCEuropeanGJRGARCHEngine & withSteps(Size steps)
MakeMCEuropeanGJRGARCHEngine & withMaxSamples(Size samples)
MakeMCEuropeanGJRGARCHEngine & withSeed(BigNatural seed)
Correlated multiple asset paths.
template class providing a null value for a given type.
single-factor random walk
Real back() const
final asset value
base class for path pricers
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
ext::function< Real(Real)> b
const ext::shared_ptr< Payoff > payoff_
GJR-GARCH(1,1) stochastic process.
Real DiscountFactor
discount factor between dates
std::size_t Size
size of a container
ext::shared_ptr< QuantLib::Payoff > payoff
Monte Carlo vanilla option engine.
unsigned QL_BIG_INTEGER BigNatural
large positive integer
default Monte Carlo traits for multi-variate models