Finance - Maple Programming Help

Home : Support : Online Help : Mathematics : Finance : Lattice Methods : Finance/BinomialTree

Finance

 BinomialTree
 construct a recombining binomial tree

 Calling Sequence BinomialTree(G, S, ${P}_{u}$, ${P}_{d}$, opts) BinomialTree(T, S, ${P}_{u}$, ${P}_{d}$, opts) BinomialTree(T, N, ${S}_{0}$, ${S}_{u}$, ${P}_{u}$, ${S}_{d}$, ${P}_{d}$, opts)

Parameters

 G - time grid data structure; time grid S - Array or list; state space of the discretized process ${P}_{u}$ - non-negative constant or operator; probability of going up ${P}_{d}$ - (optional) non-negative constant or operator; probability of going down T - positive; stopping time N - posint; number of times steps ${S}_{0}$ - positive constant; initial value ${S}_{u}$ - positive constant; upward movement ${S}_{d}$ - (optional) positive constant; downward movement opts - (optional) equation(s) of the form option = value where option is mutable; specify options for the BinomialTree command

Options

 • mutable = truefalse -- This option specifies whether the tree should be mutable or not. The default is true.

Description

 • The BinomialTree(G, S, ${P}_{u}$, ${P}_{d}$, opts) calling sequence constructs a recombining binomial tree approximating a certain stochastic process, typically a GeometricBrownianMotion. The constructed tree will be based on the discretizations of the time and the state spaces given by G and S.
 • Assume that the time grid G consists of N points ${T}_{1}$, ${T}_{1}$, ..., ${T}_{N}$. Then the resulting binomial tree will have N levels, each level representing possible states of the discretized process at time ${T}_{i}$, $i=1..N$. The parameter S contains all possible states of the discretized process. The number of elements of S should be equal to $2N-1$, and the elements of S must be sorted in descending order.
 • At level $i$, $i=1..N$ the tree has $i$ nodes, ${S}_{i,1}$, ..., ${S}_{i,i}$. Each node ${S}_{i,j}$ has two descendants at level $i+1$, ${S}_{i+1,j}$ (the upper descendant), and ${S}_{i+1,j+1}$ (the lower descendant). The initial state of the underlying process will be equal to ${S}_{N}$. For odd $i$, the states of the underlying at the level $i$ are ${S}_{N-i}$, ${S}_{N-i+2}$, ..., ${S}_{N-2}$, ${S}_{N}$, ${S}_{N+2}$, ..., ${S}_{N+i-2}$, ${S}_{N+i}$. For even $i$, the states of the underlying at the level $i$ are ${S}_{N-i}$, ${S}_{N-i+2}$, ..., ${S}_{N-1}$, ${S}_{N+1}$, ..., ${S}_{N+i-2}$, ${S}_{N+i}$.
 • The transition probabilities (i.e. the probability of going from ${S}_{i,j}$ to ${S}_{i+1,j}$ and the probability of going from ${S}_{i,j}$ to ${S}_{i+1,j+1}$) are defined by ${P}_{u}$ and ${P}_{d}$. Both ${P}_{u}$ and ${P}_{d}$ can be either non-negative real constants or one-parameter operators. If ${P}_{u}$ and  ${P}_{d}$ are given in the operator form the corresponding transition probabilities at level $i$ will be calculated as ${P}_{u}\left(\mathrm{dt}\right)$ and ${P}_{d}\left(\mathrm{dt}\right)$ respectively, where $\mathrm{dt}={T}_{i+1}-{T}_{i}$.
 • The BinomialTree(T, S, ${P}_{u}$, ${P}_{d}$, opts) calling sequence is similar except that in this case a uniform time grid with step size $\frac{T}{N}$ is used instead of G. In this case N will be deduced from the size of the state array S.
 • The BinomialTree(T, N, ${S}_{0}$, ${S}_{u}$, ${P}_{u}$, ${S}_{d}$, ${P}_{d}$, opts) calling sequence will construct a binomial tree based on a uniform time grid with step size $\frac{T}{N}$. Each tree node ${S}_{i,j}$ will have two descendants ${S}_{i+1,j}={S}_{i,j}{S}_{u}$ (the upper descendant) and ${S}_{i+1,j+1}={S}_{i,j}{S}_{d}$ (the lower descendant). The transition probabilities will be calculated the same way as above. By default ${S}_{d}$ is set to $\frac{1}{{S}_{u}}$ and ${P}_{d}$ is set to $1-{P}_{u}$.
 • The resulting data structure can be inspected using the GetUnderlying and GetProbabilities commands and can be further manipulated using the SetUnderlying and SetProbabilities commands.

