24#ifndef quantlib_mc_discrete_arithmetic_average_strike_asian_engine_hpp
25#define quantlib_mc_discrete_arithmetic_average_strike_asian_engine_hpp
36 template <
class RNG = PseudoRandom,
class S = Statistics>
49 const ext::shared_ptr<GeneralizedBlackScholesProcess>& process,
51 bool antitheticVariate,
53 Real requiredTolerance,
57 ext::shared_ptr<path_pricer_type>
pathPricer()
const override;
65 Real runningSum = 0.0,
66 Size pastFixings = 0);
80 template <
class RNG,
class S>
83 const ext::shared_ptr<GeneralizedBlackScholesProcess>& process,
85 bool antitheticVariate,
87 Real requiredTolerance,
99 template <
class RNG,
class S>
105 ext::shared_ptr<PlainVanillaPayoff>
payoff =
106 ext::dynamic_pointer_cast<PlainVanillaPayoff>(
107 this->arguments_.payoff);
110 ext::shared_ptr<EuropeanExercise> exercise =
111 ext::dynamic_pointer_cast<EuropeanExercise>(
112 this->arguments_.exercise);
115 ext::shared_ptr<GeneralizedBlackScholesProcess> process =
116 ext::dynamic_pointer_cast<GeneralizedBlackScholesProcess>(
118 QL_REQUIRE(process,
"Black-Scholes process required");
120 return ext::shared_ptr<
typename
124 process->riskFreeRate()->discount(exercise->lastDate()),
125 this->arguments_.runningAccumulator,
126 this->arguments_.pastFixings));
131 template <
class RNG = PseudoRandom,
class S = Statistics>
135 ext::shared_ptr<GeneralizedBlackScholesProcess> process);
144 operator ext::shared_ptr<PricingEngine>()
const;
146 ext::shared_ptr<GeneralizedBlackScholesProcess>
process_;
154 template <
class RNG,
class S>
156 ext::shared_ptr<GeneralizedBlackScholesProcess> process)
160 template <
class RNG,
class S>
164 "tolerance already set");
169 template <
class RNG,
class S>
174 "number of samples already set");
176 "chosen random generator policy "
177 "does not allow an error estimate");
178 tolerance_ = tolerance;
182 template <
class RNG,
class S>
185 maxSamples_ = samples;
189 template <
class RNG,
class S>
196 template <
class RNG,
class S>
203 template <
class RNG,
class S>
210 template <
class RNG,
class S>
213 operator ext::shared_ptr<PricingEngine>()
const {
214 return ext::shared_ptr<PricingEngine>(
218 samples_, tolerance_,
Real operator()(const Path &path) const override
Monte Carlo pricing engine for discrete arithmetic average-strike Asian.
MCDiscreteAveragingAsianEngineBase< SingleVariate, RNG, S >::path_pricer_type path_pricer_type
MCDiscreteAveragingAsianEngineBase< SingleVariate, RNG, S >::path_generator_type path_generator_type
MCDiscreteArithmeticASEngine(const ext::shared_ptr< GeneralizedBlackScholesProcess > &process, bool brownianBridge, bool antitheticVariate, Size requiredSamples, Real requiredTolerance, Size maxSamples, BigNatural seed)
ext::shared_ptr< path_pricer_type > pathPricer() const override
MCDiscreteAveragingAsianEngineBase< SingleVariate, RNG, S >::stats_type stats_type
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
MakeMCDiscreteArithmeticASEngine & withSeed(BigNatural seed)
MakeMCDiscreteArithmeticASEngine & withMaxSamples(Size samples)
MakeMCDiscreteArithmeticASEngine & withBrownianBridge(bool b=true)
MakeMCDiscreteArithmeticASEngine & withAbsoluteTolerance(Real tolerance)
ext::shared_ptr< GeneralizedBlackScholesProcess > process_
MakeMCDiscreteArithmeticASEngine & withAntitheticVariate(bool b=true)
MakeMCDiscreteArithmeticASEngine(ext::shared_ptr< GeneralizedBlackScholesProcess > process)
MakeMCDiscreteArithmeticASEngine & withSamples(Size samples)
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