I have some trouble with the following code. Some jump and a decentered path are present but it's not the case, normally for Black Scholes diffusion!
Is anyone see a problem in my code ?
import numpy as np
import matplotlib.pyplot as plt
mu = 0
sig = 0.5
def generate(S0, T, nt, sig, mu):
nt = int(nt)
T = float(T)
dt = T / nt
St = [S0] * nt
t = linspace(0,T,nt)
dWt = np.random.normal(0, 1, nt)
dWt[0] = 0.
Wt = dWt.cumsum()
return S0 * np.exp(sig * sqrt(float(dt)) * Wt + (mu - sig**2/2.) * t)
for i in range(100):
plt.plot(generate(180., 2., 252*2, sig, mu))