Welcome to THETAWIKI. If you like to create or edit a page please make sure to login or register an account. All registered users please make sure to provide a valid email address.

Heston Volatility

From ThetaWiki
Jump to: navigation, search

The Heston (1993) Model

In the Heston (1993) model [1], the stock price dynamics under the risk-neutral measure $ \mathbb{Q} $ is given as:

$ d S(t) = r \ S(t) d t + \sqrt{V(t)} \ S(t) \ d W_{S}(t), \qquad (H.1) $

and the Heston(1993) variance dynamics has the following representation:

$ d V(t) = \kappa \ \left ( \theta - V(t) \right ) dt \ + \ \epsilon \sqrt{V(t)} \ d W_{V}(t), \qquad (H.2) $

with instantaneous correlations

$ \langle dW_{S } (t), \ dW_{V }(t) \rangle = \rho_{SV} dt. $

In equation (H.1), the risk-free interest rate $ r $ is a constant parameter, $ V(t) $ is the stock price variance which itself follows a CIR (1985) [2] type diffusion process as defined in equation (H.2).

In equation (H.2), the constant parameters $ \kappa $, $ \theta $, and $ \epsilon $ are respectively the stochastic variance mean reversion parameter, the long-run variance, and the volatility of the Heston variance process.

The instantaneous correlations between the stock price and stock price variance is $ \langle dW_{S } (t), \ dW_{V }(t) \rangle = \rho_{SV} dt $.

Using the Cholesky decomposition, we can re-express the correlated processes in equations (H.1) and (H.2) with two uncorrelated standard Brownian motions as follows

$ d S(t) = r \ S(t) dt + \sqrt{V(t)} \ S(t) \ \left ( \rho_{SV} \ d \tilde{W}_{V}(t) + \sqrt{1-\rho_{SV}^2} \ d \tilde{W}_{S}(t) \right ), \qquad (H.3) $
$ d V(t) = \kappa \ \left ( \theta - V(t) \right ) dt \ + \ \epsilon \sqrt{V(t)} \ d \tilde{W}_{V}(t), \qquad (H.4) $

where $ \langle d \tilde{W}_{S } (t), \ d \tilde{W}_{V }(t) \rangle = 0 $.

Simulation Discretization Scheme for Heston Variance Process and Stock Price Process

The integral representation for equation (H.4) from $ t $ to $ t+\delta $ is

$ V(t+\delta) = V(t) + \kappa \theta \delta - \kappa \int \limits_{t}^{t+\delta} V(u)) du + \epsilon \int \limits_{t}^{t+\delta} \sqrt{V(u)} \ d \tilde{W}_{V}(u), \qquad (H.5) $

Rearranging gives

$ \int \limits_{t}^{t+\delta} \sqrt{V(u)} \ d \tilde{W}_{V}(u) = \frac{1}{\epsilon} \left [ V(t+\delta) - V(t) - \kappa \theta \delta + \kappa \int \limits_{t}^{t+\delta} V(u)) du \right ], \qquad (H.6) $

The stochastic differential equation of $ \ln S(t) $ has the following representation:

$ d \ln S(t) = \left ( r - \frac{1}{2} V(t) \right ) dt + \sqrt{V(t)} \left ( \rho_{SV} \ d \tilde{W}_{V}(t) + \sqrt{1-\rho_{SV}^2} \ d \tilde{W}_{S}(t) \right ).\qquad (H.7) $

The Ito integral of equation (H.7) from t to t+∆ is:

$ \ln S(t+\delta) = \ln S(t) \ + \ r \delta \ - \ \frac{1}{2} \int \limits_{t}^{t+\delta} V(u) du \ + \ \rho_{SV} \int \limits_{t}^{t+\delta} \sqrt{V(u)} \ d \tilde{W}_{V}(u) \ + \ \sqrt{1- \rho_{SV}^2} \int \limits_{t}^{t+\delta} \sqrt{V(u)} \ d \tilde{W}_{S}(u), \qquad (H.8) $

Plugging in the integral expression of equation (H.6), equation (H.8) can be rewritten as:

$ \ln S(t+\delta) = \ln S(t) + r \delta - \frac{1}{2} \int \limits_{t}^{t+\delta} V(u) du $
$ + \frac {\rho_{SV} }{\epsilon} \left [ V(t+\delta) - V(t) - \kappa \theta \delta + \kappa \int \limits_{t}^{t+\delta} V(u) du \right ] $
$ + \sqrt{1-\rho_{SV}^2} \int \limits_{t}^{t+\delta} \sqrt{V(u)} \ d \tilde{W}_{S}(u), \qquad (H.9) $

Approximating the integral $ \int \limits_{t}^{t+\delta} V(u) \ du $ by

