31 const ext::shared_ptr<HestonProcess> & hestonProcess,
32 const ext::shared_ptr<HullWhiteForwardProcess> & hullWhiteProcess,
33 Real corrEquityShortRate,
35 : hestonProcess_(hestonProcess),
36 hullWhiteProcess_(hullWhiteProcess),
37 hullWhiteModel_(new
HullWhite(hestonProcess->riskFreeRate(),
38 hullWhiteProcess->a(),
39 hullWhiteProcess->
sigma())),
40 corrEquityShortRate_(corrEquityShortRate),
42 maxRho_(
std::sqrt(1-hestonProcess->
rho()*hestonProcess->
rho())
45 T_(hullWhiteProcess->getForwardMeasureTime()),
46 endDiscount_(hestonProcess->riskFreeRate()->discount(
T_)) {
48 QL_REQUIRE( corrEquityShortRate*corrEquityShortRate
50 "correlation matrix is not positive definite");
53 "positive vol of Hull White process is required");
69 Array x0 = { x[0], x[1] };
80 Array xt = { x0[0], x0[1] }, dxt = { dx[0], dx[1] };
93 Array xt(2); xt[0] = x[0]; xt[1] = x[1];
95 retVal[0][0] = m[0][0]; retVal[0][1] = 0.0; retVal[0][2] = 0.0;
96 retVal[1][0] = m[1][0]; retVal[1][1] = m[1][1]; retVal[1][2] = 0.0;
100 retVal[2][1] = - retVal[2][0]*retVal[1][0] / retVal[1][1];
101 retVal[2][2] = std::sqrt(
sigma*
sigma - retVal[2][1]*retVal[2][1]
102 - retVal[2][0]*retVal[2][0] );
110 const Rate r = x0[2];
117 const Time t = t0 + dt;
127 const Real eaT=std::exp(-a*
T);
128 const Real eat=std::exp(-a*
t);
129 const Real eas=std::exp(-a*
s);
130 const Real iat=1.0/eat;
131 const Real ias=1.0/eas;
141 *(dt + 2/a*(eat-eas) - 1/(2*a)*(eat*eat-eas*eas));
144 *(dt - 1/a*(1-eat*ias) - 1/(2*a)*eaT*(iat-2*ias+eat*ias*ias));
146 const Real mu = m1 + m2 + m3 + m4 + m5;
154 retVal[1] = x0[1] +
nu*dt + eta2*std::sqrt(dt)
155 *(xi*dw[0]+std::sqrt(1-xi*xi)*dw[1]);
160 + 1/(2*a)*(1 - eat*eat*ias*ias))
166 QL_REQUIRE(v1 > 0.0 && v2 > 0.0,
"zero or negative variance given");
172 && 1-rhoT*rhoT/(1-xi*xi) >= 0.0,
173 "invalid terminal correlation");
175 const Real dw_0 = dw[0];
176 const Real dw_2 = rhoT*dw[0]- rhoT*xi/std::sqrt(1-xi*xi)*dw[1]
177 + std::sqrt(1 - rhoT*rhoT/(1-xi*xi))*dw[2];
181 const Real vol = std::sqrt(v1)*dw_0;
182 retVal[0] = x0[0]*std::exp(mu + vol);
185 const Real dw_2 =
rho*dw[0]-
rho*xi/std::sqrt(1-xi*xi)*dw[1]
186 + std::sqrt(1 -
rho*
rho/(1-xi*xi))*dw[2];
190 const Real vol =
eta*std::sqrt(dt)*dw[0];
191 retVal[0] = x0[0]*std::exp(mu + vol);
194 QL_FAIL(
"unknown discretization scheme");
209 const ext::shared_ptr<HestonProcess>&
214 const ext::shared_ptr<HullWhiteForwardProcess>&
1-D array used in linear algebra.
Single-factor Hull-White (extended Vasicek) model class.
const Real corrEquityShortRate_
Array drift(Time t, const Array &x) const override
returns the drift part of the equation, i.e.,
Size size() const override
returns the number of dimensions of the stochastic process
Array evolve(Time t0, const Array &x0, Time dt, const Array &dw) const override
DiscountFactor endDiscount_
Matrix diffusion(Time t, const Array &x) const override
returns the diffusion part of the equation, i.e.
Time time(const Date &date) const override
const ext::shared_ptr< HullWhiteForwardProcess > & hullWhiteProcess() const
const ext::shared_ptr< HestonProcess > & hestonProcess() const
HybridHestonHullWhiteProcess(const ext::shared_ptr< HestonProcess > &hestonProcess, const ext::shared_ptr< HullWhiteForwardProcess > &hullWhiteProcess, Real corrEquityShortRate, Discretization discretization=BSMHullWhite)
Array initialValues() const override
returns the initial values of the state variables
const ext::shared_ptr< HullWhite > hullWhiteModel_
DiscountFactor numeraire(Time t, const Array &x) const
Array apply(const Array &x0, const Array &dx) const override
const Discretization discretization_
const ext::shared_ptr< HestonProcess > hestonProcess_
const ext::shared_ptr< HullWhiteForwardProcess > hullWhiteProcess_
Discretization discretization() const
Matrix used in linear algebra.
discretization of a stochastic process over a given time interval
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
#define QL_FAIL(message)
throw an error (possibly with file and line information)
flat forward rate term structure
@ NoFrequency
null frequency
Real Time
continuous quantity with 1-year units
Real DiscountFactor
discount factor between dates
Real Volatility
volatility
std::size_t Size
size of a container
hybrid equity (heston model) with stochastic interest rates (hull white model)
ext::shared_ptr< YieldTermStructure > r