QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
|
Classes | |
class | ExtendedBinomialTree< T > |
Binomial tree base class. More... | |
class | ExtendedEqualProbabilitiesBinomialTree< T > |
Base class for equal probabilities binomial tree. More... | |
class | ExtendedEqualJumpsBinomialTree< T > |
Base class for equal jumps binomial tree. More... | |
class | ExtendedJarrowRudd |
Jarrow-Rudd (multiplicative) equal probabilities binomial tree. More... | |
class | ExtendedCoxRossRubinstein |
Cox-Ross-Rubinstein (multiplicative) equal jumps binomial tree. More... | |
class | ExtendedAdditiveEQPBinomialTree |
Additive equal probabilities binomial tree. More... | |
class | ExtendedTrigeorgis |
Trigeorgis (additive equal jumps) binomial tree More... | |
class | ExtendedTian |
Tian tree: third moment matching, multiplicative approach More... | |
class | ExtendedLeisenReimer |
Leisen & Reimer tree: multiplicative approach. More... | |
class | BinomialTree< T > |
Binomial tree base class. More... | |
class | EqualProbabilitiesBinomialTree< T > |
Base class for equal probabilities binomial tree. More... | |
class | EqualJumpsBinomialTree< T > |
Base class for equal jumps binomial tree. More... | |
class | JarrowRudd |
Jarrow-Rudd (multiplicative) equal probabilities binomial tree. More... | |
class | CoxRossRubinstein |
Cox-Ross-Rubinstein (multiplicative) equal jumps binomial tree. More... | |
class | AdditiveEQPBinomialTree |
Additive equal probabilities binomial tree. More... | |
class | Trigeorgis |
Trigeorgis (additive equal jumps) binomial tree More... | |
class | Tian |
Tian tree: third moment matching, multiplicative approach More... | |
class | LeisenReimer |
Leisen & Reimer tree: multiplicative approach. More... | |
class | BlackScholesLattice< T > |
Simple binomial lattice approximating the Black-Scholes model. More... | |
class | TreeLattice< Impl > |
Tree-based lattice-method base class. More... | |
class | TreeLattice1D< Impl > |
One-dimensional tree-based lattice. More... | |
class | TreeLattice2D< Impl, T > |
Two-dimensional tree-based lattice. More... | |
class | TsiveriotisFernandesLattice< T > |
Binomial lattice approximating the Tsiveriotis-Fernandes model. More... | |
class | Tree< T > |
Tree approximating a single-factor diffusion More... | |
class | TrinomialTree |
Recombining trinomial tree class. More... | |
The framework (corresponding to the ql/methods/lattices directory) contains basic building blocks for pricing instruments using lattice methods (trees). A lattice, i.e. an instance of the abstract class QuantLib::Lattice, 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 QuantLib::Tree, classes which define the branching between nodes and transition probabilities.
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.
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 QuantLib::TrinomialTree 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
\[ dy_t = \mu(t, y_t) dt + \sigma(t, y_t) dW_t. \]
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_{u}y_{i+1,k+1}+p_{m}y_{i+1,k}+p_{d}y_{i+1,k-1}=E_{i,j} \]
and
\[ 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, \]
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_{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_{m} = \frac{2}{3}-\frac{(E_{i,j}-y_{i+1,k})^{2}}{3V_{i}^{2}}, \]
\[ 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}}. \]
To come...
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 QuantLib::DiscretizedAsset, are: