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 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.20"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>QuantLib: Lattice methods</title>
<link href='https://fonts.googleapis.com/css?family=Merriweather+Sans:800' rel='stylesheet' type='text/css'>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
extensions: ["tex2jax.js"],
jax: ["input/TeX","output/HTML-CSS"],
});
</script>
<script type="text/javascript" async="async" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="quantlibextra.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname"><a href="http://quantlib.org">
<img alt="QuantLib" src="QL-title.jpg"></a>
<div id="projectbrief">A free/open-source library for quantitative finance</div>
<div id="projectnumber">Reference manual - version 1.20</div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.20 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="header">
<div class="summary">
<a href="#nested-classes">Classes</a> </div>
<div class="headertitle">
<div class="title">Lattice methods</div> </div>
</div><!--header-->
<div class="contents">
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
Classes</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" 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< T ></a></td></tr>
<tr class="memdesc:"><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 class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class  </td><td class="memItemRight" valign="bottom"><a class="el" href="class_quant_lib_1_1_extended_binomial_tree.html">ExtendedBinomialTree< T ></a></td></tr>
<tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight">Binomial tree base class. <a href="class_quant_lib_1_1_extended_binomial_tree.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class  </td><td class="memItemRight" valign="bottom"><a class="el" href="class_quant_lib_1_1_extended_equal_probabilities_binomial_tree.html">ExtendedEqualProbabilitiesBinomialTree< T ></a></td></tr>
<tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight">Base class for equal probabilities binomial tree. <a href="class_quant_lib_1_1_extended_equal_probabilities_binomial_tree.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class  </td><td class="memItemRight" valign="bottom"><a class="el" href="class_quant_lib_1_1_extended_equal_jumps_binomial_tree.html">ExtendedEqualJumpsBinomialTree< T ></a></td></tr>
<tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight">Base class for equal jumps binomial tree. <a href="class_quant_lib_1_1_extended_equal_jumps_binomial_tree.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class  </td><td class="memItemRight" valign="bottom"><a class="el" href="class_quant_lib_1_1_extended_jarrow_rudd.html">ExtendedJarrowRudd</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight">Jarrow-Rudd (multiplicative) equal probabilities binomial tree. <a href="class_quant_lib_1_1_extended_jarrow_rudd.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class  </td><td class="memItemRight" valign="bottom"><a class="el" href="class_quant_lib_1_1_extended_cox_ross_rubinstein.html">ExtendedCoxRossRubinstein</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight">Cox-Ross-Rubinstein (multiplicative) equal jumps binomial tree. <a href="class_quant_lib_1_1_extended_cox_ross_rubinstein.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class  </td><td class="memItemRight" valign="bottom"><a class="el" href="class_quant_lib_1_1_extended_additive_e_q_p_binomial_tree.html">ExtendedAdditiveEQPBinomialTree</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight">Additive equal probabilities binomial tree. <a href="class_quant_lib_1_1_extended_additive_e_q_p_binomial_tree.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class  </td><td class="memItemRight" valign="bottom"><a class="el" href="class_quant_lib_1_1_extended_trigeorgis.html">ExtendedTrigeorgis</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight">Trigeorgis (additive equal jumps) binomial tree <a href="class_quant_lib_1_1_extended_trigeorgis.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class  </td><td class="memItemRight" valign="bottom"><a class="el" href="class_quant_lib_1_1_extended_tian.html">ExtendedTian</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight">Tian tree: third moment matching, multiplicative approach <a href="class_quant_lib_1_1_extended_tian.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class  </td><td class="memItemRight" valign="bottom"><a class="el" href="class_quant_lib_1_1_extended_leisen_reimer.html">ExtendedLeisenReimer</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight">Leisen & Reimer tree: multiplicative approach. <a href="class_quant_lib_1_1_extended_leisen_reimer.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class  </td><td class="memItemRight" valign="bottom"><a class="el" href="class_quant_lib_1_1_binomial_tree.html">BinomialTree< T ></a></td></tr>
<tr class="memdesc:"><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 class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:"><td class="memItemLeft" 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< T ></a></td></tr>
<tr class="memdesc:"><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 class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:"><td class="memItemLeft" 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< T ></a></td></tr>
<tr class="memdesc:"><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 class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:"><td class="memItemLeft" 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 class="memdesc:"><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 class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:"><td class="memItemLeft" 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 class="memdesc:"><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 class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:"><td class="memItemLeft" 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 class="memdesc:"><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 class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:"><td class="memItemLeft" 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 class="memdesc:"><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 class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:"><td class="memItemLeft" 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 class="memdesc:"><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 class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:"><td class="memItemLeft" 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 class="memdesc:"><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 class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:"><td class="memItemLeft" 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< T ></a></td></tr>
<tr class="memdesc:"><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 class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class  </td><td class="memItemRight" valign="bottom"><a class="el" href="class_quant_lib_1_1_tree_lattice.html">TreeLattice< Impl ></a></td></tr>
<tr class="memdesc:"><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 class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:"><td class="memItemLeft" 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< Impl ></a></td></tr>
<tr class="memdesc:"><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 class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:"><td class="memItemLeft" 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< Impl, T ></a></td></tr>
<tr class="memdesc:"><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 class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class  </td><td class="memItemRight" valign="bottom"><a class="el" href="class_quant_lib_1_1_tree.html">Tree< T ></a></td></tr>
<tr class="memdesc:"><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 class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:"><td class="memItemLeft" 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 class="memdesc:"><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>
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<p>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.</p>
<h1><a class="anchor" id="binomial"></a>
Binomial trees</h1>
<p>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 bsmlattice.hpp 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.</p>
<h1><a class="anchor" id="trinomial"></a>
Trinomial trees</h1>
<p>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 \( y \) satisfying </p><p class="formulaDsp">
\[ dy_t = \mu(t, y_t) dt + \sigma(t, y_t) dW_t. \]
</p>
<p> At each node, there is a probability \( p_u, p_m \) and \( p_d \) to go through respectively the upper, the middle and the lower branch. These probabilities must satisfy </p><p class="formulaDsp">
\[ p_{u}y_{i+1,k+1}+p_{m}y_{i+1,k}+p_{d}y_{i+1,k-1}=E_{i,j} \]
</p>
<p> and </p><p class="formulaDsp">
\[ 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, \]
</p>
<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, \( E_{i,j}=\mathbf{E}\left( y(t_{i+1})|y(t_{i})=y_{i,j}\right) \) and \( V_{i,j}^{2}=\mathbf{Var}\{y(t_{i+1})|y(t_{i})=y_{i,j}\} \). If we suppose that the variance is only dependant on time \( V_{i,j}=V_{i} \) and set \( y_{i+1} \) to \( V_{i}\sqrt{3} \), we find that </p><p class="formulaDsp">
\[ 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}}, \]
</p>
<p class="formulaDsp">
\[ p_{m} = \frac{2}{3}-\frac{(E_{i,j}-y_{i+1,k})^{2}}{3V_{i}^{2}}, \]
</p>
<p class="formulaDsp">
\[ 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}}. \]
</p>
<h1><a class="anchor" id="bidimensional"></a>
Bidimensional lattices</h1>
<p>To come...</p>
<h1><a class="anchor" id="discretizedasset"></a>
The QuantLib::DiscretizedAsset class</h1>
<p>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:</p><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>
</div><!-- contents -->
<!-- HTML footer for doxygen 1.8.9.1-->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by <a href="http://www.doxygen.org/index.html">Doxygen</a>
1.8.20
</small></address>
</body>
</html>
|