$ \left ( \gamma_1 V(t) + \gamma_2 V(t+\delta) \right ) \delta, \qquad (H.10) $


and recognizing that


$ \int \limits_{t}^{t+\delta} \sqrt{V(u)} \ d \tilde{W}_{S}(u) \sim \mathcal{N} \left ( 0, \int \limits_{t}^{t+\delta} V(u) du \right ), \qquad (H.11) $

where $ \sim \mathcal{N} (\mu, \sigma^2) $ denotes normally distributed with mean $ \mu $ and variance $ \sigma^2 $.

We can therefore use the following approximation for the Ito integral $ \int \limits_{t}^{t+\delta} \sqrt{V(u)} \ d \tilde{W}_{S}(u) $

$ \int \limits_{t}^{t+\delta} \sqrt{V(u)} \ d \tilde{W}_{S}(u) $
$ \approx \sqrt{ \int \limits_{t}^{t+\delta} V(u) du } \ Z_S, $
$ \approx \sqrt{ \left ( \gamma_1 V(t) + \gamma_2 V(t+\delta) \right ) \ \delta } \ Z_S, \qquad (H.12) $

where in the second approximate equality, we have used the approximation in equation (H.10). The term $ Z_S $ is an independently sampled standard normal variable.

Plugging equations (H.10) and (H.12) into equation (H.9), we have

$ \ln S(t+\delta) = \ln S(t) + r \delta - \frac{1}{2} \left ( \gamma_1 V(t) + \gamma_2 V(t+\delta) \right ) \ \delta $
$ + \frac {\rho_{SV} }{\epsilon} \left [ V(t+\delta) - V(t) - \kappa \theta \delta + \kappa \left ( \gamma_1 V(t) + \gamma_2 V(t+\delta) \right ) \ \delta \right ] $
$ + \sqrt{1-\rho_{SV}^2} \ \sqrt{ \left ( \gamma_1 V(t) + \gamma_2 V(t+\delta) \right ) \ \delta } \ Z_S, \qquad (H.13) $

Rearranging equation (H.13) and collecting terms, we have

$ \ln S(t+\delta) = \ln S(t) +\left ( r - \frac {\kappa \theta \rho_{SV} }{\epsilon} \right ) \delta $
$ + \left [ \gamma_1 \delta \left ( \frac {\kappa \rho_{SV} }{\epsilon} - \frac{1}{2} \right ) - \frac {\rho_{SV}}{\epsilon} \right ] \ V(t) $
$ + \left [ \gamma_2 \delta \left ( \frac {\kappa \rho_{SV} }{\epsilon} - \frac{1}{2} \right ) + \frac {\rho_{SV}}{\epsilon} \right ] \ V(t+\delta) $
$ + \sqrt{(1-\rho_{SV}^2) \delta} \ \sqrt{ \gamma_1 V(t) + \gamma_2 V(t+\delta) } \ Z_S, \qquad (H.14) $

Define

$ C0 = \left ( r - \frac {\kappa \theta \rho_{SV} }{\epsilon} \right ) \delta, $
$ C1 = \gamma_1 \delta \left ( \frac {\kappa \rho_{SV} }{\epsilon} - \frac{1}{2} \right ) - \frac {\rho_{SV}}{\epsilon}, $
$ C2 = \gamma_2 \delta \left ( \frac {\kappa \rho_{SV} }{\epsilon} - \frac{1}{2} \right ) + \frac {\rho_{SV}}{\epsilon}, $
$ C3 = \sqrt{(1-\rho_{SV}^2) \ \delta}. $

Equation (H.14) in a simplified representation is

$ \ln S(t+\delta) = \ln S(t) \ + \ C0 \ + \ C1 \ V(t) \ + \ C2 \ V(t+\delta) \ + \ C3 \sqrt{ \gamma _1 V(t) + \gamma _2 V(t+\delta) } \ Z_S. \qquad (H.15) $

Martingale Correction for the Drift in Stock Price Process

Due to possible discretization errors, the risk-neutral expectation of the discounted stock price conditional on current stock price is not a Martingale, i.e.

$ \mathbb{E}^Q \left [ e^{-r \delta} S(t+\delta) | S(t) \right ] \ne S(t) . \qquad (H.16) $

To make it a Martingale, we do the following Martingale correction for the discretized process in equation (H.15). First, using the iterated conditional expectations property, we have the following

