Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
crossassetanalytics.cpp
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
21
22using std::make_pair;
23using std::pair;
24
25namespace QuantExt {
26
27namespace CrossAssetAnalytics {
28
29Real ir_expectation_1(const CrossAssetModel& x, const Size i, const Time t0, const Real dt) {
30 Real res = 0.0;
31 if (i == 0) {
33 res -= integral(x, P(Hz(i), az(i), az(i)), t0, t0 + dt);
34 } else {
35 res -= integral(x, P(Hz(i), az(i), az(i)), t0, t0 + dt);
36 res -= integral(x, P(az(i), sx(i - 1), rzx(i, i - 1)), t0, t0 + dt);
38 res += integral(x, P(Hz(0), az(0), az(i), rzz(0, i)), t0, t0 + dt);
39 }
40 return res;
41}
42
43Real ir_expectation_2(const CrossAssetModel&, const Size, const Real zi_0) { return zi_0; }
44
45pair<Real, Real> inf_jy_expectation_1(const CrossAssetModel& x, Size i, Time t0, Real dt) {
46
48 "inf_jy_expectation_1: should only be used for JY CAM inflation component.");
49
50 auto res = make_pair(0.0, 0.0);
51
52 // 1) Real rate process drift
53 res.first = -integral(x, P(Hy(i), ay(i), ay(i)), t0, t0 + dt) +
54 integral(x, P(rzy(0, i), Hz(0), az(0), ay(i)), t0, t0 + dt) -
55 integral(x, P(ryy(i, i, 0, 1), ay(i), sy(i)), t0, t0 + dt);
56
57 // i_i - index of i-th inflation component's currency.
58 Size i_i = x.ccyIndex(x.infjy(i)->currency());
59 if (i_i > 0) {
60 res.first -= integral(x, P(rxy(i_i - 1, i, 0), ay(i), sx(i_i - 1)), t0, t0 + dt);
61 }
62
63 // 2) Inflation index process drift
64 const auto& zts = x.infjy(i)->realRate()->termStructure();
65 bool indexIsInterpolated = true; // FIXME, see also crossassetmodel.cpp line 706ff
66 res.second =
67 std::log(inflationGrowth(zts, t0 + dt, indexIsInterpolated) / inflationGrowth(zts, t0, indexIsInterpolated));
68
69 res.second -= 0.5 * (vy(i).eval(x, t0 + dt) - vy(i).eval(x, t0));
70
71 // Final _s means start of period i.e. t_0 and _e means end of period i.e. t_0 + dt
72 Real Hi_i_s = Hz(i_i).eval(x, t0);
73 Real Hi_s = Hy(i).eval(x, t0);
74 Real Hi_i_e = Hz(i_i).eval(x, t0 + dt);
75 Real Hi_e = Hy(i).eval(x, t0 + dt);
76 Real zetai_i_s = zetaz(i_i).eval(x, t0);
77 Real zetai_s = zetay(i).eval(x, t0);
78 Real zetai_i_e = zetaz(i_i).eval(x, t0 + dt);
79 Real zetai_e = zetay(i).eval(x, t0 + dt);
80 res.second += 0.5 * (Hi_i_e * Hi_i_e * zetai_i_e - Hi_i_s * Hi_i_s * zetai_i_s);
81 res.second -= 0.5 * integral(x, P(Hz(i_i), Hz(i_i), az(i_i), az(i_i)), t0, t0 + dt);
82 res.second -= 0.5 * (Hi_e * Hi_e * zetai_e - Hi_s * Hi_s * zetai_s);
83 res.second += 0.5 * integral(x, P(Hy(i), Hy(i), ay(i), ay(i)), t0, t0 + dt);
84
85 res.second += integral(x, P(rzy(0, i, 1), Hz(0), az(0), sy(i)), t0, t0 + dt);
86
87 res.second -=
88 integral(x,
89 P(LC(Hi_e, -1.0, Hy(i)), LC(0.0, -1.0, P(Hy(i), ay(i), ay(i)), 1.0, P(Hz(0), az(0), ay(i), rzy(0, i)),
90 -1.0, P(ryy(i, i, 0, 1), ay(i), sy(i)))),
91 t0, t0 + dt);
92
93 if (i_i > 0) {
94 res.second += integral(x,
95 P(LC(Hi_i_e, -1.0, Hz(i_i)),
96 LC(0.0, -1.0, P(Hz(i_i), az(i_i), az(i_i)), 1.0, P(Hz(0), az(0), az(i_i), rzz(0, i_i)),
97 -1.0, P(rzx(i_i, i_i - 1), az(i_i), sx(i_i - 1)))),
98 t0, t0 + dt);
99 res.second -= integral(x, P(rxy(i_i - 1, i, 1), sy(i), sx(i_i - 1)), t0, t0 + dt);
100 res.second += integral(x, P(LC(Hi_e, -1.0, Hy(i)), ay(i), sx(i_i - 1), rxy(i_i - 1, i)), t0, t0 + dt);
101 }
102
103 return res;
104}
105
106pair<Real, Real> inf_jy_expectation_2(const CrossAssetModel& x, Size i, Time t0, const pair<Real, Real>& state_0,
107 Real zi_i_0, Real dt) {
108
110 "inf_jy_expectation_2: should only be used for JY CAM inflation component.");
111
112 // i_i - index of i-th inflation component's currency.
113 Size i_i = x.ccyIndex(x.infjy(i)->currency());
114
115 // Real rate portion of the result i.e. first element in pair is not state dependent so nothing needed.
116 // The inflation index portion of the result i.e. second element needs to be updated.
117 auto res = state_0;
118 res.second += (Hz(i_i).eval(x, t0 + dt) - Hz(i_i).eval(x, t0)) * zi_i_0;
119 res.second -= (Hy(i).eval(x, t0 + dt) - Hy(i).eval(x, t0)) * state_0.first;
120
121 return res;
122}
123
124Real fx_expectation_1(const CrossAssetModel& x, const Size i, const Time t0, const Real dt) {
125 bool bam = (x.measure() == IrModel::Measure::BA);
126 Real H0_a = Hz(0).eval(x, t0);
127 Real Hi_a = Hz(i + 1).eval(x, t0);
128 Real H0_b = Hz(0).eval(x, t0 + dt);
129 Real Hi_b = Hz(i + 1).eval(x, t0 + dt);
130 Real zeta0_a = zetaz(0).eval(x, t0);
131 Real zetai_a = zetaz(i + 1).eval(x, t0);
132 Real zeta0_b = zetaz(0).eval(x, t0 + dt);
133 Real zetai_b = zetaz(i + 1).eval(x, t0 + dt);
134 Real res = std::log(x.irlgm1f(i + 1)->termStructure()->discount(t0 + dt) /
135 x.irlgm1f(i + 1)->termStructure()->discount(t0) * x.irlgm1f(0)->termStructure()->discount(t0) /
136 x.irlgm1f(0)->termStructure()->discount(t0 + dt));
137 res -= 0.5 * (vx(i).eval(x, t0 + dt) - vx(i).eval(x, t0));
138 res +=
139 0.5 * (H0_b * H0_b * zeta0_b - H0_a * H0_a * zeta0_a - integral(x, P(Hz(0), Hz(0), az(0), az(0)), t0, t0 + dt));
140 res -= 0.5 * (Hi_b * Hi_b * zetai_b - Hi_a * Hi_a * zetai_a -
141 integral(x, P(Hz(i + 1), Hz(i + 1), az(i + 1), az(i + 1)), t0, t0 + dt));
142 res += (bam ? 0.0 : integral(x, P(Hz(0), az(0), sx(i), rzx(0, i)), t0, t0 + dt));
143 res -= Hi_b * (-integral(x, P(Hz(i + 1), az(i + 1), az(i + 1)), t0, t0 + dt) +
144 (bam ? 0.0 : integral(x, P(Hz(0), az(0), az(i + 1), rzz(0, i + 1)), t0, t0 + dt)) -
145 integral(x, P(az(i + 1), sx(i), rzx(i + 1, i)), t0, t0 + dt));
146 res += -integral(x, P(Hz(i + 1), Hz(i + 1), az(i + 1), az(i + 1)), t0, t0 + dt) +
147 (bam ? 0.0 : integral(x, P(Hz(0), Hz(i + 1), az(0), az(i + 1), rzz(0, i + 1)), t0, t0 + dt)) -
148 integral(x, P(Hz(i + 1), az(i + 1), sx(i), rzx(i + 1, i)), t0, t0 + dt);
149 if (bam) {
150 res -= H0_b * integral(x, P(Hz(0), az(0), az(0)), t0, t0 + dt);
151 res += integral(x, P(Hz(0), Hz(0), az(0), az(0)), t0, t0 + dt);
152 }
153 return res;
154}
155
156Real fx_expectation_2(const CrossAssetModel& x, const Size i, const Time t0, const Real xi_0, const Real zi_0,
157 const Real z0_0, const Real dt) {
158 Real res = xi_0 + (Hz(0).eval(x, t0 + dt) - Hz(0).eval(x, t0)) * z0_0 -
159 (Hz(i + 1).eval(x, t0 + dt) - Hz(i + 1).eval(x, t0)) * zi_0;
160 return res;
161}
162
163Real eq_expectation_1(const CrossAssetModel& x, const Size k, const Time t0, const Real dt) {
164 Size i = x.ccyIndex(x.eqbs(k)->currency());
165 Size eps_i = (i == 0) ? 0 : 1;
166 Real Hi_a = Hz(i).eval(x, t0);
167 Real Hi_b = Hz(i).eval(x, t0 + dt);
168 Real zetai_a = zetaz(i).eval(x, t0);
169 Real zetai_b = zetaz(i).eval(x, t0 + dt);
170 Real res = std::log(
171 x.eqbs(k)->equityDivYieldCurveToday()->discount(t0 + dt) / x.eqbs(k)->equityDivYieldCurveToday()->discount(t0) *
172 x.eqbs(k)->equityIrCurveToday()->discount(t0) / x.eqbs(k)->equityIrCurveToday()->discount(t0 + dt));
173 res -= 0.5 * (vs(k).eval(x, t0 + dt) - vs(k).eval(x, t0));
174 res +=
175 0.5 * (Hi_b * Hi_b * zetai_b - Hi_a * Hi_a * zetai_a - integral(x, P(Hz(i), Hz(i), az(i), az(i)), t0, t0 + dt));
176 res += integral(x, P(rzs(0, k), Hz(0), az(0), ss(k)), t0, t0 + dt);
177 if (eps_i > 0) {
178 res -= integral(x, P(rxs(i - 1, k), sx(i - 1), ss(k)), t0, t0 + dt);
179 }
180 // expand gamma term
181 if (eps_i > 0) {
182 res += Hi_b * (-integral(x, P(Hz(i), az(i), az(i)), t0, t0 + dt) -
183 integral(x, P(rzx(i, i - 1), sx(i - 1), az(i)), t0, t0 + dt) +
184 integral(x, P(rzz(0, i), az(i), az(0), Hz(0)), t0, t0 + dt));
185 res -= (-integral(x, P(Hz(i), Hz(i), az(i), az(i)), t0, t0 + dt) -
186 integral(x, P(Hz(i), rzx(i, i - 1), sx(i - 1), az(i)), t0, t0 + dt) +
187 integral(x, P(Hz(i), rzz(0, i), az(i), az(0), Hz(0)), t0, t0 + dt));
188 }
189 return res;
190}
191
192Real eq_expectation_2(const CrossAssetModel& x, const Size k, const Time t0, const Real sk_0, const Real zi_0,
193 const Real dt) {
194 Size i = x.ccyIndex(x.eqbs(k)->currency());
195 Real Hi_a = Hz(i).eval(x, t0);
196 Real Hi_b = Hz(i).eval(x, t0 + dt);
197 Real res = sk_0 + (Hi_b - Hi_a) * zi_0;
198 return res;
199}
200
201Real ir_ir_covariance(const CrossAssetModel& x, const Size i, const Size j, const Time t0, const Time dt) {
202 Real res = integral(x, P(az(i), az(j), rzz(i, j)), t0, t0 + dt);
203 return res;
204}
205
206Real ir_fx_covariance(const CrossAssetModel& x, const Size i, const Size j, const Time t0, const Time dt) {
207 Real res = Hz(0).eval(x, t0 + dt) * integral(x, P(az(0), az(i), rzz(0, i)), t0, t0 + dt) -
208 integral(x, P(Hz(0), az(0), az(i), rzz(0, i)), t0, t0 + dt) -
209 Hz(j + 1).eval(x, t0 + dt) * integral(x, P(az(j + 1), az(i), rzz(j + 1, i)), t0, t0 + dt) +
210 integral(x, P(Hz(j + 1), az(j + 1), az(i), rzz(j + 1, i)), t0, t0 + dt) +
211 integral(x, P(az(i), sx(j), rzx(i, j)), t0, t0 + dt);
212 return res;
213}
214
215Real fx_fx_covariance(const CrossAssetModel& x, const Size i, const Size j, const Time t0, const Time dt) {
216 Real H0 = Hz(0).eval(x, t0 + dt);
217 Real Hi = Hz(i + 1).eval(x, t0 + dt);
218 Real Hj = Hz(j + 1).eval(x, t0 + dt);
219 Real res =
220 // row 1
221 H0 * H0 * (zetaz(0).eval(x, t0 + dt) - zetaz(0).eval(x, t0)) -
222 2.0 * H0 * integral(x, P(Hz(0), az(0), az(0)), t0, t0 + dt) +
223 integral(x, P(Hz(0), Hz(0), az(0), az(0)), t0, t0 + dt) -
224 // row 2
225 H0 * Hj * integral(x, P(az(0), az(j + 1), rzz(0, j + 1)), t0, t0 + dt) +
226 Hj * integral(x, P(Hz(0), az(0), az(j + 1), rzz(0, j + 1)), t0, t0 + dt) +
227 H0 * integral(x, P(Hz(j + 1), az(j + 1), az(0), rzz(j + 1, 0)), t0, t0 + dt) -
228 integral(x, P(Hz(0), Hz(j + 1), az(0), az(j + 1), rzz(0, j + 1)), t0, t0 + dt) -
229 // row 3
230 H0 * Hi * integral(x, P(az(0), az(i + 1), rzz(0, i + 1)), t0, t0 + dt) +
231 Hi * integral(x, P(Hz(0), az(0), az(i + 1), rzz(0, i + 1)), t0, t0 + dt) +
232 H0 * integral(x, P(Hz(i + 1), az(i + 1), az(0), rzz(i + 1, 0)), t0, t0 + dt) -
233 integral(x, P(Hz(0), Hz(i + 1), az(0), az(i + 1), rzz(0, i + 1)), t0, t0 + dt) +
234 // row 4
235 H0 * integral(x, P(az(0), sx(j), rzx(0, j)), t0, t0 + dt) -
236 integral(x, P(Hz(0), az(0), sx(j), rzx(0, j)), t0, t0 + dt) +
237 // row 5
238 H0 * integral(x, P(az(0), sx(i), rzx(0, i)), t0, t0 + dt) -
239 integral(x, P(Hz(0), az(0), sx(i), rzx(0, i)), t0, t0 + dt) -
240 // row 6
241 Hi * integral(x, P(az(i + 1), sx(j), rzx(i + 1, j)), t0, t0 + dt) +
242 integral(x, P(Hz(i + 1), az(i + 1), sx(j), rzx(i + 1, j)), t0, t0 + dt) -
243 // row 7
244 Hj * integral(x, P(az(j + 1), sx(i), rzx(j + 1, i)), t0, t0 + dt) +
245 integral(x, P(Hz(j + 1), az(j + 1), sx(i), rzx(j + 1, i)), t0, t0 + dt) +
246 // row 8
247 Hi * Hj * integral(x, P(az(i + 1), az(j + 1), rzz(i + 1, j + 1)), t0, t0 + dt) -
248 Hj * integral(x, P(Hz(i + 1), az(i + 1), az(j + 1), rzz(i + 1, j + 1)), t0, t0 + dt) -
249 Hi * integral(x, P(Hz(j + 1), az(j + 1), az(i + 1), rzz(j + 1, i + 1)), t0, t0 + dt) +
250 integral(x, P(Hz(i + 1), Hz(j + 1), az(i + 1), az(j + 1), rzz(i + 1, j + 1)), t0, t0 + dt) +
251 // row 9
252 integral(x, P(sx(i), sx(j), rxx(i, j)), t0, t0 + dt);
253 return res;
254}
255
256Real infz_infz_covariance(const CrossAssetModel& x, const Size i, const Size j, const Time t0, const Time dt) {
257 return integral(x, P(ryy(i, j), ay(i), ay(j)), t0, t0 + dt);
258 ;
259}
260
261Real infz_infy_covariance(const CrossAssetModel& x, const Size i, const Size j, const Time t0, const Time dt) {
262
263 Real res = 0.0;
264
265 // Assumption that INF is either JY or DK. j-th inflation model's y component depends on model type.
267 res = integral(x, P(ryy(i, j), ay(i), Hy(j), ay(j)), t0, t0 + dt);
268 } else {
269 // i_j - index of j-th inflation component's currency.
270 Size i_j = x.ccyIndex(x.infjy(j)->currency());
271 // H_{i_j}^{z}(t_0 + dt)
272 Real Hi_j = Hz(i_j).eval(x, t0 + dt);
273 // H_{j}^{y}(t_0 + dt)
274 Real Hj = Hy(j).eval(x, t0 + dt);
275
276 res = integral(x, P(rzy(i_j, i), az(i_j), ay(i), LC(Hi_j, -1.0, Hz(i_j))), t0, t0 + dt);
277 res -= integral(x, P(ryy(i, j), ay(i), ay(j), LC(Hj, -1.0, Hy(j))), t0, t0 + dt);
278 res += integral(x, P(ryy(i, j, 0, 1), ay(i), sy(j)), t0, t0 + dt);
279 }
280
281 return res;
282}
283
284Real infy_infy_covariance(const CrossAssetModel& x, const Size i, const Size j, const Time t0, const Time dt) {
285
286 Real res = 0.0;
287
288 // Assumption that INF is either JY or DK. Four possibilities.
292 res = integral(x, P(ryy(i, j), Hy(i), ay(i), Hy(j), ay(j)), t0, t0 + dt);
294
295 // i_i - index of i-th inflation component's currency.
296 Size i_i = x.ccyIndex(x.infjy(i)->currency());
297 // H_{i_i}^{z}(t_0 + dt)
298 Real Hi_i = Hz(i_i).eval(x, t0 + dt);
299 // H_{i}^{y}(t_0 + dt)
300 Real Hi = Hy(i).eval(x, t0 + dt);
301
302 // 3 terms in the covariance.
303 res = integral(x, P(rzy(i_i, j), Hy(j), ay(j), az(i_i), LC(Hi_i, -1.0, Hz(i_i))), t0, t0 + dt);
304 res -= integral(x, P(ryy(i, j, 0, 0), Hy(j), ay(j), ay(i), LC(Hi, -1.0, Hy(i))), t0, t0 + dt);
305 res += integral(x, P(ryy(i, j, 1, 0), Hy(j), ay(j), sy(i)), t0, t0 + dt);
306
308
309 // i_j - index of j-th inflation component's currency.
310 Size i_j = x.ccyIndex(x.infjy(j)->currency());
311 // H_{i_j}^{z}(t_0 + dt)
312 Real Hi_j = Hz(i_j).eval(x, t0 + dt);
313 // H_{j}^{y}(t_0 + dt)
314 Real Hj = Hy(j).eval(x, t0 + dt);
315
316 // 3 terms in the covariance.
317 res = integral(x, P(rzy(i_j, i), Hy(i), ay(i), az(i_j), LC(Hi_j, -1.0, Hz(i_j))), t0, t0 + dt);
318 res -= integral(x, P(ryy(i, j, 0, 0), Hy(i), ay(i), ay(j), LC(Hj, -1.0, Hy(j))), t0, t0 + dt);
319 res += integral(x, P(ryy(i, j, 0, 1), Hy(i), ay(i), sy(j)), t0, t0 + dt);
320
321 } else {
322
323 // index of each inflation component's currency.
324 Size i_i = x.ccyIndex(x.infjy(i)->currency());
325 Size i_j = x.ccyIndex(x.infjy(j)->currency());
326 // H_{i_\cdot}^{z}(t_0 + dt)
327 Real Hi_i = Hz(i_i).eval(x, t0 + dt);
328 Real Hi_j = Hz(i_j).eval(x, t0 + dt);
329 // H_{\cdot}^{y}(t_0 + dt)
330 Real Hi = Hy(i).eval(x, t0 + dt);
331 Real Hj = Hy(j).eval(x, t0 + dt);
332
333 res = integral(x, P(rzz(i_i, i_j), az(i_i), LC(Hi_i, -1.0, Hz(i_i)), az(i_j), LC(Hi_j, -1.0, Hz(i_j))), t0,
334 t0 + dt);
335 res -=
336 integral(x, P(rzy(i_i, j, 0), az(i_i), LC(Hi_i, -1.0, Hz(i_i)), ay(j), LC(Hj, -1.0, Hy(j))), t0, t0 + dt);
337 res += integral(x, P(rzy(i_i, j, 1), az(i_i), LC(Hi_i, -1.0, Hz(i_i)), sy(j)), t0, t0 + dt);
338 res -=
339 integral(x, P(rzy(i_j, i, 0), ay(i), LC(Hi, -1.0, Hy(i)), az(i_j), LC(Hi_j, -1.0, Hz(i_j))), t0, t0 + dt);
340 res += integral(x, P(ryy(i, j), ay(i), LC(Hi, -1.0, Hy(i)), ay(j), LC(Hj, -1.0, Hy(j))), t0, t0 + dt);
341 res -= integral(x, P(ryy(i, j, 0, 1), ay(i), LC(Hi, -1.0, Hy(i)), sy(j)), t0, t0 + dt);
342 res += integral(x, P(rzy(i_j, i, 1), sy(i), az(i_j), LC(Hi_j, -1.0, Hz(i_j))), t0, t0 + dt);
343 res -= integral(x, P(ryy(i, j, 1, 0), sy(i), ay(j), LC(Hj, -1.0, Hy(j))), t0, t0 + dt);
344 res += integral(x, P(ryy(i, j, 1, 1), sy(i), sy(j)), t0, t0 + dt);
345 }
346
347 return res;
348}
349
350Real ir_infz_covariance(const CrossAssetModel& x, const Size i, const Size j, const Time t0, const Time dt) {
351 return integral(x, P(rzy(i, j), az(i), ay(j)), t0, t0 + dt);
352}
353
354Real ir_infy_covariance(const CrossAssetModel& x, const Size i, const Size j, const Time t0, const Time dt) {
355 // Assumption that INF is either JY or DK.
357 return integral(x, P(rzy(i, j), az(i), Hy(j), ay(j)), t0, t0 + dt);
358 } else {
359 // i_j - index of j-th inflation component's currency.
360 Size i_j = x.ccyIndex(x.infjy(j)->currency());
361 // H_{i_j}^{z}(t_0 + dt)
362 Real Hi_j = Hz(i_j).eval(x, t0 + dt);
363 // H_{j}^{y}(t_0 + dt)
364 Real Hj = Hy(j).eval(x, t0 + dt);
365
366 Real res = integral(x, P(rzz(i, i_j), az(i), az(i_j), LC(Hi_j, -1.0, Hz(i_j))), t0, t0 + dt);
367 res -= integral(x, P(rzy(i, j, 0), az(i), ay(j), LC(Hj, -1.0, Hy(j))), t0, t0 + dt);
368 res += integral(x, P(rzy(i, j, 1), az(i), sy(j)), t0, t0 + dt);
369
370 return res;
371 }
372}
373
374Real fx_infz_covariance(const CrossAssetModel& x, const Size i, const Size j, const Time t0, const Time dt) {
375 Real H0 = Hz(0).eval(x, t0 + dt);
376 Real Hi = Hz(i + 1).eval(x, t0 + dt);
377 Real res = -integral(x, P(rzy(0, j), Hz(0), az(0), ay(j)), t0, t0 + dt) +
378 H0 * integral(x, P(rzy(0, j), az(0), ay(j)), t0, t0 + dt) +
379 integral(x, P(rzy(i + 1, j), Hz(i + 1), az(i + 1), ay(j)), t0, t0 + dt) -
380 Hi * integral(x, P(rzy(i + 1, j), az(i + 1), ay(j)), t0, t0 + dt) +
381 integral(x, P(rxy(i, j), sx(i), ay(j)), t0, t0 + dt);
382 return res;
383}
384
385Real fx_infy_covariance(const CrossAssetModel& x, const Size i, const Size j, const Time t0, const Time dt) {
386
387 Real res = 0.0;
388 Real H0 = Hz(0).eval(x, t0 + dt);
389 Real Hi = Hz(i + 1).eval(x, t0 + dt);
390
392 res = -integral(x, P(rzy(0, j), Hz(0), az(0), Hy(j), ay(j)), t0, t0 + dt) +
393 H0 * integral(x, P(rzy(0, j), az(0), Hy(j), ay(j)), t0, t0 + dt) +
394 integral(x, P(rzy(i + 1, j), Hz(i + 1), az(i + 1), Hy(j), ay(j)), t0, t0 + dt) -
395 Hi * integral(x, P(rzy(i + 1, j), az(i + 1), Hy(j), ay(j)), t0, t0 + dt) +
396 integral(x, P(rxy(i, j), sx(i), Hy(j), ay(j)), t0, t0 + dt);
397 } else {
398
399 // i_j - index of j-th inflation component's currency.
400 Size i_j = x.ccyIndex(x.infjy(j)->currency());
401 // H_{i_j}^{z}(t_0 + dt)
402 Real Hi_j = Hz(i_j).eval(x, t0 + dt);
403 // H_{j}^{y}(t_0 + dt)
404 Real Hj = Hy(j).eval(x, t0 + dt);
405
406 res = integral(x, P(rzz(i_j, 0), az(i_j), LC(Hi_j, -1.0, Hz(i_j)), az(0), LC(H0, -1.0, Hz(0))), t0, t0 + dt);
407 res -= integral(x, P(rzz(i_j, i + 1), az(i_j), LC(Hi_j, -1.0, Hz(i_j)), az(i + 1), LC(Hi, -1.0, Hz(i + 1))), t0,
408 t0 + dt);
409 res += integral(x, P(rzx(i_j, i), az(i_j), LC(Hi_j, -1.0, Hz(i_j)), sx(i)), t0, t0 + dt);
410 res -= integral(x, P(rzy(0, j, 0), ay(j), LC(Hj, -1.0, Hy(j)), az(0), LC(H0, -1.0, Hz(0))), t0, t0 + dt);
411 res += integral(x, P(rzy(i + 1, j, 0), ay(j), LC(Hj, -1.0, Hy(j)), az(i + 1), LC(Hi, -1.0, Hz(i + 1))), t0,
412 t0 + dt);
413 res -= integral(x, P(rxy(i, j), ay(j), LC(Hj, -1.0, Hy(j)), sx(i)), t0, t0 + dt);
414 res += integral(x, P(rzy(0, j, 1), sy(j), az(0), LC(H0, -1.0, Hz(0))), t0, t0 + dt);
415 res -= integral(x, P(rzy(i + 1, j, 1), sy(j), az(i + 1), LC(Hi, -1.0, Hz(i + 1))), t0, t0 + dt);
416 res += integral(x, P(rxy(i, j, 1), sx(i), sy(j)), t0, t0 + dt);
417 }
418
419 return res;
420}
421
422Real crz_crz_covariance(const CrossAssetModel& x, const Size i, const Size j, const Time t0, const Time dt) {
423 Real res = integral(x, P(rll(i, j), al(i), al(j)), t0, t0 + dt);
424 return res;
425}
426
427Real crz_cry_covariance(const CrossAssetModel& x, const Size i, const Size j, const Time t0, const Time dt) {
428 Real res = integral(x, P(rll(i, j), al(i), Hl(j), al(j)), t0, t0 + dt);
429 return res;
430}
431
432Real cry_cry_covariance(const CrossAssetModel& x, const Size i, const Size j, const Time t0, const Time dt) {
433 Real res = integral(x, P(rll(i, j), Hl(i), al(i), Hl(j), al(j)), t0, t0 + dt);
434 return res;
435}
436
437Real ir_crz_covariance(const CrossAssetModel& x, const Size i, const Size j, const Time t0, const Time dt) {
438 Real res = integral(x, P(rzl(i, j), az(i), al(j)), t0, t0 + dt);
439 return res;
440}
441
442Real ir_cry_covariance(const CrossAssetModel& x, const Size i, const Size j, const Time t0, const Time dt) {
443 Real res = integral(x, P(rzl(i, j), az(i), Hl(j), al(j)), t0, t0 + dt);
444 return res;
445}
446
447Real fx_crz_covariance(const CrossAssetModel& x, const Size i, const Size j, const Time t0, const Time dt) {
448 Real H0 = Hz(0).eval(x, t0 + dt);
449 Real Hi = Hz(i + 1).eval(x, t0 + dt);
450 Real res = -integral(x, P(rzl(0, j), Hz(0), az(0), al(j)), t0, t0 + dt) +
451 H0 * integral(x, P(rzl(0, j), az(0), al(j)), t0, t0 + dt) +
452 integral(x, P(rzl(i + 1, j), Hz(i + 1), az(i + 1), al(j)), t0, t0 + dt) -
453 Hi * integral(x, P(rzl(i + 1, j), az(i + 1), al(j)), t0, t0 + dt) +
454 integral(x, P(rxl(i, j), sx(i), al(j)), t0, t0 + dt);
455 return res;
456}
457
458Real fx_cry_covariance(const CrossAssetModel& x, const Size i, const Size j, const Time t0, const Time dt) {
459 Real H0 = Hz(0).eval(x, t0 + dt);
460 Real Hi = Hz(i + 1).eval(x, t0 + dt);
461 Real res = -integral(x, P(rzl(0, j), Hz(0), az(0), Hl(j), al(j)), t0, t0 + dt) +
462 H0 * integral(x, P(rzl(0, j), az(0), Hl(j), al(j)), t0, t0 + dt) +
463 integral(x, P(rzl(i + 1, j), Hz(i + 1), az(i + 1), Hl(j), al(j)), t0, t0 + dt) -
464 Hi * integral(x, P(rzl(i + 1, j), az(i + 1), Hl(j), al(j)), t0, t0 + dt) +
465 integral(x, P(rxl(i, j), sx(i), Hl(j), al(j)), t0, t0 + dt);
466 return res;
467}
468
469Real infz_crz_covariance(const CrossAssetModel& x, const Size i, const Size j, const Time t0, const Time dt) {
470 Real res = integral(x, P(ryl(i, j), ay(i), al(j)), t0, t0 + dt);
471 return res;
472}
473
474Real infz_cry_covariance(const CrossAssetModel& x, const Size i, const Size j, const Time t0, const Time dt) {
475 Real res = integral(x, P(ryl(i, j), ay(i), Hl(j), al(j)), t0, t0 + dt);
476 return res;
477}
478
479Real infy_crz_covariance(const CrossAssetModel& x, const Size i, const Size j, const Time t0, const Time dt) {
480
481 Real res = 0.0;
483 res = integral(x, P(ryl(i, j), Hy(i), ay(i), al(j)), t0, t0 + dt);
484 } else {
485
486 // i_i - index of i-th inflation component's currency.
487 Size i_i = x.ccyIndex(x.infjy(i)->currency());
488 // H_{i_i}^{z}(t_0 + dt)
489 Real Hi_i = Hz(i_i).eval(x, t0 + dt);
490 // H_{i}^{y}(t_0 + dt)
491 Real Hi = Hy(i).eval(x, t0 + dt);
492
493 res = integral(x, P(rzl(i_i, j), az(i_i), LC(Hi_i, -1.0, Hz(i_i)), al(j)), t0, t0 + dt);
494 res -= integral(x, P(ryl(i, j, 0), ay(i), LC(Hi, -1.0, Hy(i)), al(j)), t0, t0 + dt);
495 res += integral(x, P(ryl(i, j, 1), sy(i), al(j)), t0, t0 + dt);
496 }
497
498 return res;
499}
500
501Real infy_cry_covariance(const CrossAssetModel& x, const Size i, const Size j, const Time t0, const Time dt) {
502
503 Real res = 0.0;
505 res = integral(x, P(ryl(i, j), Hy(i), ay(i), Hl(j), al(j)), t0, t0 + dt);
506 } else {
507
508 // i_i - index of i-th inflation component's currency.
509 Size i_i = x.ccyIndex(x.infjy(i)->currency());
510 // H_{i_i}^{z}(t_0 + dt)
511 Real Hi_i = Hz(i_i).eval(x, t0 + dt);
512 // H_{i}^{y}(t_0 + dt)
513 Real Hi = Hy(i).eval(x, t0 + dt);
514
515 res = integral(x, P(rzl(i_i, j), az(i_i), LC(Hi_i, -1.0, Hz(i_i)), Hl(j), al(j)), t0, t0 + dt);
516 res -= integral(x, P(ryl(i, j, 0), ay(i), LC(Hi, -1.0, Hy(i)), Hl(j), al(j)), t0, t0 + dt);
517 res += integral(x, P(ryl(i, j, 1), sy(i), Hl(j), al(j)), t0, t0 + dt);
518 }
519
520 return res;
521}
522
523Real ir_eq_covariance(const CrossAssetModel& x, const Size j, const Size k, const Time t0, const Time dt) {
524 Size i = x.ccyIndex(x.eqbs(k)->currency()); // the equity underlying currency
525 Real Hi_b = Hz(i).eval(x, t0 + dt);
526 Real res = Hi_b * integral(x, P(rzz(i, j), az(i), az(j)), t0, t0 + dt);
527 res -= integral(x, P(Hz(i), rzz(i, j), az(i), az(j)), t0, t0 + dt);
528 res += integral(x, P(rzs(j, k), az(j), ss(k)), t0, t0 + dt);
529 return res;
530}
531
532Real fx_eq_covariance(const CrossAssetModel& x, const Size j, const Size k, const Time t0, const Time dt) {
533 Size i = x.ccyIndex(x.eqbs(k)->currency()); // the equity underlying currency
534 const Size& j_lgm = j + 1; // indexing of the FX currency for extracting the LGM terms
535 Real Hi_b = Hz(i).eval(x, t0 + dt);
536 Real Hj_b = Hz(j_lgm).eval(x, t0 + dt);
537 Real H0_b = Hz(0).eval(x, t0 + dt);
538 Real res = 0.;
539 res += Hi_b * H0_b * integral(x, P(rzz(0, i), az(0), az(i)), t0, t0 + dt);
540 res -= Hi_b * integral(x, P(Hz(0), rzz(0, i), az(0), az(i)), t0, t0 + dt);
541 res -= H0_b * integral(x, P(Hz(i), rzz(0, i), az(0), az(i)), t0, t0 + dt);
542 res += integral(x, P(Hz(0), Hz(i), rzz(0, i), az(0), az(i)), t0, t0 + dt);
543 res -= Hi_b * Hj_b * integral(x, P(rzz(j_lgm, i), az(j_lgm), az(i)), t0, t0 + dt);
544 res += Hi_b * integral(x, P(Hz(j_lgm), rzz(j_lgm, i), az(j_lgm), az(i)), t0, t0 + dt);
545 res += Hj_b * integral(x, P(Hz(i), rzz(j_lgm, i), az(j_lgm), az(i)), t0, t0 + dt);
546 res -= integral(x, P(Hz(j_lgm), Hz(i), rzz(j_lgm, i), az(j_lgm), az(i)), t0, t0 + dt);
547
548 res += Hi_b * integral(x, P(rzx(i, j), sx(j), az(i)), t0, t0 + dt);
549 res -= integral(x, P(Hz(i), rzx(i, j), sx(j), az(i)), t0, t0 + dt);
550
551 res += H0_b * integral(x, P(rzs(0, k), az(0), ss(k)), t0, t0 + dt);
552 res -= integral(x, P(Hz(0), rzs(0, k), az(0), ss(k)), t0, t0 + dt);
553 res -= Hj_b * integral(x, P(rzs(j_lgm, k), az(j_lgm), ss(k)), t0, t0 + dt);
554 res += integral(x, P(Hz(j_lgm), rzs(j_lgm, k), az(j_lgm), ss(k)), t0, t0 + dt);
555
556 res += integral(x, P(rxs(j, k), sx(j), ss(k)), t0, t0 + dt);
557 return res;
558}
559
560Real infz_eq_covariance(const CrossAssetModel& x, const Size i, const Size j, const Time t0, const Time dt) {
561 Size k = x.ccyIndex(x.eqbs(j)->currency());
562 Real Hk = Hz(k).eval(x, t0 + dt);
563 Real res = Hk * integral(x, P(rzy(k, i), az(k), ay(i)), t0, t0 + dt) -
564 integral(x, P(rzy(k, i), Hz(k), az(k), ay(i)), t0, t0 + dt) +
565 integral(x, P(rys(i, j), ay(i), ss(j)), t0, t0 + dt);
566 return res;
567}
568
569Real infy_eq_covariance(const CrossAssetModel& x, const Size i, const Size j, const Time t0, const Time dt) {
570
571 Size k = x.ccyIndex(x.eqbs(j)->currency());
572 Real Hk = Hz(k).eval(x, t0 + dt);
573
574 Real res = 0.0;
576 res = Hk * integral(x, P(rzy(k, i), az(k), Hy(i), ay(i)), t0, t0 + dt) -
577 integral(x, P(rzy(k, i), Hz(k), az(k), Hy(i), ay(i)), t0, t0 + dt) +
578 integral(x, P(rys(i, j), Hy(i), ay(i), ss(j)), t0, t0 + dt);
579 } else {
580
581 // i_i - index of i-th inflation component's currency.
582 Size i_i = x.ccyIndex(x.infjy(i)->currency());
583 // H_{i_i}^{z}(t_0 + dt)
584 Real Hi_i = Hz(i_i).eval(x, t0 + dt);
585 // H_{i}^{y}(t_0 + dt)
586 Real Hi = Hy(i).eval(x, t0 + dt);
587
588 res = integral(x, P(rzz(i_i, k), az(i_i), LC(Hi_i, -1.0, Hz(i_i)), az(k), LC(Hk, -1.0, Hz(k))), t0, t0 + dt);
589 res += integral(x, P(rzs(i_i, j), az(i_i), LC(Hi_i, -1.0, Hz(i_i)), ss(j)), t0, t0 + dt);
590 res -= integral(x, P(rzy(k, i, 0), ay(i), LC(Hi, -1.0, Hy(i)), az(k), LC(Hk, -1.0, Hz(k))), t0, t0 + dt);
591 res -= integral(x, P(rys(i, j, 0), ay(i), LC(Hi, -1.0, Hy(i)), ss(j)), t0, t0 + dt);
592 res += integral(x, P(rzy(k, i, 1), sy(i), az(k), LC(Hk, -1.0, Hz(k))), t0, t0 + dt);
593 res += integral(x, P(rys(i, j, 1), sy(i), ss(j)), t0, t0 + dt);
594 }
595
596 return res;
597}
598
599Real crz_eq_covariance(const CrossAssetModel& x, const Size i, const Size j, const Time t0, const Time dt) {
600 Size k = x.ccyIndex(x.eqbs(j)->currency());
601 Real Hk_b = Hz(k).eval(x, t0 + dt);
602 Real res = Hk_b * integral(x, P(rzl(k, i), az(k), al(i)), t0, t0 + dt) -
603 integral(x, P(rzl(k, i), Hz(k), az(k), al(i)), t0, t0 + dt) +
604 integral(x, P(rls(i, j), al(i), ss(j)), t0, t0 + dt);
605 return res;
606}
607
608Real cry_eq_covariance(const CrossAssetModel& x, const Size i, const Size j, const Time t0, const Time dt) {
609 Size k = x.ccyIndex(x.eqbs(j)->currency());
610 Real Hk_b = Hz(k).eval(x, t0 + dt);
611 Real res = Hk_b * integral(x, P(rzl(k, i), az(k), Hl(i), al(i)), t0, t0 + dt) -
612 integral(x, P(rzl(k, i), Hz(k), az(k), Hl(i), al(i)), t0, t0 + dt) +
613 integral(x, P(rls(i, j), Hl(i), al(i), ss(j)), t0, t0 + dt);
614 return res;
615}
616
617Real eq_eq_covariance(const CrossAssetModel& x, const Size k, const Size l, const Time t0, const Time dt) {
618 Size i = x.ccyIndex(x.eqbs(k)->currency()); // ccy underlying equity k
619 Size j = x.ccyIndex(x.eqbs(l)->currency()); // ccy underlying equity l
620 Real Hi_b = Hz(i).eval(x, t0 + dt);
621 Real Hj_b = Hz(j).eval(x, t0 + dt);
622 Real res = integral(x, P(rss(k, l), ss(k), ss(l)), t0, t0 + dt);
623 res += Hj_b * integral(x, P(rzs(j, k), az(j), ss(k)), t0, t0 + dt);
624 res -= integral(x, P(Hz(j), rzs(j, k), az(j), ss(k)), t0, t0 + dt);
625 res += Hi_b * integral(x, P(rzs(i, l), az(i), ss(l)), t0, t0 + dt);
626 res -= integral(x, P(Hz(i), rzs(i, l), az(i), ss(l)), t0, t0 + dt);
627 res += Hi_b * Hj_b * integral(x, P(rzz(i, j), az(i), az(j)), t0, t0 + dt);
628 res -= Hi_b * integral(x, P(Hz(j), rzz(i, j), az(i), az(j)), t0, t0 + dt);
629 res -= Hj_b * integral(x, P(Hz(i), rzz(i, j), az(i), az(j)), t0, t0 + dt);
630 res += integral(x, P(Hz(i), Hz(j), rzz(i, j), az(i), az(j)), t0, t0 + dt);
631 return res;
632}
633
634Real aux_aux_covariance(const CrossAssetModel& x, const Time t0, const Time dt) {
635 Real res = integral(x, P(az(0), az(0), Hz(0), Hz(0)), t0, t0 + dt);
636 return res;
637}
638
639Real aux_ir_covariance(const CrossAssetModel& x, const Size j, const Time t0, const Time dt) {
640 Real res = integral(x, P(az(0), Hz(0), az(j), rzz(0, j)), t0, t0 + dt);
641 return res;
642}
643
644Real aux_fx_covariance(const CrossAssetModel& x, const Size j, const Time t0, const Time dt) {
645 Real res = Hz(0).eval(x, t0 + dt) * integral(x, P(az(0), az(0), Hz(0)), t0, t0 + dt) -
646 integral(x, P(Hz(0), Hz(0), az(0), az(0)), t0, t0 + dt) -
647 Hz(j + 1).eval(x, t0 + dt) * integral(x, P(az(j + 1), az(0), Hz(0), rzz(j + 1, 0)), t0, t0 + dt) +
648 integral(x, P(Hz(j + 1), az(j + 1), az(0), Hz(0), rzz(j + 1, 0)), t0, t0 + dt) +
649 integral(x, P(az(0), Hz(0), sx(j), rzx(0, j)), t0, t0 + dt);
650 return res;
651}
652
653Real com_com_covariance(const CrossAssetModel& x, const Size k, const Size l, const Time t0, const Time dt) {
654 Real res = integral(x, P(rcc(k, l), coms(k), coms(l)), t0, t0 + dt);
655 // FIXME: cover the Ornsrein-Uhlenbeck case in the integral framework
656 auto cmk = QuantLib::ext::dynamic_pointer_cast<CommoditySchwartzModel>(x.comModel(k));
657 auto cml = QuantLib::ext::dynamic_pointer_cast<CommoditySchwartzModel>(x.comModel(l));
658 QL_REQUIRE(cmk && cml, "CommoditySchwartzModel expected in com-com covariance calculation");
659 QL_REQUIRE(cmk->parametrization()->driftFreeState() == cml->parametrization()->driftFreeState(),
660 "commodity state types do not match");
661 if (!cmk->parametrization()->driftFreeState()) {
662 Real kk = cmk->parametrization()->kappaParameter();
663 Real kl = cml->parametrization()->kappaParameter();
664 Real sk = cmk->parametrization()->sigmaParameter();
665 Real sl = cml->parametrization()->sigmaParameter();
667 if (fabs((kk + kl) * dt) < QL_EPSILON)
668 res = rho * sk * sl * dt;
669 else
670 res = rho * sk * sl / (kk + kl) * (1.0 - std::exp(-(kk + kl) * dt));
671 }
672 return res;
673}
674
675Real ir_com_covariance(const CrossAssetModel& model, const Size i, const Size j, const Time t0, const Time dt) {
677 // FIXME
678 QL_REQUIRE(close_enough(corr, 0.0), "non-zero IR-COM correlation not implemented yet");
679 return 0.0;
680}
681
682Real fx_com_covariance(const CrossAssetModel& model, const Size i, const Size j, const Time t0, const Time dt) {
684 // FIXME
685 QL_REQUIRE(close_enough(corr, 0.0), "non-zero FX-COM correlation not implemented yet");
686 return 0.0;
687}
688
689Real infz_com_covariance(const CrossAssetModel& model, const Size i, const Size j, const Time t0, const Time dt) {
691 // FIXME
692 QL_REQUIRE(close_enough(corr, 0.0), "non-zero INF-COM correlation not implemented yet");
693 return 0.0;
694}
695
696Real infy_com_covariance(const CrossAssetModel& model, const Size i, const Size j, const Time t0, const Time dt) {
698 // FIXME
699 QL_REQUIRE(close_enough(corr, 0.0), "non-zero INF-COM correlation not implemented yet");
700 return 0.0;
701}
702
703Real cry_com_covariance(const CrossAssetModel& model, const Size i, const Size j, const Time t0, const Time dt) {
705 // FIXME
706 QL_REQUIRE(close_enough(corr, 0.0), "non-zero CR-COM correlation not implemented yet");
707 return 0.0;
708}
709
710Real crz_com_covariance(const CrossAssetModel& model, const Size i, const Size j, const Time t0, const Time dt) {
712 // FIXME
713 QL_REQUIRE(close_enough(corr, 0.0), "non-zero CR-COM correlation not implemented yet");
714 return 0.0;
715}
716
717Real eq_com_covariance(const CrossAssetModel& model, const Size i, const Size j, const Time t0, const Time dt) {
719 // FIXME
720 QL_REQUIRE(close_enough(corr, 0.0), "non-zero EQ-COM correlation not implemented yet");
721 return 0.0;
722}
723
724Real ir_crstate_covariance(const CrossAssetModel& x, const Size i, const Size j, const Time t0, const Time dt) {
725 Real res = integral(x, P(az(i), rzcrs(i, j)), t0, t0 + dt);
726 return res;
727}
728
729Real fx_crstate_covariance(const CrossAssetModel& x, const Size i, const Size j, const Time t0, const Time dt) {
730 Real res = Hz(0).eval(x, t0 + dt) * integral(x, P(az(0), rzcrs(0, j)), t0, t0 + dt) -
731 integral(x, P(Hz(0), az(0), rzcrs(0, j)), t0, t0 + dt) -
732 Hz(i + 1).eval(x, t0 + dt) * integral(x, P(az(i + 1), rzcrs(i + 1, j)), t0, t0 + dt) +
733 integral(x, P(Hz(i + 1), az(i + 1), rzcrs(i + 1, j)), t0, t0 + dt) +
734 integral(x, P(sx(i), rxcrs(i, j)), t0, t0 + dt);
735 return res;
736}
737
738Real crstate_crstate_covariance(const CrossAssetModel& x, const Size i, const Size j, const Time t0, const Time dt) {
739 Real res = integral(x, rccrs(i, j), t0, t0 + dt);
740 return res;
741}
742
743} // namespace CrossAssetAnalytics
744} // namespace QuantExt
const QuantLib::ext::shared_ptr< IrLgm1fParametrization > irlgm1f(const Size ccy) const
const QuantLib::ext::shared_ptr< EqBsParametrization > eqbs(const Size ccy) const
const QuantLib::ext::shared_ptr< InfJyParameterization > infjy(const Size i) const
Inflation JY component.
Size ccyIndex(const Currency &ccy) const
ModelType modelType(const AssetType t, const Size i) const
const QuantLib::ext::shared_ptr< CommodityModel > comModel(const Size com) const
const Matrix & correlation() const
IrModel::Measure measure() const
analytics for the cross asset model
Real ir_expectation_2(const CrossAssetModel &, const Size, const Real zi_0)
Real com_com_covariance(const CrossAssetModel &x, const Size k, const Size l, 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 ir_fx_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 infy_infy_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 ir_com_covariance(const CrossAssetModel &model, 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 ir_infy_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 ir_eq_covariance(const CrossAssetModel &x, const Size j, const Size k, 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 fx_infz_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 ir_expectation_1(const CrossAssetModel &x, const Size i, const Time t0, const Real dt)
const LC1_< E1 > LC(QuantLib::Real c, QuantLib::Real c1, const E1 &e1)
Real ir_crz_covariance(const CrossAssetModel &x, 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 eq_expectation_1(const CrossAssetModel &x, const Size k, const Time t0, const Real dt)
Real fx_crz_covariance(const CrossAssetModel &x, 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 aux_fx_covariance(const CrossAssetModel &x, const Size j, const Time t0, const Time 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 infz_infz_covariance(const CrossAssetModel &x, 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 infz_eq_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 crz_cry_covariance(const CrossAssetModel &x, 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 fx_com_covariance(const CrossAssetModel &model, 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 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 infy_com_covariance(const CrossAssetModel &model, const Size i, const Size j, const Time t0, const Time dt)
Real ir_ir_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 aux_ir_covariance(const CrossAssetModel &x, const Size j, const Time t0, const Time dt)
Real aux_aux_covariance(const CrossAssetModel &x, 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)
Real fx_eq_covariance(const CrossAssetModel &x, const Size j, const Size k, 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 integral(const CrossAssetModel &model, const E &e, const Real a, const Real b)
Real crz_eq_covariance(const CrossAssetModel &x, 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)
const P2_< E1, E2 > P(const E1 &e1, const E2 &e2)
Real fx_crstate_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_eq_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 eq_eq_covariance(const CrossAssetModel &x, const Size k, const Size l, const Time t0, const Time dt)
Real fx_expectation_1(const CrossAssetModel &x, const Size i, const Time t0, const Real dt)
some inflation related utilities.
pair< Real, Real > inf_jy_expectation_1(const CrossAssetModel &x, Size i, Time t0, Real dt)
pair< Real, Real > inf_jy_expectation_2(const CrossAssetModel &x, Size i, Time t0, const pair< Real, Real > &state_0, Real zi_i_0, Real dt)
Filter close_enough(const RandomVariable &x, const RandomVariable &y)
Real inflationGrowth(const QuantLib::ext::shared_ptr< CrossAssetModel > &model, Size index, Time S, Time T, Real irState, Real rrState, bool indexIsInterpolated)
INF H component. May relate to real rate portion of JY model or z component of DK model.
QuantLib::Real eval(const CrossAssetModel &x, const QuantLib::Real t) const
Real eval(const CrossAssetModel &x, const Real t) const
INF alpha component. May relate to real rate portion of JY model or z component of DK model.
JY INF index sigma component.
Real eval(const CrossAssetModel &x, const Real t) const
Real eval(const CrossAssetModel &x, const Real t) const
JY INF index variance component.
QuantLib::Real eval(const CrossAssetModel &x, const QuantLib::Real t) const
INF zeta component. May relate to real rate portion of JY model or z component of DK model.
Real eval(const CrossAssetModel &x, const Real t) const
Real eval(const CrossAssetModel &x, const Real t) const