Options Trading, Call, Put, Monte Carlo, Tejapi Quant.
Nsteps, Nrep): SPATH = np.zeros((Nrep, 1 + Nsteps)) SPATH[:, 0] = S0 dt = T / Nsteps nudt = (r - 0.5 * sigma **2) * dt sidt = sigma * np.sqrt(dt) for i in range(0,Nrep): for j in range(0,Nsteps): SPATH[i,j+1] = SPATH[i,j] * np.exp(nudt + sidt * np.random.normal()) return SPATH After setting up the