22#include <ql/methods/lattices/binomialtree.hpp>
23#include <ql/math/distributions/binomialdistribution.hpp>
24#include <ql/stochasticprocess.hpp>
29 const ext::shared_ptr<StochasticProcess1D>& process,
33 up_ = process->stdDeviation(0.0,
x0_,
dt_);
38 const ext::shared_ptr<StochasticProcess1D>& process,
42 dx_ = process->stdDeviation(0.0,
x0_,
dt_);
46 QL_REQUIRE(
pu_<=1.0,
"negative probability");
47 QL_REQUIRE(
pu_>=0.0,
"negative probability");
52 const ext::shared_ptr<StochasticProcess1D>& process,
57 std::sqrt(4.0*process->variance(0.0,
x0_,
dt_)-
63 const ext::shared_ptr<StochasticProcess1D>& process,
67 dx_ = std::sqrt(process->variance(0.0,
x0_,
dt_)+
72 QL_REQUIRE(
pu_<=1.0,
"negative probability");
73 QL_REQUIRE(
pu_>=0.0,
"negative probability");
77 Tian::Tian(
const ext::shared_ptr<StochasticProcess1D>& process,
81 Real q = std::exp(process->variance(0.0,
x0_,
dt_));
84 up_ = 0.5 * r * q * (q + 1 + std::sqrt(q * q + 2 * q - 3));
85 down_ = 0.5 * r * q * (q + 1 - std::sqrt(q * q + 2 * q - 3));
94 QL_REQUIRE(
pu_<=1.0,
"negative probability");
95 QL_REQUIRE(
pu_>=0.0,
"negative probability");
105 QL_REQUIRE(strike>0.0,
"strike must be positive");
106 Size oddSteps = ((steps % 2) != 0U ? steps : (steps + 1));
107 Real variance = process->variance(0.0,
x0_, end);
115 up_ = ermqdt * pdash /
pu_;
120 Real alpha = dj/(std::sqrt(8.0));
121 Real alpha2 = alpha*alpha;
122 Real alpha3 = alpha*alpha2;
123 Real alpha5 = alpha3*alpha2;
124 Real alpha7 = alpha5*alpha2;
125 Real beta = -0.375*alpha-alpha3;
126 Real gamma = (5.0/6.0)*alpha5 + (13.0/12.0)*alpha3
128 Real delta = -0.1025 *alpha- 0.9285 *alpha3
129 -1.43 *alpha5 -0.5 *alpha7;
131 Real rootk = std::sqrt(k);
134 p+= gamma/(k*k*rootk);
136 p+= delta/(k*k*k*rootk);
146 QL_REQUIRE(strike>0.0,
"strike must be positive");
147 Size oddSteps = (steps % 2) != 0U ? steps : (steps + 1);
148 Real variance = process->variance(0.0,
x0_, end);
155 up_ = ermqdt * pdash /
pu_;
Additive equal probabilities binomial tree.
AdditiveEQPBinomialTree(const ext::shared_ptr< StochasticProcess1D > &, Time end, Size steps, Real strike)
Binomial tree base class.
Cox-Ross-Rubinstein (multiplicative) equal jumps binomial tree.
CoxRossRubinstein(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.
JarrowRudd(const ext::shared_ptr< StochasticProcess1D > &, Time end, Size steps, Real strike)
Joshi4(const ext::shared_ptr< StochasticProcess1D > &, Time end, Size steps, Real strike)
Real computeUpProb(Real k, Real dj) const
Leisen & Reimer tree: multiplicative approach.
LeisenReimer(const ext::shared_ptr< StochasticProcess1D > &, Time end, Size steps, Real strike)
Tian tree: third moment matching, multiplicative approach
Tian(const ext::shared_ptr< StochasticProcess1D > &, Time end, Size steps, Real strike)
Trigeorgis (additive equal jumps) binomial tree
Trigeorgis(const ext::shared_ptr< StochasticProcess1D > &, Time end, Size steps, Real strike)
Real Time
continuous quantity with 1-year units
std::size_t Size
size of a container
Real PeizerPrattMethod2Inversion(Real z, BigNatural n)