Logo
Reference manual - version qle_version
QuantExt::CrossAssetAnalytics Namespace Reference

Classes

struct  Hz
struct  az
struct  zetaz
struct  sx
struct  vx
struct  Hy
 INF H component. May relate to real rate portion of JY model or z component of DK model. More...
struct  ay
 INF alpha component. May relate to real rate portion of JY model or z component of DK model. More...
struct  zetay
 INF zeta component. May relate to real rate portion of JY model or z component of DK model. More...
struct  sy
 JY INF index sigma component. More...
struct  vy
 JY INF index variance component. More...
struct  Hl
struct  al
struct  zetal
struct  ss
struct  vs
struct  coms
struct  comDiffusionIntegrand
struct  rzz
struct  rzx
struct  rxx
struct  ryy
struct  rzy
struct  rxy
struct  rll
struct  rzl
struct  rxl
struct  ryl
struct  rss
struct  rzs
struct  rxs
struct  rys
struct  rls
struct  rcc
struct  rzc
struct  rxc
struct  ryc
struct  rsc
struct  rlc
struct  HTtz
struct  rzcrs
struct  rxcrs
struct  rccrs
struct  P2_
struct  P3_
struct  P4_
struct  P5_
struct  LC1_
struct  LC2_
struct  LC3_
struct  LC4_

Functions

