1
2/*
3 Copyright (C) 2002, 2003 Sadruddin Rejeb
4
5 This file is part of QuantLib, a free-software/open-source library
6 for financial quantitative analysts and developers - http://quantlib.org/
7
8 QuantLib is free software: you can redistribute it and/or modify it
9 under the terms of the QuantLib license.  You should have received a
10 copy of the license along with this program; if not, please email
11 <quantlib-dev@lists.sf.net>. The license is also available online at
12 <http://quantlib.org/license.shtml>.
13
14 This program is distributed in the hope that it will be useful, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16 FOR A PARTICULAR PURPOSE.  See the license for more details.
17*/
18
19/*! \defgroup lattices Lattice methods
20
21    The framework (corresponding to the ql/Lattices directory)
22    contains basic building blocks for pricing instruments using lattice
23    methods (trees). A lattice, i.e. an instance of the abstract class
24    QuantLib::Lattice, relies on one or several trees (each one
25    approximating a diffusion process) to price an instance of the
26    DiscretizedAsset class. Trees are instances of classes derived from
27    QuantLib::Tree, classes which define the branching between
28    nodes and transition probabilities.
29
30    \section binomial Binomial trees
31    The binomial method is the simplest numerical method that can be used to
32    price path-independent derivatives. It is usually the preferred lattice
33    method under the Black-Scholes-Merton model. As an example, let's see
34    the framework implemented in the bsmlattice.hpp file. It is a method
35    based on a binomial tree, with constant short-rate (discounting).
36    There are several approaches to build the underlying binomial tree, like
37    Jarrow-Rudd or Cox-Ross-Rubinstein.
38
39    \section trinomial Trinomial trees
40    When the underlying stochastic process has a mean-reverting pattern, it is
41    usually better to use a trinomial tree instead of a binomial tree. An
42    example is implemented in the QuantLib::TrinomialTree class,
43    which is constructed using a diffusion process and a time-grid. The goal is
44    to build a recombining trinomial tree that will discretize, at a finite set
45    of times, the possible evolutions of a random variable \f$ y \f$ satisfying
46    \f[
47        dy_t = \mu(t, y_t) dt + \sigma(t, y_t) dW_t.
48    \f]
49    At each node, there is a probability \f$ p_u, p_m \f$ and \f$ p_d \f$ to go
50    through respectively the upper, the middle and the lower branch.
51    These probabilities must satisfy
52    \f[
53        p_{u}y_{i+1,k+1}+p_{m}y_{i+1,k}+p_{d}y_{i+1,k-1}=E_{i,j}
54    \f]
55    and
56    \f[
57        p_u y_{i+1,k+1}^2 + p_m y_{i+1,k}^2 + p_d y_{i+1,k-1}^2 =
58        V^2_{i,j}+E_{i,j}^2,
59    \f]
60    where k (the index of the node at the end of the middle branch)
61    is the index of the node which is the nearest to the expected future
62    value, \f$ E_{i,j}=\mathbf{E}\left( y(t_{i+1})|y(t_{i})=y_{i,j}\right) \f$
63    and \f$ V_{i,j}^{2}=\mathbf{Var}\{y(t_{i+1})|y(t_{i})=y_{i,j}\} \f$.
64    If we suppose that the variance is only dependant on time
65    \f$ V_{i,j}=V_{i} \f$ and set \f$ y_{i+1} \f$ to \f$ V_{i}\sqrt{3} \f$,
66    we find that
67    \f[
68        p_{u} = \frac{1}{6}+\frac{(E_{i,j}-y_{i+1,k})^{2}}{6V_{i}^{2}} +
69                \frac{E_{i,j}-y_{i+1,k}}{2\sqrt{3}V_{i}},
70    \f]
71    \f[
72        p_{m} = \frac{2}{3}-\frac{(E_{i,j}-y_{i+1,k})^{2}}{3V_{i}^{2}},
73    \f]
74    \f[
75        p_{d} = \frac{1}{6}+\frac{(E_{i,j}-y_{i+1,k})^{2}}{6V_{i}^{2}} -
76                \frac{E_{i,j}-y_{i+1,k}}{2\sqrt{3}V_{i}}.
77    \f]
78
79    \section bidimensional Bidimensional lattices
80    To come...
81
82    \section discretizedasset The QuantLib::DiscretizedAsset class
83
84    This class is a representation of the price of a derivative at a specific
85    time. It is roughly an array of values, each value being associated to a
86    state of the underlying stochastic variables. For the moment, it is only
87    used when working with trees, but it should be quite easy to make a use
88    of it in finite-differences methods. The two main points, when deriving
89    classes from QuantLib::DiscretizedAsset, are:
90    -# Define the initialisation procedure (e.g. terminal payoff for european
91       stock options).
92    -# Define the method adjusting values, when necessary, at each time steps
93       (e.g. apply the step condition for american or bermudan options).
94    Some examples are found in QuantLib::DiscretizedSwap and
95    QuantLib::DiscretizedSwaption.
96*/
97