$ \mathbb{E}^Q \left [ e^{-r \delta } S(t+\delta) | S(t) \right ] $
$ = \mathbb{E}^Q \left \{ \mathbb{E}^Q \left [ e^{-r \delta } S(t+\delta) | S(t) , V(t+ \delta) \right ] \mid S(t) \right \} $
$ = \mathbb{E}^Q \left \{ \mathbb{E}^Q \left [ S(t) \ e^{C0 + C1 \ V(t) + C2 \ V(t+\delta) + C3 \ \sqrt{ \gamma_1 V(t) + \gamma_2 V(t+\delta) } \ Z_S } | S(t) , V(t+ \delta) \right ] \mid S(t) \right \} $
$ =\mathbb{E}^Q \left \{ S(t) \ e^{C0 + C1 \ V(t) + C2 \ V(t+\delta) + \frac {1}{2} C3^2 \ ( \gamma_1 \ V(t) + \gamma_2 \ V(t+\delta) ) } \mid S(t) \right \} $
$ = S(t) \ e^{C0 + ( C1 + \frac {1}{2} C3^2 \ \gamma _1 ) \ V(t) } \mathbb{E}^Q \left \{e^{ (C2 + \frac {1}{2} C3^2 \ \gamma _2 ) \ V(t+\delta) } \mid S(t) \right \}, \qquad (H.17) $

In equation (H.17), the third equality follows by using the property of taking expectations of lognormal variable, i.e. $ \mathbb{E}^Q [e^{ \mu t + \sigma W_t} ]=e^{\mu t + \frac{1}{2} \sigma ^2} $ , where $ W_t $ is a standard Brownian motion process at time $ t $. The final equality follows by taking the terms know at time $ t $ out of the conditional expectation. To have

$ \mathbb{E}^Q \left [ e^{-r \delta} \ S(t+\delta) | S(t) \right ] = S(t), \qquad (H.18) $

the drift $ C0 $ in equation (H.15) needs to be corrected as $ C0^{*} $. To have a representation for $ C0^{*} $, we use the final equality in equation (H.17) by replacing $ C0^{*} $ with $ C0^{*} $, together with equation (H.18), we have

$ \mathbb{E}^Q \left [ e^{-r \delta} \ S(t+\delta) | S(t) \right ] $
$ = S(t) \ e^{C0^{*} + ( C1+\frac{1}{2} C3^2 \ \gamma_1 ) \ V(t) } \ \mathbb{E}^Q \left \{ e^{ (C2 +\frac{1}{2} C3^2 \ \gamma_2 ) \ V(t+\delta) } \mid S(t) \right \} $
$ = S(t). \qquad (H.19) $

Taking logs of both sides of equation (H.19) and rearranging, we have

$ C0^{*} = - \left ( C1 + \frac{1}{2} C3^2 \ \gamma_1 \right ) \ V(t) - \ln \left \{ \mathbb{E}^Q \left [ e^{ (C2 +\frac{1}{2} C3^2 \ \gamma_2 ) \ V(t+\delta) } \mid S(t) \right ] \right \}. \qquad (H.20) $

Denote

$ Y:= \mathbb{E}^Q \left [ e^{ (C2 + \frac{1}{2} C3^2 \ \gamma_2 ) \ V(t+\delta) } \mid S(t) \right ]. \qquad (H.21) $

Equation (H.20) can be re-expressed as

$ C0^{*} = - \left (C1 + \frac{1}{2} C3^2 \ \gamma_1 \right ) \ V(t) - \ln Y. \qquad (H.21) $

Andersen (2007) [3] derives a representation for the Martingale correction term with the QE scheme, which in our notations is as follows

$ C0^{*} = - \left (C1 + \frac{1}{2} C3^2 \ \gamma_1 \right ) \ V(t) - \ln Y $
$ = \begin{cases} -\frac {Ab^2a}{1 - 2Aa} + \frac{1}{2} \ln (1 - 2Aa) - (C1 + \frac{1}{2} C3^2 \ \gamma_1 ) \ V(t), \ \Psi \le \Psi _{c} \\ -\ln \left ( p + \frac{\beta (1-p) }{\beta -A} \right ) - (C1+\frac{1}{2} C3^2 \gamma_1 ) V(t), \ \Psi > \Psi _{c} \end{cases}, \qquad (H.23) $

where $ A = \frac {\rho_{SV}}{\epsilon} (1 + \kappa \ \gamma_2 \ \delta) - \frac{1}{2} \gamma_2 \ \delta \ \rho_{SV}^2 $, $ \Psi_c \in [1, \ 2] $, and $ \Psi $ is determined as

$ \Psi = \frac{s^2}{m^2} $,

with

$ \mathbb{E} \left [ V(t + \delta)|V(t) \right ] = \theta \ + \ \left ( V(t)- \theta \right ) \ e^{- \kappa \delta} := m , \qquad (H.24) $
$ var \left [ V(t + \delta)|V(t) \right ] = \frac { V(t) \epsilon ^2 \ e^{- \kappa \delta } }{ \kappa } \left ( 1-e^{- \kappa \delta } \right ) \ + \ \frac { \theta \ \epsilon ^2 }{2 \kappa} \left ( 1 \ - \ e^{- \kappa \delta } \right )^2 := s^2. \qquad (H.25) $

