2.5.7. sdepy.full_heston_process

class sdepy.full_heston_process(paths=1, vshape=(), dtype=None, steps=None, i0=0, info=None, getinfo=True, method='euler', x0=1., mu=0., sigma=1., y0=1., theta=1., k=1., xi=1., dw=None, corr=None, rho=None)[source]

Heston stochastic volatility process (returns both process and volatility).

Generates processes x(t) and an y(t) that solve the following SDEs:

dx(t) = mu(t)*x(t)*dt + sigma(t)*x(t)*sqrt(y(t))*dw_x(t, dt),
dy(t) = k(t)*(theta(t) - y(t))*dt + xi(t)*sqrt(y(t))*dw_y(t, dt)

where, if N = vshape[-1] is the size of the last dimension of x(t), y(t), and dw(t, dt) are standard Wiener process increments with shape vshape + (2*N, paths):

dw(t)[..., i, :]*dw(t)[..., j, :] = corr(t)[..., i, j]*dt
dw_x(t) = dw(t)[..., :N, :],
dw_y(t) = dw(t)[..., N:, :],

x0 and SDE parameters should broadcast to vshape + (paths,). dw(t, dt) should broadcast to vshape[:-1] + (2*vshape[-1], paths). x0, y0, theta, k should be positive.

Parameters:
paths, vshape, dtype, steps, i0, info, getinfo, method

See SDE class documentation.

x0, y0 : array-like

Initial conditions for x(t) and y(t) processes respectively.

mu, sigma, theta, k, xi : array-like, or callable

SDE parameters.

dw, corr, rho

Specification of stochasticity source of Wiener process increments. See SDE.source_dw documentation.

Returns:
x, y : processes

Once instantiated as p, p(timeline) performs the integration along the given timeline, based on parameters of instantiation, and returns the resulting processes.

Notes

x(t), y(t) are obtained via Euler-Maruyama numerical integration of the above SDE for y(t) and of the following equivalent SDE for a(t) = log(x(t)), handling negative values of y(t) via the full truncation algorithm [1]:

da(t) = (mu(t) - y(t)*sigma(t)**2/2)*dt + sqrt(y(t))*dw_x(t)

References

[1]Andersen L 2007, Efficient Simulation of the Heston Stochastic Volatility Model (available at: https://ssrn.com/abstract=946405 or http://dx.doi.org/10.2139/ssrn.946405)
Attributes:
See SDE class documentation.

Methods

See SDE class documentation.