the actual option price calculation, exposed to public, since it is useful to directly use the core computation sometimes
33 {
34 Real H0 = Hz(0).eval(*
model_, t);
36
37
39
42
43 H0 * H0 * (zetaz(0).eval(*
model_, t) - zetaz(0).eval(*
model_, t0)) -
46
47 Hi * Hi * (zetaz(i + 1).eval(*
model_, t) - zetaz(i + 1).eval(*
model_, t0)) -
48 2.0 * Hi *
integral(*
model_,
P(Hz(i + 1), az(i + 1), az(i + 1)), t0, t) +
49 integral(*
model_,
P(Hz(i + 1), Hz(i + 1), az(i + 1), az(i + 1)), t0, t) -
50
51 2.0 * (H0 * Hi *
integral(*
model_,
P(az(0), az(i + 1), rzz(0, i + 1)), t0, t) -
52 H0 *
integral(*
model_,
P(Hz(i + 1), az(i + 1), az(0), rzz(i + 1, 0)), t0, t) -
53 Hi *
integral(*
model_,
P(Hz(0), az(0), az(i + 1), rzz(0, i + 1)), t0, t) +
54 integral(*
model_,
P(Hz(0), Hz(i + 1), az(0), az(i + 1), rzz(0, i + 1)), t0, t));
58 }
59
61
63
66
67 2.0 * (Hi *
integral(*
model_,
P(az(i + 1), sx(i), rzx(i + 1, i)), t0, t) -
68 integral(*
model_,
P(Hz(i + 1), az(i + 1), sx(i), rzx(i + 1, i)), t0, t));
69
70 BlackCalculator
black(payoff, fxForward, std::sqrt(
variance), domesticDiscount);
71
73}
Real integral(const CrossAssetModel &model, const E &e, const Real a, const Real b)
const P2_< E1, E2 > P(const E1 &e1, const E2 &e2)
Filter close_enough(const RandomVariable &x, const RandomVariable &y)
RandomVariable variance(const RandomVariable &r)
RandomVariable black(const RandomVariable &omega, const RandomVariable &t, const RandomVariable &strike, const RandomVariable &forward, const RandomVariable &impliedVol)