Examples

 > $\mathrm{with}\left(\mathrm{Finance}\right):$
 > $S≔\left[7.9,7.5,7.1,6.5,5.,3.7,3.3,2.95,2.8\right]$
 ${S}{≔}\left[{7.9}{,}{7.5}{,}{7.1}{,}{6.5}{,}{5.}{,}{3.7}{,}{3.3}{,}{2.95}{,}{2.8}\right]$ (1)
 > $T≔\mathrm{BinomialTree}\left(3,S,0.3\right):$

Here are two different views of the same tree. The first one uses the standard scale, the second one uses the logarithmic scale.

 > $\mathrm{TreePlot}\left(T,\mathrm{thickness}=2,\mathrm{axes}=\mathrm{BOXED},\mathrm{gridlines}=\mathrm{true}\right)$
 > $\mathrm{TreePlot}\left(T,\mathrm{thickness}=2,\mathrm{axes}=\mathrm{BOXED},\mathrm{gridlines}=\mathrm{true},\mathrm{color}=\mathrm{red}..\mathrm{blue},\mathrm{scale}=\mathrm{logarithmic}\right)$

Inspect the tree.

 > $\mathrm{GetUnderlying}\left(T,5,1\right)$
 ${7.900000000}$ (2)
 > $\mathrm{GetProbabilities}\left(T,3,1\right)$
 $\left[{0.3000000000}{,}{0.7000000000}\right]$ (3)

Change the value of the underlying at the uppermost node on level 5 and compare the two trees.

 > $\mathrm{P1}≔\mathrm{TreePlot}\left(T,\mathrm{thickness}=2,\mathrm{axes}=\mathrm{BOXED},\mathrm{gridlines}=\mathrm{true}\right):$
 > $\mathrm{SetUnderlying}\left(T,5,1,8.5\right)$
 > $\mathrm{P2}≔\mathrm{TreePlot}\left(T,\mathrm{thickness}=2,\mathrm{axes}=\mathrm{BOXED},\mathrm{color}=\mathrm{red},\mathrm{gridlines}=\mathrm{true}\right):$
 > ${\mathrm{plots}}_{\mathrm{display}}\left(\mathrm{P1},\mathrm{P2}\right)$

Here is the same example as above but using a non-homogeneous time grid.

 > $G≔\mathrm{TimeGrid}\left(\left[0,1.5,2.0,2.5,3.0\right]\right)$
 ${G}{:=}{\mathbf{module}}\left({}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end module}}$ (4)
 > $S≔\left[7.9,7.5,7.1,6.5,5.,3.7,3.3,2.95,2.8\right]$
 ${S}{≔}\left[{7.9}{,}{7.5}{,}{7.1}{,}{6.5}{,}{5.}{,}{3.7}{,}{3.3}{,}{2.95}{,}{2.8}\right]$ (5)
 > $T≔\mathrm{BinomialTree}\left(G,S,0.3\right):$

Here are two different views of the same tree. The first one uses the standard scale, the second one uses the logarithmic scale.

 > $\mathrm{TreePlot}\left(T,\mathrm{thickness}=2,\mathrm{axes}=\mathrm{BOXED},\mathrm{gridlines}=\mathrm{true}\right)$
 > $\mathrm{TreePlot}\left(T,\mathrm{thickness}=2,\mathrm{axes}=\mathrm{BOXED},\mathrm{gridlines}=\mathrm{true},\mathrm{color}=\mathrm{red}..\mathrm{blue},\mathrm{scale}=\mathrm{logarithmic}\right)$

Inspect the tree.

 > $\mathrm{GetUnderlying}\left(T,5,1\right)$
 ${7.900000000}$ (6)
 > $\mathrm{GetProbabilities}\left(T,3,1\right)$
 $\left[{0.3000000000}{,}{0.7000000000}\right]$ (7)

Change the value of the underlying at the uppermost node on level 5 and compare the two trees.

 > $\mathrm{P1}≔\mathrm{TreePlot}\left(T,\mathrm{thickness}=2,\mathrm{axes}=\mathrm{BOXED},\mathrm{gridlines}=\mathrm{true}\right):$
 > $\mathrm{SetUnderlying}\left(T,5,1,8.5\right)$
 > $\mathrm{P2}≔\mathrm{TreePlot}\left(T,\mathrm{thickness}=2,\mathrm{axes}=\mathrm{BOXED},\mathrm{color}=\mathrm{red},\mathrm{gridlines}=\mathrm{true}\right):$
 > ${\mathrm{plots}}_{\mathrm{display}}\left(\mathrm{P1},\mathrm{P2}\right)$

