29 const ext::shared_ptr<StochasticProcess1D>& process,
32 process, end, steps) {
34 up_ = process->stdDeviation(0.0,
x0_,
dt_);
44 const ext::shared_ptr<StochasticProcess1D>& process,
47 process, end, steps) {
49 dx_ = process->stdDeviation(0.0,
x0_,
dt_);
67 const ext::shared_ptr<StochasticProcess1D>& process,
70 process, end, steps) {
73 std::sqrt(4.0*process->variance(0.0,
x0_,
dt_)-
74 3.0*this->driftStep(0.0)*this->driftStep(0.0));
78 return (- 0.5 * this->
driftStep(stepTime) + 0.5 *
80 3.0*this->driftStep(stepTime)*this->driftStep(stepTime)));
87 const ext::shared_ptr<StochasticProcess1D>& process,
91 dx_ = std::sqrt(process->variance(0.0,
x0_,
dt_)+
92 this->driftStep(0.0)*this->driftStep(0.0));
102 this->driftStep(stepTime)*this->driftStep(stepTime));
111 const ext::shared_ptr<StochasticProcess1D>& process,
115 Real q = std::exp(process->variance(0.0,
x0_,
dt_));
119 up_ = 0.5 *
r *
q * (
q + 1 + std::sqrt(
q *
q + 2 *
q - 3));
120 down_ = 0.5 *
r *
q * (
q + 1 - std::sqrt(
q *
q + 2 *
q - 3));
138 Real up = 0.5 *
r *
q * (
q + 1 + std::sqrt(
q *
q + 2 *
q - 3));
139 Real down = 0.5 *
r *
q * (
q + 1 - std::sqrt(
q *
q + 2 *
q - 3));
142 * std::pow(up,
Real(index));
150 Real up = 0.5 *
r *
q * (
q + 1 + std::sqrt(
q *
q + 2 *
q - 3));
151 Real down = 0.5 *
r *
q * (
q + 1 - std::sqrt(
q *
q + 2 *
q - 3));
153 Real pu = (
r - down) / (up - down);
156 return (branch == 1 ? pu : pd);
165 process, end, ((steps % 2) != 0U ? steps : steps + 1)),
166 end_(end), oddSteps_((steps % 2) != 0U ? steps : steps + 1),
strike_(strike) {
168 QL_REQUIRE(strike>0.0,
"strike " << strike <<
"must be positive");
179 up_ = ermqdt * pdash /
pu_;
193 Real up = ermqdt * pdash / pu;
194 Real down = (ermqdt - pu * up) / (1.0 - pu);
197 * std::pow(up,
Real(index));
209 return (branch == 1 ? pu : pd);
218 Real alpha5 = alpha3*alpha2;
219 Real alpha7 = alpha5*alpha2;
221 Real gamma = (5.0/6.0)*alpha5 + (13.0/12.0)*alpha3
223 Real delta = -0.1025 *
alpha- 0.9285 *alpha3
224 -1.43 *alpha5 -0.5 *alpha7;
226 Real rootk= std::sqrt(k);
229 p+= gamma/(k*k*rootk);
231 p+= delta/(k*k*k*rootk);
240 end_(end), oddSteps_((steps % 2) != 0U ? steps : steps + 1),
strike_(strike) {
242 QL_REQUIRE(strike>0.0,
"strike " << strike <<
"must be positive");
252 up_ = ermqdt * pdash /
pu_;
265 Real up = ermqdt * pdash / pu;
266 Real down = (ermqdt - pu * up) / (1.0 - pu);
269 * std::pow(up,
Real(index));
281 return (branch == 1 ? pu : pd);
Additive equal probabilities binomial tree.
Real upStep(Time stepTime) const override
ExtendedAdditiveEQPBinomialTree(const ext::shared_ptr< StochasticProcess1D > &, Time end, Size steps, Real strike)
Binomial tree base class.
Real driftStep(Time driftTime) const
ext::shared_ptr< StochasticProcess1D > treeProcess_
Cox-Ross-Rubinstein (multiplicative) equal jumps binomial tree.
Real probUp(Time stepTime) const override
Real dxStep(Time stepTime) const override
ExtendedCoxRossRubinstein(const ext::shared_ptr< StochasticProcess1D > &, Time end, Size steps, Real strike)
Base class for equal jumps binomial tree.
Base class for equal probabilities binomial tree.
Jarrow-Rudd (multiplicative) equal probabilities binomial tree.
Real upStep(Time stepTime) const override
ExtendedJarrowRudd(const ext::shared_ptr< StochasticProcess1D > &, Time end, Size steps, Real strike)
ExtendedJoshi4(const ext::shared_ptr< StochasticProcess1D > &, Time end, Size steps, Real strike)
Real underlying(Size i, Size index) const
Real probability(Size, Size, Size branch) const
Real computeUpProb(Real k, Real dj) const
Leisen & Reimer tree: multiplicative approach.
Real underlying(Size i, Size index) const
Real probability(Size, Size, Size branch) const
ExtendedLeisenReimer(const ext::shared_ptr< StochasticProcess1D > &, Time end, Size steps, Real strike)
Tian tree: third moment matching, multiplicative approach
Real underlying(Size i, Size index) const
ExtendedTian(const ext::shared_ptr< StochasticProcess1D > &, Time end, Size steps, Real strike)
Real probability(Size, Size, Size branch) const
Trigeorgis (additive equal jumps) binomial tree
Real probUp(Time stepTime) const override
Real dxStep(Time stepTime) const override
ExtendedTrigeorgis(const ext::shared_ptr< StochasticProcess1D > &, Time end, Size steps, Real strike)
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
Time-dependent binomial tree class.
LinearInterpolation variance
Real Time
continuous quantity with 1-year units
QL_BIG_INTEGER BigInteger
large integer number
std::size_t Size
size of a container
Real PeizerPrattMethod2Inversion(Real z, BigNatural n)
ext::shared_ptr< YieldTermStructure > q
ext::shared_ptr< YieldTermStructure > r