Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
doc
pages
namespaces.docs
Go to the documentation of this file.
1
/*
2
Copyright (C) 2016 Quaternion Risk Management Ltd
3
All rights reserved.
4
5
This file is part of ORE, a free-software/open-source library
6
for transparent pricing and risk analysis - http://opensourcerisk.org
7
8
ORE is free software: you can redistribute it and/or modify it
9
under the terms of the Modified BSD License. You should have received a
10
copy of the license along with this program.
11
The license is also available online at <http://opensourcerisk.org>
12
13
This program is distributed on the basis that it will form a useful
14
contribution to risk analytics and model standardisation, but WITHOUT
15
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16
FITNESS FOR A PARTICULAR PURPOSE. See the license for more details.
17
*/
18
19
namespace
QuantExt
{
20
21
/*! CrossAssetAnalytics
22
23
This namesace provides a number of functions which compute analytical moments
24
(expectations and covariances) of cross asset model factors.
25
These are used in the exact propagation of cross asset model paths (i.e. without
26
time discretisation error).
27
28
Reference:
29
Lichters, Stamm, Gallagher: Modern Derivatives Pricing and Credit Exposure
30
Analysis, Palgrave Macmillan, 2015
31
32
See also the documentation in class CrossAssetModel.
33
34
Section 16.1 in the reference above lists the analytical expectations and covariances
35
implemented in this namespace.
36
In the following we consider time intervals \f$(s,t)\f$. We aim at computing conditional
37
expectations of factors at time \f$t\f$ given their state at time \f$s\f$, likewise covariances of
38
factor moves \f$\Delta z\f$ and \f$\Delta x\f$ over time interval \f$(s,t)\f$.
39
40
Starting with the interest rate processes
41
\f{eqnarray*}{
42
dz_i &=& \epsilon_i\,\gamma_i\,dt + \alpha^z_i\,dW^z_i, \qquad \epsilon_i = \left\{ \begin{array}{ll} 0 & i = 0 \\ 1 & i > 0 \end{array}\right.
43
\f}
44
we get the factor move by integration
45
\f{eqnarray*}{
46
\Delta z_i &=& -\int_s^t H^z_i\,(\alpha^z_i)^2\,du + \rho^{zz}_{0i} \int_s^t H^z_0\,\alpha^z_0\,\alpha^z_i\,du\\
47
&& - \epsilon_i \rho^{zx}_{ii}\int_s^t \sigma_i^x\,\alpha^z_i\,du + \int_s^t \alpha^z_i\,dW^z_i. \\
48
\f}
49
Thus, conditional expectation and covariances are
50
\f{eqnarray*}{
51
\mathbb{E}[\Delta z_i] &=& -\int_s^t H^z_i\,(\alpha^z_i)^2\,du + \rho^{zz}_{0i} \int_s^t H^z_0\,\alpha^z_0\,\alpha^z_i\,du
52
- \epsilon_i \rho^{zx}_{ii}\int_s^t \sigma_i^x\,\alpha^z_i\,du \\
53
\mathrm{Cov}[\Delta z_a, \Delta z_b] &=& \rho^{zz}_{ab} \int_s^t \alpha^z_a\,\alpha^z_b\,du
54
\f}
55
56
Proceeding similarly with the foreign exchange rate processes
57
\f[
58
dx_i / x_i = \mu^x_i \, dt +\sigma_i^x\,dW^x_i,
59
\f]
60
we get the following log-moves by integration
61
62
\f{eqnarray*}{
63
\Delta \ln x_i &=& \ln \left( \frac{P^n_0(0,s)}{P^n_0(0,t)} \frac{P^n_i(0,t)}{P^n_i(0,s)}\right) - \frac12 \int_s^t (\sigma^x_i)^2\,du + \rho^{zx}_{0i}\int_s^t H^z_0\, \alpha^z_0\, \sigma^x_i \,du\nonumber\\
64
&&+\int_s^t \zeta^z_0\,H^z_0\, (H^z_0)^{\prime}\,du-\int_s^t \zeta^z_i\,H^z_i\, (H^z_i)^{\prime}\,du\nonumber\\
65
&&+ \int_s^t \left(H^z_0(t)-H^z_0\right)\alpha_0^z\,dW^z_0+ \left(H^z_0(t)-H^z_0(s)\right) z_0(s) \nonumber\\
66
&&- \int_s^t \left(H^z_i(t)-H^z_i\right)\alpha_i^z\,dW^z_i -\left(H^z_i(t)-H^z_i(s)\right)z_i(s) \nonumber\\
67
&&- \int_s^t \left(H^z_i(t)-H^z_i\right)\gamma_i\,du + \int_s^t\sigma^x_i dW^x_i \nonumber
68
\f}
69
70
Integration by parts yields
71
72
\f{eqnarray*}{
73
&& \int_s^t \zeta^z_0\,H^z_0\, (H^z_0)^{\prime}\,du-\int_s^t \zeta^z_i\,H^z_i\, (H^z_i)^{\prime}\,du\\
74
&& = \frac12 \left((H^z_0(t))^2 \zeta^z_0(t) - (H^z_0(s))^2 \zeta^z_0(s)- \int_s^t (H^z_0)^2 (\alpha^z_0)^2\,du\right)\nonumber\\
75
&&\qquad {}- \frac12 \left((H^z_i(t))^2 \zeta^z_i(t) - (H^z_i(s))^2 \zeta^z_i(s)-\int_s^t (H^z_i)^2 (\alpha^z_i)^2\,du \right)
76
\f}
77
78
so that the expectation is
79
\f{eqnarray}{
80
\mathbb{E}[\Delta \ln x_i] &=& \ln \left( \frac{P^n_0(0,s)}{P^n_0(0,t)} \frac{P^n_i(0,t)}{P^n_i(0,s)}\right) - \frac12 \int_s^t (\sigma^x_i)^2\,du + \rho^{zx}_{0i} \int_s^t H^z_0\, \alpha^z_0\, \sigma^x_i\,du\nonumber\\
81
&&+\frac12 \left((H^z_0(t))^2 \zeta^z_0(t) - (H^z_0(s))^2 \zeta^z_0(s)- \int_s^t (H^z_0)^2 (\alpha^z_0)^2\,du\right)\nonumber\\
82
&&-\frac12 \left((H^z_i(t))^2 \zeta^z_i(t) - (H^z_i(s))^2 \zeta^z_i(s)-\int_s^t (H^z_i)^2 (\alpha^z_i)^2\,du \right)\nonumber\\
83
&&+ \left(H^z_0(t)-H^z_0(s)\right) z_0(s) -\left(H^z_i(t)-H^z_i(s)\right)z_i(s)\nonumber\\
84
&& - \int_s^t \left(H^z_i(t)-H^z_i\right)\gamma_i \,du, \label{eq:meanX}
85
\f}
86
87
and IR-FX and FX-FX covariances are
88
89
\f{eqnarray}{
90
\mathrm{Cov}[\Delta \ln x_a, \Delta \ln x_b] &=& \int_s^t \left(H^z_0(t)-H^z_0\right)^2 (\alpha_0^z)^2\,du \nonumber\\
91
&&- \rho^{zz}_{0b}\int_s^t \left(H^z_0(t)-H^z_0\right)\alpha_0^z \left(H^z_b(t)-H^z_b\right)\alpha_b^z\,du \nonumber\\
92
&&+ \rho^{zx}_{0b}\int_s^t \left(H^z_0(t)-H^z_0\right)\alpha_0^z \sigma^x_b\,du \nonumber\\
93
&& -\rho^{zz}_{0a} \int_s^t \left(H^z_a(t)-H^z_a\right) \alpha_a^z\left(H^z_0(t)-H^z_0\right) \alpha_0^z\,du \nonumber\\
94
&&+ \rho^{zz}_{ab}\int_s^t \left(H^z_a(t)-H^z_a\right)\alpha_a^z \left(H^z_b(t)-H^z_b\right)\alpha_b^z\,du \nonumber\\
95
&&- \rho^{zx}_{ab}\int_s^t \left(H^z_a(t)-H^z_a\right)\alpha_a^z \sigma^x_b,du\nonumber\\
96
&&+ \rho^{zx}_{0a}\int_s^t \left(H^z_0(t)-H^z_0\right)\alpha_0^z\,\sigma^x_a\,du \nonumber\\
97
&&- \rho^{zx}_{ba}\int_s^t \left(H^z_b(t)-H^z_b\right)\alpha_b^z\,\sigma^x_a\, du \nonumber\\
98
&&+ \rho^{xx}_{ab}\int_s^t\sigma^x_a\,\sigma^x_b \,du \label{eq:covXX}\\
99
&&\nonumber\\
100
\mathrm{Cov} [\Delta z_a, \Delta \ln x_b]) &=& \rho^{zz}_{0a}\int_s^t \left(H^z_0(t)-H^z_0\right) \alpha^z_0\,\alpha^z_a\,du \nonumber\\
101
&&- \rho^{zz}_{ab}\int_s^t \alpha^z_a \left(H^z_b(t)-H^z_b\right) \alpha^z_b \,du \nonumber\\
102
&&+\rho^{zx}_{ab}\int_s^t \alpha^z_a \, \sigma^x_b \,du. \label{eq:covZX}
103
\f}
104
105
Based on these expectations of factor moves and log-moves, respectively, we can work out the
106
conditonal expectations of the factor levels at time \f$t\f$. These expectations have state-dependent
107
parts (levels at time \f$s\f$) and state-independent parts which we separate in the implementation,
108
see functions ending with "_1" and "_2", respectively.
109
Moreover, the implementation splits up the integrals further in order to separate simple and more
110
complex integrations and to allow for tailored efficient numerical integration schemes.
111
112
In the following we rearrange the expectations and covariances above such that the expressions
113
correspond 1:1 to their implementations below.
114
115
\todo Rearrange integrals to achieve 1:1 correspondence with code
116
*/
117
namespace
CrossAssetAnalytics{}
118
119
/*! Cross asset model
120
121
Reference:
122
123
Lichters, Stamm, Gallagher: Modern Derivatives Pricing and Credit Exposure
124
Analysis, Palgrave Macmillan, 2015
125
126
The model is operated under the domestic LGM measure. There are two ways of
127
calibrating the model:
128
129
- provide an already calibrated parametrization for a component
130
extracted from some external model
131
- do the calibration within the CrossAssetModel using one
132
of the calibration procedures
133
134
The inter-parametrization correlation matrix specified here can not be
135
calibrated currently, but is a fixed, external input.
136
137
The model does not own a reference date, the times given in the
138
parametrizations are absolute and insensitive to shifts in the global
139
evaluation date. The termstructures are required to be consistent with
140
these times, i.e. should all have the same reference date and day counter.
141
The model does not observe anything, so its update() method must be
142
explicitly called to notify observers of changes in the constituting
143
parametrizations, update these parametrizations and flushing the cache
144
of the state process. The model ensures these updates during
145
calibration though.
146
147
The cross asset model for \f$n\f$ currencies is specified by the following SDE
148
149
\f{eqnarray*}{
150
dz_0(t) &=& \alpha^z_0(t)\,dW^z_0(t) \\
151
dz_i(t) &=& \gamma_i(t)\,dt + \alpha^z_i(t)\,dW^z_i(t), \qquad i = 1,\dots, n-1 \\
152
dx_i(t) / x_i(t) &=& \mu^x_i(t)\, dt +\sigma_i^x(t)\,dW^x_i(t), \qquad i=1, \dots, n-1 \\
153
dW^a_i\,dW^b_j &=& \rho^{ab}_{ij}\,dt, \qquad a, b \in \{z, x\}
154
\f}
155
Factors \f$z_i\f$ drive the LGM interest rate processes (index \f$i=0\f$ denotes the domestic currency),
156
and factors \f$x_i\f$ the foreign exchange rate processes.
157
158
The no-arbitrage drift terms are
159
\f{eqnarray*}
160
\gamma_i &=& -H^z_i\,(\alpha^z_i)^2 + H^z_0\,\alpha^z_0\,\alpha^z_i\,\rho^{zz}_{0i} - \sigma_i^x\,\alpha^z_i\, \rho^{zx}_{ii}\\
161
\mu^x_i &=& r_0-r_i +H^z_0\,\alpha^z_0\,\sigma^x_i\,\rho^{zx}_{0i}
162
\f}
163
where we have dropped time-dependencies to lighten notation.
164
165
The short rate \f$r_i(t)\f$ in currency \f$i\f$ is connected with the instantaneous forward curve \f$f_i(0,t)\f$
166
and model parameters \f$H_i(t)\f$ and \f$\alpha_i(t)\f$ via
167
\f{eqnarray*}{
168
r_i(t) &=& f_i(0,t) + z_i(t)\,H'_i(t) + \zeta_i(t)\,H_i(t)\,H'_i(t), \quad \zeta_i(t) = \int_0^t \alpha_i^2(s)\,ds \\ \\
169
\f}
170
171
Parameters \f$H_i(t)\f$ and \f$\alpha_i(t)\f$ (or alternatively \f$\zeta_i(t)\f$) are LGM model parameters
172
which determine, together with the stochastic factor \f$z_i(t)\f$, the evolution of numeraire and
173
zero bond prices in the LGM model:
174
\f{eqnarray*}{
175
N(t) &=& \frac{1}{P(0,t)}\exp\left\{H_t\, z_t + \frac{1}{2}H^2_t\,\zeta_t \right\} \\
176
P(t,T,z_t) &=& \frac{P(0,T)}{P(0,t)}\:\exp\left\{ -(H_T-H_t)\,z_t - \frac{1}{2} \left(H^2_T-H^2_t\right)\,\zeta_t\right\}.
177
\f}
178
179
*/
180
namespace
CrossAssetModelTypes{}
181
182
/*!
183
*/
184
namespace
tag{}
185
186
}
QuantExt
Definition:
namespaces.docs:19
Generated by
Doxygen
1.9.5