20#ifndef quantlib_mc_forward_european_bs_engine_hpp
21#define quantlib_mc_forward_european_bs_engine_hpp
35 template <
class RNG = PseudoRandom,
class S = Statistics>
49 const ext::shared_ptr<GeneralizedBlackScholesProcess>& process,
51 Size timeStepsPerYear,
53 bool antitheticVariate,
55 Real requiredTolerance,
59 ext::shared_ptr<path_pricer_type>
pathPricer()
const override;
63 template <
class RNG = PseudoRandom,
class S = Statistics>
67 ext::shared_ptr<GeneralizedBlackScholesProcess> process);
78 operator ext::shared_ptr<PricingEngine>()
const;
80 ext::shared_ptr<GeneralizedBlackScholesProcess>
process_;
107 template <
class RNG,
class S>
110 const ext::shared_ptr<GeneralizedBlackScholesProcess>& process,
112 Size timeStepsPerYear,
114 bool antitheticVariate,
115 Size requiredSamples,
116 Real requiredTolerance,
130 template <
class RNG,
class S>
132 ext::shared_ptr<typename MCForwardEuropeanBSEngine<RNG,S>::path_pricer_type>
135 TimeGrid timeGrid = this->timeGrid();
137 Time resetTime = this->process_->time(this->arguments_.resetDate);
140 ext::shared_ptr<PlainVanillaPayoff>
payoff =
141 ext::dynamic_pointer_cast<PlainVanillaPayoff>(
142 this->arguments_.payoff);
145 ext::shared_ptr<EuropeanExercise> exercise =
146 ext::dynamic_pointer_cast<EuropeanExercise>(
147 this->arguments_.exercise);
150 ext::shared_ptr<GeneralizedBlackScholesProcess> process =
151 ext::dynamic_pointer_cast<GeneralizedBlackScholesProcess>(
153 QL_REQUIRE(process,
"Black-Scholes process required");
155 return ext::shared_ptr<
typename
159 this->arguments_.moneyness,
161 process->riskFreeRate()->discount(
166 template <
class RNG,
class S>
168 ext::shared_ptr<GeneralizedBlackScholesProcess> process)
172 template <
class RNG,
class S>
179 template <
class RNG,
class S>
182 stepsPerYear_ = steps;
186 template <
class RNG,
class S>
190 "tolerance already set");
195 template <
class RNG,
class S>
200 "number of samples already set");
202 "chosen random generator policy "
203 "does not allow an error estimate");
204 tolerance_ = tolerance;
208 template <
class RNG,
class S>
211 maxSamples_ = samples;
215 template <
class RNG,
class S>
222 template <
class RNG,
class S>
229 template <
class RNG,
class S>
236 template <
class RNG,
class S>
241 "number of steps not given");
243 "number of steps overspecified - set EITHER steps OR stepsPerYear");
244 return ext::shared_ptr<PricingEngine>(
new
250 samples_, tolerance_,
Real operator()(const Path &path) const override
MCForwardVanillaEngine< SingleVariate, RNG, S >::path_generator_type path_generator_type
MCForwardEuropeanBSEngine(const ext::shared_ptr< GeneralizedBlackScholesProcess > &process, Size timeSteps, Size timeStepsPerYear, bool brownianBridge, bool antitheticVariate, Size requiredSamples, Real requiredTolerance, Size maxSamples, BigNatural seed)
MCForwardVanillaEngine< SingleVariate, RNG, S >::stats_type stats_type
ext::shared_ptr< path_pricer_type > pathPricer() const override
MCForwardVanillaEngine< SingleVariate, RNG, S >::path_pricer_type path_pricer_type
Monte Carlo engine for forward-starting vanilla options.
McSimulation< MC, RNG, S >::path_generator_type path_generator_type
McSimulation< MC, RNG, S >::path_pricer_type path_pricer_type
MakeMCForwardEuropeanBSEngine & withAntitheticVariate(bool b=true)
MakeMCForwardEuropeanBSEngine & withStepsPerYear(Size steps)
MakeMCForwardEuropeanBSEngine & withSteps(Size steps)
MakeMCForwardEuropeanBSEngine & withSamples(Size samples)
MakeMCForwardEuropeanBSEngine & withAbsoluteTolerance(Real tolerance)
MakeMCForwardEuropeanBSEngine(ext::shared_ptr< GeneralizedBlackScholesProcess > process)
ext::shared_ptr< GeneralizedBlackScholesProcess > process_
MakeMCForwardEuropeanBSEngine & withBrownianBridge(bool b=false)
MakeMCForwardEuropeanBSEngine & withMaxSamples(Size samples)
MakeMCForwardEuropeanBSEngine & withSeed(BigNatural seed)
template class providing a null value for a given type.
single-factor random walk
base class for path pricers
Size closestIndex(Time t) const
returns the index i such that grid[i] is closest to t
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
ext::function< Real(Real)> b
Real Time
continuous quantity with 1-year units
Real DiscountFactor
discount factor between dates
std::size_t Size
size of a container
ext::shared_ptr< QuantLib::Payoff > payoff
Monte Carlo engine for forward-starting strike-reset vanilla options.
unsigned QL_BIG_INTEGER BigNatural
large positive integer
default Monte Carlo traits for single-variate models