1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<meta name="robots" content="none">
<title>QuantLib: Lattice methods</title>
<link rel="stylesheet" href="quantlib.css" type="text/css">
<link rel="stylesheet" href="print.css" type="text/css" media="print">
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
<link rel="icon" href="favicon.ico" type="image/x-icon">
</head>
<body>
<div id="container">
<div id="header">
<img class="titleimage"
src="QL-title.jpg" width="212" height="47" border="0"
alt="QuantLib">
<br>
<h3 class="subtitle">A free/open-source library for quantitative finance</h3>
</div>
<div id="menu">
<h3 class="navbartitle">Version 0.9.0</h3>
<hr>
<h3 class="navbartitle">Getting started</h3>
<ul class="navbarlist">
<li class="navlink"><a href="index.html">Introduction</a></li>
<li class="navlink"><a href="overview.html">Project overview</a></li>
<li class="navlink"><a href="where.html">Where to get QuantLib</a></li>
<li class="navlink"><a href="install.html">Installation</a></li>
<li class="navlink"><a href="config.html">Configuration</a></li>
<li class="navlink"><a href="usage.html">Usage</a></li>
<li class="navlink"><a href="history.html">Version history</a></li>
<li class="navlink"><a href="resources.html">Additional resources</a></li>
<li class="navlink"><a href="group.html">The QuantLib group</a></li>
<li class="navlink"><a href="license.html">Copyright and license</a></li>
</ul>
<hr>
<h3 class="navbartitle">Reference manual</h3>
<ul class="navbarlist">
<li class="navlink"><a href="modules.html">Modules</a></li>
<li class="navlink"><a href="hierarchy.html">Class Hierarchy</a></li>
<li class="navlink"><a href="annotated.html">Compound List</a></li>
<li class="navlink"><a href="files.html">File List</a></li>
<li class="navlink"><a href="functions.html">Compound Members</a></li>
<li class="navlink"><a href="globals.html">File Members</a></li>
<li class="navlink"><a href="bug.html">Known Bugs</a></li>
<li class="navlink"><a href="caveats.html">Caveats</a></li>
<li class="navlink"><a href="test.html">Test Suite</a></li>
<li class="navlink"><a href="examples.html">Examples</a></li>
</ul>
</div>
<div id="content">
<!--Doxygen-generated content-->
<!-- Generated by Doxygen 1.5.4 -->
<h1>Lattice methods</h1><hr><a name="_details"></a><h2>Detailed Description</h2>
The framework (corresponding to the ql/Lattices directory) contains basic building blocks for pricing instruments using lattice methods (trees). A lattice, i.e. an instance of the abstract class <a class="el" href="class_quant_lib_1_1_lattice.html" title="Lattice (tree, finite-differences) base class">QuantLib::Lattice</a>, relies on one or several trees (each one approximating a diffusion process) to price an instance of the DiscretizedAsset class. Trees are instances of classes derived from <a class="el" href="class_quant_lib_1_1_tree.html" title="Tree approximating a single-factor diffusion">QuantLib::Tree</a>, classes which define the branching between nodes and transition probabilities.<h2><a class="anchor" name="binomial">
Binomial trees</a></h2>
The binomial method is the simplest numerical method that can be used to price path-independent derivatives. It is usually the preferred lattice method under the Black-Scholes-Merton model. As an example, let's see the framework implemented in the <a class="el" href="bsmlattice_8hpp.html" title="Binomial trees under the BSM model.">bsmlattice.hpp</a> file. It is a method based on a binomial tree, with constant short-rate (discounting). There are several approaches to build the underlying binomial tree, like Jarrow-Rudd or Cox-Ross-Rubinstein.<h2><a class="anchor" name="trinomial">
Trinomial trees</a></h2>
When the underlying stochastic process has a mean-reverting pattern, it is usually better to use a trinomial tree instead of a binomial tree. An example is implemented in the <a class="el" href="class_quant_lib_1_1_trinomial_tree.html" title="Recombining trinomial tree class.">QuantLib::TrinomialTree</a> class, which is constructed using a diffusion process and a time-grid. The goal is to build a recombining trinomial tree that will discretize, at a finite set of times, the possible evolutions of a random variable <img class="formulaInl" alt="$ y $" src="form_13.png"> satisfying <p class="formulaDsp">
<img class="formulaDsp" alt="\[ dy_t = \mu(t, y_t) dt + \sigma(t, y_t) dW_t. \]" src="form_14.png">
<p>
At each node, there is a probability <img class="formulaInl" alt="$ p_u, p_m $" src="form_15.png"> and <img class="formulaInl" alt="$ p_d $" src="form_16.png"> to go through respectively the upper, the middle and the lower branch. These probabilities must satisfy <p class="formulaDsp">
<img class="formulaDsp" alt="\[ p_{u}y_{i+1,k+1}+p_{m}y_{i+1,k}+p_{d}y_{i+1,k-1}=E_{i,j} \]" src="form_17.png">
<p>
and <p class="formulaDsp">
<img class="formulaDsp" alt="\[ p_u y_{i+1,k+1}^2 + p_m y_{i+1,k}^2 + p_d y_{i+1,k-1}^2 = V^2_{i,j}+E_{i,j}^2, \]" src="form_18.png">
<p>
where k (the index of the node at the end of the middle branch) is the index of the node which is the nearest to the expected future value, <img class="formulaInl" alt="$ E_{i,j}=\mathbf{E}\left( y(t_{i+1})|y(t_{i})=y_{i,j}\right) $" src="form_19.png"> and <img class="formulaInl" alt="$ V_{i,j}^{2}=\mathbf{Var}\{y(t_{i+1})|y(t_{i})=y_{i,j}\} $" src="form_20.png">. If we suppose that the variance is only dependant on time <img class="formulaInl" alt="$ V_{i,j}=V_{i} $" src="form_21.png"> and set <img class="formulaInl" alt="$ y_{i+1} $" src="form_22.png"> to <img class="formulaInl" alt="$ V_{i}\sqrt{3} $" src="form_23.png">, we find that <p class="formulaDsp">
<img class="formulaDsp" alt="\[ p_{u} = \frac{1}{6}+\frac{(E_{i,j}-y_{i+1,k})^{2}}{6V_{i}^{2}} + \frac{E_{i,j}-y_{i+1,k}}{2\sqrt{3}V_{i}}, \]" src="form_24.png">
<p>
<p class="formulaDsp">
<img class="formulaDsp" alt="\[ p_{m} = \frac{2}{3}-\frac{(E_{i,j}-y_{i+1,k})^{2}}{3V_{i}^{2}}, \]" src="form_25.png">
<p>
<p class="formulaDsp">
<img class="formulaDsp" alt="\[ p_{d} = \frac{1}{6}+\frac{(E_{i,j}-y_{i+1,k})^{2}}{6V_{i}^{2}} - \frac{E_{i,j}-y_{i+1,k}}{2\sqrt{3}V_{i}}. \]" src="form_26.png">
<p>
<h2><a class="anchor" name="bidimensional">
Bidimensional lattices</a></h2>
To come...<h2><a class="anchor" name="discretizedasset">
The QuantLib::DiscretizedAsset class</a></h2>
This class is a representation of the price of a derivative at a specific time. It is roughly an array of values, each value being associated to a state of the underlying stochastic variables. For the moment, it is only used when working with trees, but it should be quite easy to make a use of it in finite-differences methods. The two main points, when deriving classes from <a class="el" href="class_quant_lib_1_1_discretized_asset.html" title="Discretized asset class used by numerical methods.">QuantLib::DiscretizedAsset</a>, are:<ol type=1>
<li>Define the initialisation procedure (e.g. terminal payoff for european stock options).</li><li>Define the method adjusting values, when necessary, at each time steps (e.g. apply the step condition for american or bermudan options). Some examples are found in QuantLib::DiscretizedSwap and QuantLib::DiscretizedSwaption. </li></ol>
<p>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Classes</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">class </td><td class="memItemRight" valign="bottom"><a class="el" href="class_quant_lib_1_1_binomial_tree.html">BinomialTree</a></td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Binomial tree base class. <a href="class_quant_lib_1_1_binomial_tree.html#_details">More...</a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">class </td><td class="memItemRight" valign="bottom"><a class="el" href="class_quant_lib_1_1_equal_probabilities_binomial_tree.html">EqualProbabilitiesBinomialTree</a></td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Base class for equal probabilities binomial tree. <a href="class_quant_lib_1_1_equal_probabilities_binomial_tree.html#_details">More...</a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">class </td><td class="memItemRight" valign="bottom"><a class="el" href="class_quant_lib_1_1_equal_jumps_binomial_tree.html">EqualJumpsBinomialTree</a></td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Base class for equal jumps binomial tree. <a href="class_quant_lib_1_1_equal_jumps_binomial_tree.html#_details">More...</a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">class </td><td class="memItemRight" valign="bottom"><a class="el" href="class_quant_lib_1_1_jarrow_rudd.html">JarrowRudd</a></td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Jarrow-Rudd (multiplicative) equal probabilities binomial tree. <a href="class_quant_lib_1_1_jarrow_rudd.html#_details">More...</a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">class </td><td class="memItemRight" valign="bottom"><a class="el" href="class_quant_lib_1_1_cox_ross_rubinstein.html">CoxRossRubinstein</a></td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Cox-Ross-Rubinstein (multiplicative) equal jumps binomial tree. <a href="class_quant_lib_1_1_cox_ross_rubinstein.html#_details">More...</a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">class </td><td class="memItemRight" valign="bottom"><a class="el" href="class_quant_lib_1_1_additive_e_q_p_binomial_tree.html">AdditiveEQPBinomialTree</a></td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Additive equal probabilities binomial tree. <a href="class_quant_lib_1_1_additive_e_q_p_binomial_tree.html#_details">More...</a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">class </td><td class="memItemRight" valign="bottom"><a class="el" href="class_quant_lib_1_1_trigeorgis.html">Trigeorgis</a></td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Trigeorgis (additive equal jumps) binomial tree <a href="class_quant_lib_1_1_trigeorgis.html#_details">More...</a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">class </td><td class="memItemRight" valign="bottom"><a class="el" href="class_quant_lib_1_1_tian.html">Tian</a></td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Tian tree: third moment matching, multiplicative approach <a href="class_quant_lib_1_1_tian.html#_details">More...</a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">class </td><td class="memItemRight" valign="bottom"><a class="el" href="class_quant_lib_1_1_leisen_reimer.html">LeisenReimer</a></td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Leisen & Reimer tree: multiplicative approach. <a href="class_quant_lib_1_1_leisen_reimer.html#_details">More...</a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">class </td><td class="memItemRight" valign="bottom"><a class="el" href="class_quant_lib_1_1_black_scholes_lattice.html">BlackScholesLattice</a></td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Simple binomial lattice approximating the Black-Scholes model. <a href="class_quant_lib_1_1_black_scholes_lattice.html#_details">More...</a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">class </td><td class="memItemRight" valign="bottom"><a class="el" href="class_quant_lib_1_1_tree_lattice.html">TreeLattice</a></td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Tree-based lattice-method base class. <a href="class_quant_lib_1_1_tree_lattice.html#_details">More...</a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">class </td><td class="memItemRight" valign="bottom"><a class="el" href="class_quant_lib_1_1_tree_lattice1_d.html">TreeLattice1D</a></td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">One-dimensional tree-based lattice. <a href="class_quant_lib_1_1_tree_lattice1_d.html#_details">More...</a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">class </td><td class="memItemRight" valign="bottom"><a class="el" href="class_quant_lib_1_1_tree_lattice2_d.html">TreeLattice2D</a></td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Two-dimensional tree-based lattice. <a href="class_quant_lib_1_1_tree_lattice2_d.html#_details">More...</a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">class </td><td class="memItemRight" valign="bottom"><a class="el" href="class_quant_lib_1_1_tsiveriotis_fernandes_lattice.html">TsiveriotisFernandesLattice</a></td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Binomial lattice approximating the Tsiveriotis-Fernandes model. <a href="class_quant_lib_1_1_tsiveriotis_fernandes_lattice.html#_details">More...</a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">class </td><td class="memItemRight" valign="bottom"><a class="el" href="class_quant_lib_1_1_tree.html">Tree</a></td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Tree approximating a single-factor diffusion <a href="class_quant_lib_1_1_tree.html#_details">More...</a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">class </td><td class="memItemRight" valign="bottom"><a class="el" href="class_quant_lib_1_1_trinomial_tree.html">TrinomialTree</a></td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Recombining trinomial tree class. <a href="class_quant_lib_1_1_trinomial_tree.html#_details">More...</a><br></td></tr>
</table>
</div>
<div class="footer">
<div class="endmatter">
Documentation generated by
<a href="http://www.doxygen.org">Doxygen</a> 1.5.4
</div>
</div>
</div>
</body>
</html>
|