Python for Finance: Analyze Big Financial Data

(Elle) #1

Drift correction for jump to maintain risk neutrality


σ


Constant volatility of S


Zt


Standard Brownian motion


Jt


Jump at date t with distribution ...


... with ...


... N as the cumulative distribution function of a standard normal random variable


Nt


Poisson process with intensity


Equation 10-9 presents an Euler discretization for the jump diffusion where the are


standard normally distributed and the are Poisson distributed with intensity .


Equation 10-9. Euler discretization for Merton jump diffusion model


Given the discretization scheme, consider the following numerical parameterization:


In  [ 41 ]: S0  =   100.
r = 0.05
sigma = 0.2
lamb = 0.75
mu = -0.6
delta = 0.25
T = 1.0

To simulate the jump diffusion, we need to generate three sets of (independent) random


numbers:


In  [ 42 ]: M   =    50
I = 10000
dt = T / M
rj = lamb * (np.exp(mu + 0.5 * delta ** 2 ) - 1 )
S = np.zeros((M + 1 , I))
S[ 0 ] = S0
sn1 = npr.standard_normal((M + 1 , I))
sn2 = npr.standard_normal((M + 1 , I))
poi = npr.poisson(lamb * dt, (M + 1 , I))
for t in range( 1 , M + 1 , 1 ):
S[t] = S[t - 1 ] * (np.exp((r - rj - 0.5 * sigma ** 2 ) * dt
+ sigma * np.sqrt(dt) * sn1[t])
+ (np.exp(mu + delta * sn2[t]) - 1 )
* poi[t])
S[t] = np.maximum(S[t], 0 )
Free download pdf