26#ifndef quantlib_mc_discrete_geometric_average_price_asian_engine_h
27#define quantlib_mc_discrete_geometric_average_price_asian_engine_h
44 template <
class RNG = PseudoRandom,
class S = Statistics>
58 const ext::shared_ptr<GeneralizedBlackScholesProcess>& process,
60 bool antitheticVariate,
62 Real requiredTolerance,
66 ext::shared_ptr<path_pricer_type>
pathPricer()
const override;
75 Real runningProduct = 1.0,
76 Size pastFixings = 0);
89 template <
class RNG,
class S>
92 const ext::shared_ptr<GeneralizedBlackScholesProcess>& process,
94 bool antitheticVariate,
96 Real requiredTolerance,
110 template <
class RNG,
class S>
116 ext::shared_ptr<PlainVanillaPayoff>
payoff =
117 ext::dynamic_pointer_cast<PlainVanillaPayoff>(
118 this->arguments_.payoff);
121 ext::shared_ptr<EuropeanExercise> exercise =
122 ext::dynamic_pointer_cast<EuropeanExercise>(
123 this->arguments_.exercise);
126 ext::shared_ptr<GeneralizedBlackScholesProcess> process =
127 ext::dynamic_pointer_cast<GeneralizedBlackScholesProcess>(
129 QL_REQUIRE(process,
"Black-Scholes process required");
131 return ext::shared_ptr<
typename
136 process->riskFreeRate()->discount(exercise->lastDate()),
137 this->arguments_.runningAccumulator,
138 this->arguments_.pastFixings));
142 template <
class RNG = PseudoRandom,
class S = Statistics>
146 ext::shared_ptr<GeneralizedBlackScholesProcess> process);
155 operator ext::shared_ptr<PricingEngine>()
const;
157 ext::shared_ptr<GeneralizedBlackScholesProcess>
process_;
165 template <
class RNG,
class S>
167 ext::shared_ptr<GeneralizedBlackScholesProcess> process)
171 template <
class RNG,
class S>
175 "tolerance already set");
180 template <
class RNG,
class S>
185 "number of samples already set");
187 "chosen random generator policy "
188 "does not allow an error estimate");
189 tolerance_ = tolerance;
193 template <
class RNG,
class S>
196 maxSamples_ = samples;
200 template <
class RNG,
class S>
207 template <
class RNG,
class S>
214 template <
class RNG,
class S>
221 template <
class RNG,
class S>
225 return ext::shared_ptr<PricingEngine>(
new
229 samples_, tolerance_,
Black constant volatility, no time dependence, no strike dependence.
Black volatility curve modelled as variance curve.
PlainVanillaPayoff payoff_
Real operator()(const Path &path) const override
Pricing engine for discrete average Asians using Monte Carlo simulation.
McSimulation< MC, RNG, S >::path_generator_type path_generator_type
McSimulation< MC, RNG, S >::path_pricer_type path_pricer_type
Monte Carlo pricing engine for discrete geometric average price Asian.
MCDiscreteAveragingAsianEngineBase< SingleVariate, RNG, S >::path_pricer_type path_pricer_type
MCDiscreteAveragingAsianEngineBase< SingleVariate, RNG, S >::path_generator_type path_generator_type
ext::shared_ptr< path_pricer_type > pathPricer() const override
MCDiscreteAveragingAsianEngineBase< SingleVariate, RNG, S >::stats_type stats_type
MCDiscreteGeometricAPEngine(const ext::shared_ptr< GeneralizedBlackScholesProcess > &process, bool brownianBridge, bool antitheticVariate, Size requiredSamples, Real requiredTolerance, Size maxSamples, BigNatural seed)
MakeMCDiscreteGeometricAPEngine & withBrownianBridge(bool b=true)
MakeMCDiscreteGeometricAPEngine & withSeed(BigNatural seed)
MakeMCDiscreteGeometricAPEngine & withAntitheticVariate(bool b=true)
MakeMCDiscreteGeometricAPEngine & withAbsoluteTolerance(Real tolerance)
MakeMCDiscreteGeometricAPEngine & withSamples(Size samples)
ext::shared_ptr< GeneralizedBlackScholesProcess > process_
MakeMCDiscreteGeometricAPEngine & withMaxSamples(Size samples)
MakeMCDiscreteGeometricAPEngine(ext::shared_ptr< GeneralizedBlackScholesProcess > process)
template class providing a null value for a given type.
single-factor random walk
base class for path pricers
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
Option exercise classes and payoff function.
ext::function< Real(Real)> b
Real DiscountFactor
discount factor between dates
std::size_t Size
size of a container
ext::shared_ptr< QuantLib::Payoff > payoff
Monte Carlo pricing engine for discrete average Asians.
unsigned QL_BIG_INTEGER BigNatural
large positive integer
default Monte Carlo traits for single-variate models