Real ir_expectation_1 (const CrossAssetModel &model, const Size i, const Time t0, const Real dt)
Real ir_expectation_2 (const CrossAssetModel &model, const Size i, const Real zi_0)
std::pair< QuantLib::Real, QuantLib::Real > inf_jy_expectation_1 (const CrossAssetModel &model, QuantLib::Size i, QuantLib::Time t0, QuantLib::Real dt)
std::pair< QuantLib::Real, QuantLib::Real > inf_jy_expectation_2 (const CrossAssetModel &model, QuantLib::Size i, QuantLib::Time t0, const std::pair< QuantLib::Real, QuantLib::Real > &state_0, QuantLib::Real zi_i_0, QuantLib::Real dt)
Real fx_expectation_1 (const CrossAssetModel &model, const Size i, const Time t0, const Real dt)
Real fx_expectation_2 (const CrossAssetModel &model, const Size i, const Time t0, const Real xi_0, const Real zi_0, const Real z0_0, const Real dt)
Real eq_expectation_1 (const CrossAssetModel &model, const Size i, const Time t0, const Real dt)
Real eq_expectation_2 (const CrossAssetModel &model, const Size k, const Time t0, const Real si_0, const Real zi_0, const Real dt)
Real com_expectation_1 (const CrossAssetModel &model, const Size i, const Time t0, const Real dt)
Real ir_ir_covariance (const CrossAssetModel &model, const Size i, const Size j, const Time t0, const Time dt)
Real ir_fx_covariance (const CrossAssetModel &model, const Size i, const Size j, const Time t0, const Time dt)
Real fx_fx_covariance (const CrossAssetModel &model, const Size i, const Size j, const Time t0, const Time dt)
Real infz_infz_covariance (const CrossAssetModel &model, const Size i, const Size j, const Time t0, const Time dt)
Real infz_infy_covariance (const CrossAssetModel &model, const Size i, const Size j, const Time t0, const Time dt)
Real infy_infy_covariance (const CrossAssetModel &model, const Size i, const Size j, const Time t0, const Time dt)
Real ir_infz_covariance (const CrossAssetModel &model, const Size i, const Size j, const Time t0, const Time dt)
Real ir_infy_covariance (const CrossAssetModel &model, const Size i, const Size j, const Time t0, const Time dt)
Real fx_infz_covariance (const CrossAssetModel &model, const Size i, const Size j, const Time t0, const Time dt)
Real fx_infy_covariance (const CrossAssetModel &model, const Size i, const Size j, const Time t0, const Time dt)
Real crz_crz_covariance (const CrossAssetModel &model, const Size i, const Size j, const Time t0, const Time dt)
Real crz_cry_covariance (const CrossAssetModel &model, const Size i, const Size j, const Time t0, const Time dt)
Real cry_cry_covariance (const CrossAssetModel &model, const Size i, const Size j, const Time t0, const Time dt)
Real ir_crz_covariance (const CrossAssetModel &model, const Size i, const Size j, const Time t0, const Time dt)
Real ir_cry_covariance (const CrossAssetModel &model, const Size i, const Size j, const Time t0, const Time dt)
Real fx_crz_covariance (const CrossAssetModel &model, const Size i, const Size j, const Time t0, const Time dt)
Real fx_cry_covariance (const CrossAssetModel &model, const Size i, const Size j, const Time t0, const Time dt)
Real infz_crz_covariance (const CrossAssetModel &model, const Size i, const Size j, const Time t0, const Time dt)
Real infz_cry_covariance (const CrossAssetModel &model, const Size i, const Size j, const Time t0, const Time dt)
Real infy_crz_covariance (const CrossAssetModel &model, const Size i, const Size j, const Time t0, const Time dt)
Real infy_cry_covariance (const CrossAssetModel &model, const Size i, const Size j, const Time t0, const Time dt)
Real ir_eq_covariance (const CrossAssetModel &model, const Size irIdx, const Size eqIdx, const Time t0, const Time dt)
Real fx_eq_covariance (const CrossAssetModel &model, const Size i, const Size j, const Time t0, const Time dt)
Real infz_eq_covariance (const CrossAssetModel &model, const Size i, const Size j, const Time t0, const Time dt)
Real infy_eq_covariance (const CrossAssetModel &model, const Size i, const Size j, const Time t0, const Time dt)
Real crz_eq_covariance (const CrossAssetModel &model, const Size i, const Size j, const Time t0, const Time dt)
Real cry_eq_covariance (const CrossAssetModel &model, const Size i, const Size j, const Time t0, const Time dt)
Real eq_eq_covariance (const CrossAssetModel &model, const Size i, const Size j, const Time t0, const Time dt)
Real aux_aux_covariance (const CrossAssetModel &model, const Time t0, const Time dt)
Real aux_ir_covariance (const CrossAssetModel &model, const Size j, const Time t0, const Time dt)
Real aux_fx_covariance (const CrossAssetModel &model, const Size j, const Time t0, const Time dt)
Real com_com_covariance (const CrossAssetModel &model, const Size i, const Size j, const Time t0, const Time dt)
Real ir_com_covariance (const CrossAssetModel &model, const Size i, const Size j, const Time t0, const Time dt)
Real fx_com_covariance (const CrossAssetModel &model, const Size i, const Size j, const Time t0, const Time dt)
Real infz_com_covariance (const CrossAssetModel &model, const Size i, const Size j, const Time t0, const Time dt)
Real infy_com_covariance (const CrossAssetModel &model, const Size i, const Size j, const Time t0, const Time dt)
Real cry_com_covariance (const CrossAssetModel &model, const Size i, const Size j, const Time t0, const Time dt)
Real crz_com_covariance (const CrossAssetModel &model, const Size i, const Size j, const Time t0, const Time dt)
Real eq_com_covariance (const CrossAssetModel &model, const Size i, const Size j, const Time t0, const Time dt)
Real ir_crstate_covariance (const CrossAssetModel &model, const Size i, const Size j, const Time t0, const Time dt)
Real fx_crstate_covariance (const CrossAssetModel &model, const Size i, const Size j, const Time t0, const Time dt)
Real crstate_crstate_covariance (const CrossAssetModel &model, const Size i, const Size j, const Time t0, const Time dt)
template<class E>
Real integral_helper (const CrossAssetModel &x, const E &e, const Real t)
template<typename E>
Real integral (const CrossAssetModel &model, const E &e, const Real a, const Real b)
template<class E1, class E2>
const P2_< E1, E2 > P (const E1 &e1, const E2 &e2)
template<class E1, class E2, class E3>
const P3_< E1, E2, E3 > P (const E1 &e1, const E2 &e2, const E3 &e3)
template<class E1, class E2, class E3, class E4>
const P4_< E1, E2, E3, E4 > P (const E1 &e1, const E2 &e2, const E3 &e3, const E4 &e4)
template<class E1, class E2, class E3, class E4, class E5>
const P5_< E1, E2, E3, E4, E5 > P (const E1 &e1, const E2 &e2, const E3 &e3, const E4 &e4, const E5 &e5)
template<class E1>
const LC1_< E1 > LC (QuantLib::Real c, QuantLib::Real c1, const E1 &e1)
template<class E1, class E2>
const LC2_< E1, E2 > LC (QuantLib::Real c, QuantLib::Real c1, const E1 &e1, QuantLib::Real c2, const E2 &e2)
template<class E1, class E2, class E3>
const LC3_< E1, E2, E3 > LC (QuantLib::Real c, QuantLib::Real c1, const E1 &e1, QuantLib::Real c2, const E2 &e2, QuantLib::Real c3, const E3 &e3)
template<class E1, class E2, class E3, class E4>
const LC4_< E1, E2, E3, E4 > LC (QuantLib::Real c, QuantLib::Real c1, const E1 &e1, QuantLib::Real c2, const E2 &e2, QuantLib::Real c3, const E3 &e3, QuantLib::Real c4, const E4 &e4)

