January 2020
Beginner to intermediate
432 pages
11h 24m
English
Execute the following steps to price American options using the Least Squares Monte Carlo method.
import numpy as npfrom chapter_6_utils import (simulate_gbm, black_scholes_analytical, lsmc_american_option)
S_0 = 36K = 40r = 0.06sigma = 0.2T = 1 # 1 yearN = 50 dt = T / N N_SIMS = 10 ** 5 discount_factor = np.exp(-r * dt)OPTION_TYPE = 'put'POLY_DEGREE = 5
gbm_sims = simulate_gbm(s_0=S_0, mu=r, sigma=sigma, n_sims=N_SIMS, T=T, N=N)
payoff_matrix = np.maximum(K - gbm_sims, np.zeros_like(gbm_sims))
value_matrix = np.zeros_like(payoff_matrix)value_matrix[:, ...
Read now
Unlock full access