Equations (H.24) and (H.25) are respectively the first two conditional moments of Heston variance process as defined in equation (H.2).

Heston Model Implementation in ThetaML

The following code example shows simulated stock prices using the Heston(1993) model[1], implemented with ThetaML.

model Heston
%this model returns simulated stock prices with Heston variance
%example input parameters:
%S0 =100, Vt0 = 0.012, r = 0.0272, tht = 0.012
%kpp = 1.98937, epp = 0.15, rho_sv = -0.9, t = 1, dt = 0.01
	import S0           "Initial stock price"
	import Vt0          "Initial variance"
	import r            "Risk free interest rate"
	import tht          "Long term variance"
	import kpp          "Mean reversion rate for Heston variance"
	import epp          "Volatility of Heston variance"
	import rho_sv       "Instantaneous correlation of stock price and stock price variance"
	import t            "Simulation time horizon"
	import dt           "Discretization time step"
	export S            "Heston stock prices, Drift Martingale Corrected"
	export Vt           "Heston variance process"
 
	S = S0;              %initial Heston stock price
	Vt = Vt0;            %initial Heston stochastic variance
 
	%parameter values used for discretization, =0.5 uses central discretization
	gmm1 = 0.5;
	gmm2 = 0.5;
	%constant for the switching rule used in the QE scheme
	shi_crt = 1.5;
 
	loop t/dt
		theta dt;
		%Andersen's paper, equation (17)
		m = tht + (Vt-tht)*exp(-kpp*dt);
		%Andersen's paper, equation (18)
		s2 = Vt*epp^2*exp(-kpp*dt)*(1-exp(-kpp*dt))/kpp + tht*epp^2*(1-exp(-kpp*dt))^2/(2*kpp);
		%Andersen's paper, equation (19)
		shi = s2/(m^2);
		%Andersen's paper, p19, where C0 - K0, C1 - K1, C2 - K2, C3 - sqrt(K3/gmm1)
		C0 = (-rho_sv*tht*kpp/epp) * dt;
		C1 = gmm1*dt*(kpp*rho_sv/epp-0.5) - rho_sv/epp;
		C2 = gmm2*dt*(kpp*rho_sv/epp-0.5) + rho_sv/epp;
		C3 = sqrt((1-rho_sv^2)*dt);
 
		%Andersen's paper, p20, A - AVtdt
		AVtdt = C2 + 0.5*C3^2*gmm2;
		%Andersen's QE algorithm 3.2.4, p16 - 17
		u = rand();
		Z1 = norminv(u,0,1);
		if shi <= shi_crt
			%for sufficiently large value s of Vt
			%condition to be satisfied for QE martingale correction: AVtdt < (1/(2*a))
			c4 = 2/shi;
			b2 = max(c4-1+sqrt(c4*(c4-1)),0);
			a = m/(1+b2);
			Vdt = a*(sqrt(b2)+Z1)^2;
			%Martingale drift correction, p22, K0_star -- C00
			C00 = -AVtdt*b2*a/(1-2*AVtdt*a) + 0.5*log(1-2*AVtdt*a) - (C1+0.5*C3^2*gmm1)*Vt;
		else
			%for low values of Vt
			%condition to be satisfied for QE martingale correction: AVtdt < beta
			p = (shi-1)/(shi+1);
			bet = (1-p)/m;
			if (u <= p)
				Vdt = 0;
			else
				Vdt = log((1-p)/(1-u))/bet;
			end
			%Martingale drift correction, p22, K0_star -- C00
			C00 = -log(p + bet*(1-p)/(bet-AVtdt)) - (C1+0.5*C3^2*gmm1)*Vt;
		end
 
		Z0 = randn();
 
		%simulated Heston stock prices
		%Andersen's paper, p19, equation (33), with drift corrected, K0 replaced by C00
		S = S * exp(r*dt + C00 + C1*Vt + C2*Vdt + C3*sqrt(gmm1*Vt+gmm2*Vdt)*Z0);
 
		%update Heston stochastic variance
		Vt = Vdt;
	end
 
end


References

  1. 1.0 1.1 Heston, S.L., 1993, A Closed Form Solution for Options with Stochastic Volatility with Applications to Bond and Currency Options, The Review of Financial Studies 6, 327-343.
  2. Cox, J.C., Ingersoll, J.E., Ross, S.A., 1985. A Theory of the Term Structure of Interest Rates, Econometrica 53, 385–407.
  3. Andersen, Leif, 2007, Efficient Simulation of the Heston Stochastic Volatility Model, Banc of America Securities, working paper.