In this example you will use the third construction.

 > $\mathrm{Su}≔1.1$
 ${\mathrm{Su}}{≔}{1.1}$ (8)
 > $\mathrm{Sd}≔0.95$
 ${\mathrm{Sd}}{≔}{0.95}$ (9)
 > $T≔\mathrm{BinomialTree}\left(3,20,100,\mathrm{Su},0.3,\mathrm{Sd},0.7\right):$

Here are two different views of the same tree. The first one uses the standard scale, the second one uses the logarithmic scale.

 > $\mathrm{TreePlot}\left(T,\mathrm{thickness}=2,\mathrm{axes}=\mathrm{BOXED},\mathrm{gridlines}=\mathrm{true}\right)$
 > $\mathrm{TreePlot}\left(T,\mathrm{thickness}=2,\mathrm{axes}=\mathrm{BOXED},\mathrm{gridlines}=\mathrm{true},\mathrm{color}=\mathrm{red}..\mathrm{blue},\mathrm{scale}=\mathrm{logarithmic}\right)$

Construct an immutable tree.

 > $\mathrm{T2}≔\mathrm{BinomialTree}\left(3,20,100,\mathrm{Su},0.3,\mathrm{Sd},0.7,\mathrm{mutable}=\mathrm{false}\right):$
 > ${\mathrm{plots}}_{\mathrm{display}}\left(\mathrm{TreePlot}\left(\mathrm{T2},\mathrm{thickness}=2,\mathrm{axes}=\mathrm{BOXED},\mathrm{gridlines}=\mathrm{true},\mathrm{color}=\mathrm{red}\right),\mathrm{TreePlot}\left(T,\mathrm{thickness}=2,\mathrm{axes}=\mathrm{BOXED},\mathrm{gridlines}=\mathrm{true},\mathrm{color}=\mathrm{blue}\right)\right)$

Use the default values for $\mathrm{Sd}$ and $\mathrm{Pd}$.

 > $\mathrm{T3}≔\mathrm{BinomialTree}\left(3,20,100,\mathrm{Su},0.3,\mathrm{mutable}=\mathrm{false}\right):$
 > ${\mathrm{plots}}_{\mathrm{display}}\left(\mathrm{TreePlot}\left(\mathrm{T3},\mathrm{thickness}=2,\mathrm{axes}=\mathrm{BOXED},\mathrm{gridlines}=\mathrm{true},\mathrm{color}=\mathrm{red}\right),\mathrm{TreePlot}\left(T,\mathrm{thickness}=2,\mathrm{axes}=\mathrm{BOXED},\mathrm{gridlines}=\mathrm{true},\mathrm{color}=\mathrm{blue}\right)\right)$

Inspect the tree.

 > $\mathrm{GetUnderlying}\left(T,5,1\right)$
 ${146.4100000}$ (10)
 > $\mathrm{GetProbabilities}\left(T,3,1\right)$
 $\left[{0.3000000000}{,}{0.7000000000}\right]$ (11)

Change the value of the underlying at the uppermost node on level 5 and compare the two trees.

 > $\mathrm{P1}≔\mathrm{TreePlot}\left(T,\mathrm{thickness}=2,\mathrm{axes}=\mathrm{BOXED},\mathrm{gridlines}=\mathrm{true}\right):$
 > $\mathbf{for}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}i\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}\mathbf{to}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}20\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}\mathbf{do}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}\mathrm{SetUnderlying}\left(T,i,i,100{0.9}^{i-1}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}\mathbf{end do}$
 > $\mathrm{P2}≔\mathrm{TreePlot}\left(T,\mathrm{thickness}=2,\mathrm{axes}=\mathrm{BOXED},\mathrm{color}=\mathrm{red},\mathrm{gridlines}=\mathrm{true}\right):$
 > ${\mathrm{plots}}_{\mathrm{display}}\left(\mathrm{P1},\mathrm{P2}\right)$

References

 Brigo, D., Mercurio, F., Interest Rate Models: Theory and Practice, New York: Springer-Verlag, 2001.
 Glasserman, P., Monte Carlo Methods in Financial Engineering, New York: Springer-Verlag, 2004.
 Hull, J., Options, Futures, and Other Derivatives, 5th. edition. Upper Saddle River, New Jersey: Prentice Hall, 2003.

Compatibility

 • The Finance[BinomialTree] command was introduced in Maple 15.
 • For more information on Maple 15 changes, see Updates in Maple 15.