Files | |
file | crossassetanalytics.hpp |
analytics for the cross asset model | |
file | crossassetanalyticsbase.hpp |
basic functions for analytics in the cross asset model | |
file | crossassetmodel.hpp |
cross asset model | |
file | crossassetmodelimpliedeqvoltermstructure.hpp |
dynamic black volatility term structure | |
file | crossassetmodelimpliedfxvoltermstructure.hpp |
dynamic black volatility term structure | |
file | projectedcrossassetmodel.hpp |
cross asset model projection utils | |
file | crossassetstateprocess.hpp |
crossasset model state process | |
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 | 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 | HTtz |
struct | rzcrs |
struct | rxcrs |
struct | rccrs |
struct | P2_< E1, E2 > |
struct | P3_< E1, E2, E3 > |
struct | P4_< E1, E2, E3, E4 > |
struct | P5_< E1, E2, E3, E4, E5 > |
struct | LC1_< E1 > |
struct | LC2_< E1, E2 > |
struct | LC3_< E1, E2, E3 > |
struct | LC4_< E1, E2, E3, E4 > |
class | CrossAssetModel |
Cross Asset Model. More... | |
class | CrossAssetModelImpliedEqVolTermStructure |
Cross Asset Model Implied EQ Term Structure. More... | |
class | CrossAssetModelImpliedFxVolTermStructure |
Cross Asset Model Implied FX Term Structure. More... | |
class | CrossAssetStateProcess |
Cross Asset Model State Process. More... | |
Functions | |
Real | ir_expectation_1 (const CrossAssetModel &x, const Size i, const Time t0, const Real dt) |
Real | ir_expectation_2 (const CrossAssetModel &, const Size, 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 &x, const Size i, const Time t0, const Real dt) |
Real | fx_expectation_2 (const CrossAssetModel &x, 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 &x, const Size k, const Time t0, const Real dt) |
Real | eq_expectation_2 (const CrossAssetModel &x, const Size k, const Time t0, const Real sk_0, const Real zi_0, const Real dt) |
Real | ir_ir_covariance (const CrossAssetModel &x, const Size i, const Size j, const Time t0, const Time dt) |
Real | ir_fx_covariance (const CrossAssetModel &x, const Size i, const Size j, const Time t0, const Time dt) |
Real | fx_fx_covariance (const CrossAssetModel &x, const Size i, const Size j, const Time t0, const Time dt) |
Real | infz_infz_covariance (const CrossAssetModel &x, const Size i, const Size j, const Time t0, const Time dt) |
Real | infz_infy_covariance (const CrossAssetModel &x, const Size i, const Size j, const Time t0, const Time dt) |
Real | infy_infy_covariance (const CrossAssetModel &x, const Size i, const Size j, const Time t0, const Time dt) |
Real | ir_infz_covariance (const CrossAssetModel &x, const Size i, const Size j, const Time t0, const Time dt) |
Real | ir_infy_covariance (const CrossAssetModel &x, const Size i, const Size j, const Time t0, const Time dt) |
Real | fx_infz_covariance (const CrossAssetModel &x, const Size i, const Size j, const Time t0, const Time dt) |
Real | fx_infy_covariance (const CrossAssetModel &x, const Size i, const Size j, const Time t0, const Time dt) |
Real | crz_crz_covariance (const CrossAssetModel &x, const Size i, const Size j, const Time t0, const Time dt) |
Real | crz_cry_covariance (const CrossAssetModel &x, const Size i, const Size j, const Time t0, const Time dt) |
Real | cry_cry_covariance (const CrossAssetModel &x, const Size i, const Size j, const Time t0, const Time dt) |
Real | ir_crz_covariance (const CrossAssetModel &x, const Size i, const Size j, const Time t0, const Time dt) |
Real | ir_cry_covariance (const CrossAssetModel &x, const Size i, const Size j, const Time t0, const Time dt) |
Real | fx_crz_covariance (const CrossAssetModel &x, const Size i, const Size j, const Time t0, const Time dt) |
Real | fx_cry_covariance (const CrossAssetModel &x, const Size i, const Size j, const Time t0, const Time dt) |
Real | infz_crz_covariance (const CrossAssetModel &x, const Size i, const Size j, const Time t0, const Time dt) |
Real | infz_cry_covariance (const CrossAssetModel &x, const Size i, const Size j, const Time t0, const Time dt) |
Real | infy_crz_covariance (const CrossAssetModel &x, const Size i, const Size j, const Time t0, const Time dt) |
Real | infy_cry_covariance (const CrossAssetModel &x, const Size i, const Size j, const Time t0, const Time dt) |
Real | ir_eq_covariance (const CrossAssetModel &x, const Size j, const Size k, const Time t0, const Time dt) |
Real | fx_eq_covariance (const CrossAssetModel &x, const Size j, const Size k, const Time t0, const Time dt) |
Real | infz_eq_covariance (const CrossAssetModel &x, const Size i, const Size j, const Time t0, const Time dt) |
Real | infy_eq_covariance (const CrossAssetModel &x, const Size i, const Size j, const Time t0, const Time dt) |
Real | crz_eq_covariance (const CrossAssetModel &x, const Size i, const Size j, const Time t0, const Time dt) |
Real | cry_eq_covariance (const CrossAssetModel &x, const Size i, const Size j, const Time t0, const Time dt) |
Real | eq_eq_covariance (const CrossAssetModel &x, const Size k, const Size l, const Time t0, const Time dt) |
Real | aux_aux_covariance (const CrossAssetModel &x, const Time t0, const Time dt) |
Real | aux_ir_covariance (const CrossAssetModel &x, const Size j, const Time t0, const Time dt) |
Real | aux_fx_covariance (const CrossAssetModel &x, const Size j, const Time t0, const Time dt) |
Real | com_com_covariance (const CrossAssetModel &x, const Size k, const Size l, 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 &x, const Size i, const Size j, const Time t0, const Time dt) |
Real | fx_crstate_covariance (const CrossAssetModel &x, const Size i, const Size j, const Time t0, const Time dt) |
Real | crstate_crstate_covariance (const CrossAssetModel &x, 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) |
Grouping of all cross asset models
Real ir_expectation_1 | ( | const CrossAssetModel & | model, |
const Size | i, | ||
const Time | t0, | ||
const Real | dt | ||
) |
IR state expectation
This function evaluates part of the expectation \( \mathbb{E}_{t_0}[z_i(t_0+dt)]\).
Using the results above for factor moves \(\Delta z\) over time interval \((s,t)\), we have
\begin{eqnarray} \mathbb{E}_{t_0}[z_i(t_0+\Delta t)] &=& z_i(t_0) + \mathbb{E}_{t_0}[\Delta z_i], \qquad\mbox{with}\quad \Delta z_i = z_i(t_0+\Delta t) - z_i(t_0) \\ &=& z_i(t_0) -\int_{t_0}^{t_0+\Delta t} H^z_i\,(\alpha^z_i)^2\,du + \rho^{zz}_{0i} \int_{t_0}^{t_0+\Delta t} H^z_0\,\alpha^z_0\,\alpha^z_i\,du - \epsilon_i \rho^{zx}_{ii}\int_{t_0}^{t_0+\Delta t} \sigma_i^x\,\alpha^z_i\,du \end{eqnarray}
This function covers the latter three integrals, the state-independent part.
Definition at line 29 of file crossassetanalytics.cpp.
Real ir_expectation_2 | ( | const CrossAssetModel & | model, |
const Size | i, | ||
const Real | zi_0 | ||
) |
IR state expectation This function evaluates the state-dependent part of the expectation
\begin{eqnarray} \mathbb{E}_{t_0}[z_i(t_0+\Delta t)] &=& z_i(t_0) -\int_{t_0}^{t_0+\Delta t} H^z_i\,(\alpha^z_i)^2\,du + \rho^{zz}_{0i} \int_{t_0}^{t_0+\Delta t} H^z_0\,\alpha^z_0\,\alpha^z_i\,du - \epsilon_i \rho^{zx}_{ii}\int_{t_0}^{t_0+\Delta t} \sigma_i^x\,\alpha^z_i\,du \end{eqnarray}
i.e. simply the first contribution \( z_i(t_0) \).
Definition at line 43 of file crossassetanalytics.cpp.
std::pair< QuantLib::Real, QuantLib::Real > inf_jy_expectation_1 | ( | const CrossAssetModel & | model, |
QuantLib::Size | i, | ||
QuantLib::Time | t0, | ||
QuantLib::Real | dt | ||
) |
State independent portion of the JY inflation drift. The first element of the pair relates to the real rate process and the second element of the pair relates to the inflation index process.
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 | ||
) |
State dependent portion of the JY inflation drift. The first element of the pair relates to the real rate process and the second element of the pair relates to the inflation index process.
Real fx_expectation_1 | ( | const CrossAssetModel & | model, |
const Size | i, | ||
const Time | t0, | ||
const Real | dt | ||
) |
FX state expectation
This function evaluates part of the expectation \( \mathbb{E}_{t_0}[\ln x_i(t_0+dt)]\).
Using the results above for factor moves \(\Delta \ln x\) over time interval \((s,t)\), we have
\begin{eqnarray} \mathbb{E}_{t_0}[\ln x_i(t_0+\Delta t)] &=& \ln x_i(t_0) + \mathbb{E}_{t_0}[\Delta \ln x_i], \qquad\mbox{with}\quad \Delta \ln x_i = \ln x_i(t_0+\Delta t) - \ln x_i(t_0) \\ &=& \ln x_i(t_0) + \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)\\ &&+ \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 \\ &&+\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)\\ &&-\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)\\ && + \rho^{zx}_{0i} \int_s^t H^z_0\, \alpha^z_0\, \sigma^x_i\,du \\ && - \int_s^t \left(H^z_i(t)-H^z_i\right)\gamma_i \,du, \qquad\mbox{with}\quad s = t_0, \quad t = t_0+\Delta t \end{eqnarray}
where we rearranged terms so that the state-dependent terms are listed on the first line (containing \(\ln x_i(t_0), z_i(t_0), z_0(t_0) \)) and all following terms are state-independent (deterministic, just dependent on initial market data and model parameters).
The last integral above contains \(\gamma_i\) which is (see documentation of the CrossAssetModel)
\[ \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}. \]
The very last last integral above is therefore broken up into six terms which we do not list here, but which show up in this function's implementation.
This function covers the latter state-independent part of the FX expectation.
Definition at line 124 of file crossassetanalytics.cpp.
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 | ||
) |
FX state expectation.
This function covers the state-dependent part of the FX expectation.
Definition at line 156 of file crossassetanalytics.cpp.
Real eq_expectation_1 | ( | const CrossAssetModel & | model, |
const Size | i, | ||
const Time | t0, | ||
const Real | dt | ||
) |
EQ state expectation
This function covers part of the EQ expectation. The overall expectation formula (taken from the book "Modern Derivatives Pricing and Credit Exposure Analysis" by Lichters, Stamm and Gallagher) is as follows:
\begin{eqnarray} \mathbb{E} \left[\Delta ln[s_k]\right] &=& ln \left[ \frac{P_{\phi(k)}(0,s)}{P_{\phi(k)}(0,t)} \right] - \int_{s}^{t} q_k(u) du - \frac{1}{2} \int_{s}^{t}\sigma_{s_k}^2(u) du\\ && +\rho_{z_0,s_k}\int_{s}^{t}\alpha_0(u) H_0(u) \sigma_{s_k}(u) du - \epsilon_{\phi(k)} \rho_{s_k,x_{\phi(k)}} \int_{s}^{t} \sigma_{s_k}(u)\sigma_{x_{\phi(k)}}(u) du\\ &&+\frac{1}{2} \left( H_{\phi(k)}^2(t) \zeta_{\phi(k)}(t) - H_{\phi(k)}^2(s) \zeta_{\phi(k)}(s) - \int_{s}^{t} H_{\phi(k)}^2(u) \alpha_{\phi(k)}^2(u) du \right)\\ && + (H_{\phi(k)}(t) - H_{\phi(k)}(s)) z_{\phi(k)}(s) +\epsilon_{\phi(k)} \int_{s}^{t} \gamma_{\phi(k)} (u) (H_{\phi(k)}(t) - H_{\phi(k)}(u)) du,\\ && \qquad\mbox{with}\quad s = t_0, \quad t = t_0+\Delta t, \quad \phi(k) = \qquad\mbox{ interest rate for currency of equity k} \end{eqnarray}
This function covers the state-independent part of the EQ expectation
Definition at line 163 of file crossassetanalytics.cpp.
Real eq_expectation_2 | ( | const CrossAssetModel & | model, |
const Size | k, | ||
const Time | t0, | ||
const Real | si_0, | ||
const Real | zi_0, | ||
const Real | dt | ||
) |
EQ state expectation
This function covers the state-dependent part of the EQ expectation (see overall expression above).
Definition at line 192 of file crossassetanalytics.cpp.
Real ir_ir_covariance | ( | const CrossAssetModel & | model, |
const Size | i, | ||
const Size | j, | ||
const Time | t0, | ||
const Time | dt | ||
) |
IR-IR Covariance
This function evaluates the covariance term
\f{eqnarray*}{ \mathrm{Cov}[\Delta z_a, \Delta z_b] &=& \rho^{zz}_{ab} \int_s^t \alpha^z_a\,\alpha^z_b\,du \f} on the time interval from \f$ s= t_0\f$ to \f$ t=t_0+\Delta t\f$.
Definition at line 201 of file crossassetanalytics.cpp.
Real ir_fx_covariance | ( | const CrossAssetModel & | model, |
const Size | i, | ||
const Size | j, | ||
const Time | t0, | ||
const Time | dt | ||
) |
IR-FX Covariance
This function evaluates the covariance term
\begin{eqnarray} \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. \end{eqnarray}
on the time interval from \( s= t_0\) to \( t=t_0+\Delta t\).
Definition at line 206 of file crossassetanalytics.cpp.
Real fx_fx_covariance | ( | const CrossAssetModel & | model, |
const Size | i, | ||
const Size | j, | ||
const Time | t0, | ||
const Time | dt | ||
) |
FX-FX covariance
This function evaluates the covariance term
\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}_{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}_{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^{zx}_{0a}\int_s^t \left(H^z_0(t)-H^z_0\right)\alpha_0^z\,\sigma^x_a\,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}_{ba}\int_s^t \left(H^z_b(t)-H^z_b\right)\alpha_b^z\,\sigma^x_a\, 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^{xx}_{ab}\int_s^t\sigma^x_a\,\sigma^x_b \,du \end{eqnarray}
on the time interval from \( s= t_0\) to \( t=t_0+\Delta t\).
The implementation of this FX-FX covariance in this function further decomposes all terms in order to separate simple and more complex integrations and to allow for tailored efficient numerical integration schemes. Line by line, the covariance above can be written:
\begin{eqnarray} \mathrm{Cov}[\Delta \ln x_a, \Delta \ln x_b] &=& (H^z_0)^2(t)\int_s^t (\alpha_0^z)^2\,du - 2 \,H^z_0(t)\int_s^t H^z_0 (\alpha_0^z)^2\,du + \int_s^t (H^z_0\,\alpha_0^z)^2\,du \\ && - \rho^{zz}_{0a} H^z_0(t) \,H^z_a(t)\int_s^t \alpha_0^z\,\alpha_a^z\,du + \rho^{zz}_{0a} H^z_a(t) \int_s^t H^z_0\,\alpha_0^z\,\alpha_a^z\,du + \rho^{zz}_{0a} H^z_0(t) \int_s^t H^z_a\,\alpha_0^z\,\alpha_a^z\,du - \rho^{zz}_{0a}\int_s^t H^z_0\,H^z_a\,\alpha_0^z\,\alpha_a^z\,du \\ && - \rho^{zz}_{0b} H^z_0(t) \,H^z_b(t)\int_s^t \alpha_0^z\,\alpha_b^z\,du + \rho^{zz}_{0b} H^z_b(t) \int_s^t H^z_0\,\alpha_0^z\,\alpha_b^z\,du + \rho^{zz}_{0b} H^z_0(t) \int_s^t H^z_b\,\alpha_0^z\,\alpha_b^z\,du - \rho^{zz}_{0b}\int_s^t H^z_0\,H^z_b\,\alpha_0^z\,\alpha_b^z\,du \\ && + \rho^{zx}_{0b} H^z_0(t) \int_s^t \alpha_0^z \,\sigma^x_b\,du - \rho^{zx}_{0b} \int_s^t H^z_0 \,\alpha_0^z \,\sigma^x_b\,du \\ && + \rho^{zx}_{0a} H^z_0(t) \int_s^t \alpha_0^z \,\sigma^x_a\,du - \rho^{zx}_{0a} \int_s^t H^z_0 \,\alpha_0^z \,\sigma^x_a\,du \\ && - \rho^{zx}_{ab} H^z_a(t) \int_s^t \alpha_a^z \sigma^x_b,du + \rho^{zx}_{ab} \int_s^t H^z_a\,\alpha_a^z \sigma^x_b,du \\ && - \rho^{zx}_{ba} H^z_b(t) \int_s^t \alpha_b^z \sigma^x_a,du + \rho^{zx}_{ba} \int_s^t H^z_b\,\alpha_b^z \sigma^x_a,du \\ && + \rho^{zz}_{ab} H^z_a(t) H^z_b(t) \int_s^t \alpha_a^z \alpha_b^z \,du - \rho^{zz}_{ab} H^z_b(t) \int_s^t H^z_a \alpha_a^z \alpha_b^z \,du - \rho^{zz}_{ab} H^z_a(t) \int_s^t H^z_b \alpha_a^z \alpha_b^z \,du + \rho^{zz}_{ab} \int_s^t H^z_a H^z_b \alpha_a^z \alpha_b^z \,du \\ && + \rho^{xx}_{ab} \int_s^t\sigma^x_a\,\sigma^x_b \,du \end{eqnarray}
When comparing with the code, also note that the integral on line one can be simplified to
\[ \int_s^t (\alpha_0^z)^2\,du = \zeta_0(t) - \zeta_0(s) \]
Definition at line 215 of file crossassetanalytics.cpp.
Real infz_infz_covariance | ( | const CrossAssetModel & | model, |
const Size | i, | ||
const Size | j, | ||
const Time | t0, | ||
const Time | dt | ||
) |
infz-infz covariance
Definition at line 256 of file crossassetanalytics.cpp.
Real infz_infy_covariance | ( | const CrossAssetModel & | model, |
const Size | i, | ||
const Size | j, | ||
const Time | t0, | ||
const Time | dt | ||
) |
infz-infy covariance
Definition at line 261 of file crossassetanalytics.cpp.
Real infy_infy_covariance | ( | const CrossAssetModel & | model, |
const Size | i, | ||
const Size | j, | ||
const Time | t0, | ||
const Time | dt | ||
) |
infy-infy covariance
Definition at line 284 of file crossassetanalytics.cpp.
Real ir_infz_covariance | ( | const CrossAssetModel & | model, |
const Size | i, | ||
const Size | j, | ||
const Time | t0, | ||
const Time | dt | ||
) |
ir-infz covariance
Definition at line 350 of file crossassetanalytics.cpp.
Real ir_infy_covariance | ( | const CrossAssetModel & | model, |
const Size | i, | ||
const Size | j, | ||
const Time | t0, | ||
const Time | dt | ||
) |
ir-infy covariance
Definition at line 354 of file crossassetanalytics.cpp.
Real fx_infz_covariance | ( | const CrossAssetModel & | model, |
const Size | i, | ||
const Size | j, | ||
const Time | t0, | ||
const Time | dt | ||
) |
fx-infz covariance
Definition at line 374 of file crossassetanalytics.cpp.
Real fx_infy_covariance | ( | const CrossAssetModel & | model, |
const Size | i, | ||
const Size | j, | ||
const Time | t0, | ||
const Time | dt | ||
) |
fx-infy covariance
Definition at line 385 of file crossassetanalytics.cpp.
Real crz_crz_covariance | ( | const CrossAssetModel & | model, |
const Size | i, | ||
const Size | j, | ||
const Time | t0, | ||
const Time | dt | ||
) |
crz-crz covariance
Definition at line 422 of file crossassetanalytics.cpp.
Real crz_cry_covariance | ( | const CrossAssetModel & | model, |
const Size | i, | ||
const Size | j, | ||
const Time | t0, | ||
const Time | dt | ||
) |
crz-cry covariance
Definition at line 427 of file crossassetanalytics.cpp.
Real cry_cry_covariance | ( | const CrossAssetModel & | model, |
const Size | i, | ||
const Size | j, | ||
const Time | t0, | ||
const Time | dt | ||
) |
cry-cry covariance
Definition at line 432 of file crossassetanalytics.cpp.
Real ir_crz_covariance | ( | const CrossAssetModel & | model, |
const Size | i, | ||
const Size | j, | ||
const Time | t0, | ||
const Time | dt | ||
) |
ir-crz covariance
Definition at line 437 of file crossassetanalytics.cpp.
Real ir_cry_covariance | ( | const CrossAssetModel & | model, |
const Size | i, | ||
const Size | j, | ||
const Time | t0, | ||
const Time | dt | ||
) |
ir-cry covariance
Definition at line 442 of file crossassetanalytics.cpp.
Real fx_crz_covariance | ( | const CrossAssetModel & | model, |
const Size | i, | ||
const Size | j, | ||
const Time | t0, | ||
const Time | dt | ||
) |
fx-crz covariance
Definition at line 447 of file crossassetanalytics.cpp.
Real fx_cry_covariance | ( | const CrossAssetModel & | model, |
const Size | i, | ||
const Size | j, | ||
const Time | t0, | ||
const Time | dt | ||
) |
fx-cry covariance
Definition at line 458 of file crossassetanalytics.cpp.
Real infz_crz_covariance | ( | const CrossAssetModel & | model, |
const Size | i, | ||
const Size | j, | ||
const Time | t0, | ||
const Time | dt | ||
) |
infz-crz covariance
Definition at line 469 of file crossassetanalytics.cpp.
Real infz_cry_covariance | ( | const CrossAssetModel & | model, |
const Size | i, | ||
const Size | j, | ||
const Time | t0, | ||
const Time | dt | ||
) |
infz-cry covariance
Definition at line 474 of file crossassetanalytics.cpp.
Real infy_crz_covariance | ( | const CrossAssetModel & | model, |
const Size | i, | ||
const Size | j, | ||
const Time | t0, | ||
const Time | dt | ||
) |
infy-crz covariance
Definition at line 479 of file crossassetanalytics.cpp.
Real infy_cry_covariance | ( | const CrossAssetModel & | model, |
const Size | i, | ||
const Size | j, | ||
const Time | t0, | ||
const Time | dt | ||
) |
infy-cry covariance
Definition at line 501 of file crossassetanalytics.cpp.
Real ir_eq_covariance | ( | const CrossAssetModel & | model, |
const Size | irIdx, | ||
const Size | eqIdx, | ||
const Time | t0, | ||
const Time | dt | ||
) |
IR-EQ Covariance
\begin{eqnarray} Cov \left[\Delta ln[s_i], \Delta z_j \right] &=& \rho_{z_{\phi(i)},z_j} \int_{s}^{t} (H_{\phi(i)} (t) - H_{\phi(i)} (u)) \alpha_{\phi(i)} (u) \alpha_j (u) du\\ &&+ \rho_{s_i,z_j} \int_{s}^{t} \sigma_{s_i} (u) \alpha_j (u) du\\ \end{eqnarray}
Definition at line 523 of file crossassetanalytics.cpp.
Real fx_eq_covariance | ( | const CrossAssetModel & | model, |
const Size | i, | ||
const Size | j, | ||
const Time | t0, | ||
const Time | dt | ||
) |
FX-EQ Covariance
\begin{eqnarray} Cov \left[\Delta ln[s_i], \Delta ln[x_j] \right] &=& \rho_{z_{\phi(i)},z_0} \int_{s}^{t} (H_{\phi(i)} (t) - H_{\phi(i)} (u)) (H_0 (t) - H_0 (u)) \alpha_{\phi(i)}(u) \alpha_0(u) du\\ && - \rho_{z_{\phi(i)},z_j} \int_{s}^{t} (H_{\phi(i)} (t) - H_{\phi(i)} (u)) (H_j (t) - H_j (u)) \alpha_{\phi(i)} (u)\alpha_j(u) du\\ && + \rho_{z_{\phi(i)},x_j} \int_{s}^{t} (H_{\phi(i)} (t) - H_{\phi(i)} (u)) \alpha_{\phi(i)} (u) \sigma_{x_j}(u) du\\ &&+ \rho_{s_i,z_0} \int_{s}^{t} (H_0 (t) - H_0 (u)) \alpha_0 (u) \sigma_{s_i}(u) du\\ &&- \rho_{s_i,z_j} \int_{s}^{t} (H_j (t) - H_j (u)) \alpha_j (u) \sigma_{s_i}(u) du\\ &&+ \rho_{s_i,x_j} \int_{s}^{t} \sigma_{s_i}(u) \sigma_{x_j}(u) du\\ \end{eqnarray}
Definition at line 532 of file crossassetanalytics.cpp.
Real infz_eq_covariance | ( | const CrossAssetModel & | model, |
const Size | i, | ||
const Size | j, | ||
const Time | t0, | ||
const Time | dt | ||
) |
infz-eq covariance
Definition at line 560 of file crossassetanalytics.cpp.
Real infy_eq_covariance | ( | const CrossAssetModel & | model, |
const Size | i, | ||
const Size | j, | ||
const Time | t0, | ||
const Time | dt | ||
) |
infy-eq covariance
Definition at line 569 of file crossassetanalytics.cpp.
Real crz_eq_covariance | ( | const CrossAssetModel & | model, |
const Size | i, | ||
const Size | j, | ||
const Time | t0, | ||
const Time | dt | ||
) |
crz-eq covariance
Definition at line 599 of file crossassetanalytics.cpp.
Real cry_eq_covariance | ( | const CrossAssetModel & | model, |
const Size | i, | ||
const Size | j, | ||
const Time | t0, | ||
const Time | dt | ||
) |
cry-eq covariance
Definition at line 608 of file crossassetanalytics.cpp.
Real eq_eq_covariance | ( | const CrossAssetModel & | model, |
const Size | i, | ||
const Size | j, | ||
const Time | t0, | ||
const Time | dt | ||
) |
EQ-EQ Covariance
\begin{eqnarray} Cov \left[\Delta ln[s_i], \Delta ln[s_j] \right] &=& \rho_{z_{\phi(i)},z_{\phi(j)}} \int_{s}^{t} (H_{\phi(i)} (t) - H_{\phi(i)} (u)) (H_{\phi(j)} (t)\\ && - H_{\phi(j)} (u)) \alpha_{\phi(i)}(u) \alpha_{\phi(j)}(u) du\\ &&+ \rho_{z_{\phi(i)},s_j} \int_{s}^{t} (H_{\phi(i)} (t) - H_{\phi(i)} (u)) \alpha_{\phi(i)}(u) \sigma_{s_j}(u) du\\ &&+ \rho_{z_{\phi(j)},s_i} \int_{s}^{t} (H_{\phi(j)} (t) - H_{\phi(j)} (u)) \alpha_{\phi(j)}(u) \sigma_{s_i}(u) du\\ &&+ \rho_{s_i,s_j} \int_{s}^{t} \sigma_{s_i}(u) \sigma_{s_j}(u) du\\ \end{eqnarray}
Definition at line 617 of file crossassetanalytics.cpp.
Real aux_aux_covariance | ( | const CrossAssetModel & | model, |
const Time | t0, | ||
const Time | dt | ||
) |
AUX-AUX Covariance
This function evaluates the covariance term for the domestic auxiliary state variable in the bank account measure
\f{eqnarray*}{ \mathrm{Cov}[\Delta y_0, \Delta y_0] &=& \int_s^t (\alpha^z_0)^2 \,(H^z_0)^2\,du \f} on the time interval from \f$ s= t_0\f$ to \f$ t=t_0+\Delta t\f$.
Definition at line 634 of file crossassetanalytics.cpp.
Real aux_ir_covariance | ( | const CrossAssetModel & | model, |
const Size | j, | ||
const Time | t0, | ||
const Time | dt | ||
) |
AUX-IR Covariance
This function evaluates the covariance term for the domestic auxiliary state variable in the bank account measure with any other LGM state variable
\f{eqnarray*}{ \mathrm{Cov}[\Delta y_0, \Delta z_b] &=& \rho^{zz}_{0b} \int_s^t H^z_0\,\alpha^z_0\,\alpha^z_b\,du \f} on the time interval from \f$ s= t_0\f$ to \f$ t=t_0+\Delta t\f$.
Definition at line 639 of file crossassetanalytics.cpp.
Real aux_fx_covariance | ( | const CrossAssetModel & | model, |
const Size | j, | ||
const Time | t0, | ||
const Time | dt | ||
) |
AUX-FX Covariance
This function evaluates the covariance term
\begin{eqnarray} \mathrm{Cov} [\Delta y_0, \Delta \ln x_b]) &=& \int_s^t \left(H^z_0(t)-H^z_0\right) (\alpha^z_0)^2\,H^z_0\,du \nonumber\\ &&- \rho^{zz}_{0b}\int_s^t \alpha^z_0\,H^z_0 \left(H^z_b(t)-H^z_b\right) \alpha^z_b \,du \nonumber\\ &&+\rho^{zx}_{0b}\int_s^t \alpha^z_0\,H^z_0 \, \sigma^x_b \,du. \end{eqnarray}
on the time interval from \( s= t_0\) to \( t=t_0+\Delta t\).
Definition at line 644 of file crossassetanalytics.cpp.
Real com_com_covariance | ( | const CrossAssetModel & | model, |
const Size | i, | ||
const Size | j, | ||
const Time | t0, | ||
const Time | dt | ||
) |
COM-COM state variable covariance, mean-reverting single-factor case
\begin{eqnarray} Cov \left[\Delta Y_i, \Delta Y_j] \right] &=& \rho_{Y_i,Y_j} \int_{s}^{t} \sigma_{Y_i}(u) \exp(\kappa_i u) \sigma_{Y_j}(u) \exp(\kappa_j u) du\\ \end{eqnarray}
Definition at line 653 of file crossassetanalytics.cpp.
Real ir_com_covariance | ( | const CrossAssetModel & | model, |
const Size | i, | ||
const Size | j, | ||
const Time | t0, | ||
const Time | dt | ||
) |
TODO: COM covariance with all other risk factors
Definition at line 675 of file crossassetanalytics.cpp.
Real fx_com_covariance | ( | const CrossAssetModel & | model, |
const Size | i, | ||
const Size | j, | ||
const Time | t0, | ||
const Time | dt | ||
) |
Definition at line 682 of file crossassetanalytics.cpp.
Real infz_com_covariance | ( | const CrossAssetModel & | model, |
const Size | i, | ||
const Size | j, | ||
const Time | t0, | ||
const Time | dt | ||
) |
Definition at line 689 of file crossassetanalytics.cpp.
Real infy_com_covariance | ( | const CrossAssetModel & | model, |
const Size | i, | ||
const Size | j, | ||
const Time | t0, | ||
const Time | dt | ||
) |
Definition at line 696 of file crossassetanalytics.cpp.
Real cry_com_covariance | ( | const CrossAssetModel & | model, |
const Size | i, | ||
const Size | j, | ||
const Time | t0, | ||
const Time | dt | ||
) |
Definition at line 703 of file crossassetanalytics.cpp.
Real crz_com_covariance | ( | const CrossAssetModel & | model, |
const Size | i, | ||
const Size | j, | ||
const Time | t0, | ||
const Time | dt | ||
) |
Definition at line 710 of file crossassetanalytics.cpp.
Real eq_com_covariance | ( | const CrossAssetModel & | model, |
const Size | i, | ||
const Size | j, | ||
const Time | t0, | ||
const Time | dt | ||
) |
Definition at line 717 of file crossassetanalytics.cpp.
Real ir_crstate_covariance | ( | const CrossAssetModel & | model, |
const Size | i, | ||
const Size | j, | ||
const Time | t0, | ||
const Time | dt | ||
) |
IR_CrState Covariance
Definition at line 724 of file crossassetanalytics.cpp.
Real fx_crstate_covariance | ( | const CrossAssetModel & | model, |
const Size | i, | ||
const Size | j, | ||
const Time | t0, | ||
const Time | dt | ||
) |
FX_CrState Covariance
Definition at line 729 of file crossassetanalytics.cpp.
Real crstate_crstate_covariance | ( | const CrossAssetModel & | model, |
const Size | i, | ||
const Size | j, | ||
const Time | t0, | ||
const Time | dt | ||
) |
CrState_CrState Covariance
Definition at line 738 of file crossassetanalytics.cpp.
Real integral_helper | ( | const CrossAssetModel & | x, |
const E & | e, | ||
const Real | t | ||
) |
generic integrand
Definition at line 212 of file crossassetanalyticsbase.hpp.
Real integral | ( | const CrossAssetModel & | model, |
const E & | e, | ||
const Real | a, | ||
const Real | b | ||
) |
generic integral calculation
Definition at line 217 of file crossassetanalyticsbase.hpp.
const P2_< E1, E2 > P | ( | const E1 & | e1, |
const E2 & | e2 | ||
) |
creator function for product expression, 2 factors
Definition at line 97 of file crossassetanalyticsbase.hpp.
const P3_< E1, E2, E3 > P | ( | const E1 & | e1, |
const E2 & | e2, | ||
const E3 & | e3 | ||
) |
creator function for product expression, 3 factors
Definition at line 100 of file crossassetanalyticsbase.hpp.
const P4_< E1, E2, E3, E4 > P | ( | const E1 & | e1, |
const E2 & | e2, | ||
const E3 & | e3, | ||
const E4 & | e4 | ||
) |
creator function for product expression, 4 factors
Definition at line 106 of file crossassetanalyticsbase.hpp.
const P5_< E1, E2, E3, E4, E5 > P | ( | const E1 & | e1, |
const E2 & | e2, | ||
const E3 & | e3, | ||
const E4 & | e4, | ||
const E5 & | e5 | ||
) |
creator function for product expression, 5 factors
Definition at line 112 of file crossassetanalyticsbase.hpp.
const LC1_< E1 > LC | ( | QuantLib::Real | c, |
QuantLib::Real | c1, | ||
const E1 & | e1 | ||
) |
creator function for linear combination, 1 factor
Definition at line 188 of file crossassetanalyticsbase.hpp.
const LC2_< E1, E2 > LC | ( | QuantLib::Real | c, |
QuantLib::Real | c1, | ||
const E1 & | e1, | ||
QuantLib::Real | c2, | ||
const E2 & | e2 | ||
) |
creator function for linear combination, 2 factors
Definition at line 192 of file crossassetanalyticsbase.hpp.
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 | ||
) |
creator function for linear combination, 3 factors
Definition at line 198 of file crossassetanalyticsbase.hpp.
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 | ||
) |
creator function for linear combination, 4 factors
Definition at line 205 of file crossassetanalyticsbase.hpp.