January 2020
Beginner to intermediate
432 pages
11h 24m
English
Execute the following steps to price European options using Monte Carlo simulations.
import numpy as npfrom scipy.stats import normfrom chapter_6_utils import simulate_gbm
S_0 = 100K = 100r = 0.05sigma = 0.50T = 1 # 1 yearN = 252 # 252 days in a yeardt = T / N # time stepn_sims = 10 ** 6 discount_factor = np.exp(-r * T)
def black_scholes_analytical(S_0, K, T, r, sigma, type='call'): d1 = (np.log(S_0/K) + (r + 0.5 * sigma**2) * T) /(sigma * np.sqrt(T)) d2 = (np.log(S_0/K) + (r - 0.5 * sigma**2) * T) /(sigma * np.sqrt(T)) if type == 'call': val = (S_0*norm.cdf(d1, 0, 1)-K*np.exp(-r*T) *norm.cdf(d2, 0, ...
Read now
Unlock full access