Detailed Description

CrossAssetAnalytics

This namesace provides a number of functions which compute analytical moments (expectations and covariances) of cross asset model factors. These are used in the exact propagation of cross asset model paths (i.e. without time discretisation error).

Reference: Lichters, Stamm, Gallagher: Modern Derivatives Pricing and Credit Exposure Analysis, Palgrave Macmillan, 2015

See also the documentation in class CrossAssetModel.

Section 16.1 in the reference above lists the analytical expectations and covariances implemented in this namespace. In the following we consider time intervals \((s,t)\). We aim at computing conditional expectations of factors at time \(t\) given their state at time \(s\), likewise covariances of factor moves \(\Delta z\) and \(\Delta x\) over time interval \((s,t)\).

Starting with the interest rate processes

\begin{eqnarray*}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. \end{eqnarray*}

we get the factor move by integration

\begin{eqnarray*}\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\\ && - \epsilon_i \rho^{zx}_{ii}\int_s^t \sigma_i^x\,\alpha^z_i\,du + \int_s^t \alpha^z_i\,dW^z_i. \\ \end{eqnarray*}

Thus, conditional expectation and covariances are

\begin{eqnarray*}\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 - \epsilon_i \rho^{zx}_{ii}\int_s^t \sigma_i^x\,\alpha^z_i\,du \\ \mathrm{Cov}[\Delta z_a, \Delta z_b] &=& \rho^{zz}_{ab} \int_s^t \alpha^z_a\,\alpha^z_b\,du \end{eqnarray*}

Proceeding similarly with the foreign exchange rate processes

\[dx_i / x_i = \mu^x_i \, dt +\sigma_i^x\,dW^x_i, \]

we get the following log-moves by integration

\begin{eqnarray*}\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\\ &&+\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\\ &&+ \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\\ &&- \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\\ &&- \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 \end{eqnarray*}

Integration by parts yields

\begin{eqnarray*}&& \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\\ && = \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\\ &&\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) \end{eqnarray*}

so that the expectation is

\begin{eqnarray}\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\\ &&+\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\\ &&-\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\\ &&+ \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\\ && - \int_s^t \left(H^z_i(t)-H^z_i\right)\gamma_i \,du, \label{eq:meanX} \end{eqnarray}

and IR-FX and FX-FX covariances are

\begin{eqnarray}\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\\ &&- \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\\ &&+ \rho^{zx}_{0b}\int_s^t \left(H^z_0(t)-H^z_0\right)\alpha_0^z \sigma^x_b\,du \nonumber\\ && -\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\\ &&+ \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\\ &&- \rho^{zx}_{ab}\int_s^t \left(H^z_a(t)-H^z_a\right)\alpha_a^z \sigma^x_b,du\nonumber\\ &&+ \rho^{zx}_{0a}\int_s^t \left(H^z_0(t)-H^z_0\right)\alpha_0^z\,\sigma^x_a\,du \nonumber\\ &&- \rho^{zx}_{ba}\int_s^t \left(H^z_b(t)-H^z_b\right)\alpha_b^z\,\sigma^x_a\, du \nonumber\\ &&+ \rho^{xx}_{ab}\int_s^t\sigma^x_a\,\sigma^x_b \,du \label{eq:covXX}\\ &&\nonumber\\ \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\\ &&- \rho^{zz}_{ab}\int_s^t \alpha^z_a \left(H^z_b(t)-H^z_b\right) \alpha^z_b \,du \nonumber\\ &&+\rho^{zx}_{ab}\int_s^t \alpha^z_a \, \sigma^x_b \,du. \label{eq:covZX} \end{eqnarray}

Based on these expectations of factor moves and log-moves, respectively, we can work out the conditonal expectations of the factor levels at time \(t\). These expectations have state-dependent parts (levels at time \(s\)) and state-independent parts which we separate in the implementation, see functions ending with "_1" and "_2", respectively. Moreover, the implementation splits up the integrals further in order to separate simple and more complex integrations and to allow for tailored efficient numerical integration schemes.

In the following we rearrange the expectations and covariances above such that the expressions correspond 1:1 to their implementations below.