source('../Chapter12/utils.R') sigma = 0.03 * 12 ## from per month to per year delta_t = 1/12 ## monthly timesteps ## Parameters of the stock: ## u = exp(sigma*sqrt(delta_t)) u_wrong = exp(sigma*delta_t) ##u = u_wrong ## test the books value of u d = 1/u r = 0.05 R = 1 + delta_t*r # total return over the next month q = (R - d - delta_t*0.08)/(u - d) print(c(u, u_wrong, d, R, q)) S0 = 0.625 K = 0.6 T_months = 6 ## time to expiration ## Build the stock price grid: ## SSpot = make_spot_table(S0, u, d, T_months) print('Spot lattice=') print(round(SSpot, 3)) P_European = evaluate_put_option(SSpot, K, q, R, type='American') print('American put option value=') print(round(P_European, 3))