-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathBSM
More file actions
23 lines (19 loc) · 677 Bytes
/
BSM
File metadata and controls
23 lines (19 loc) · 677 Bytes
1
##Monte Carlo valuation of European call option# in Black-Scholes-Merton model# bsm_mcs_euro.pyimport numpy as np# Parameter ValuesS0 = 100. # initial index levelK = 105. # strike priceT = 1.0 # time-to-maturityr = 0.05 # riskless short ratesigma = 0.2 # volatilityI = 100000 # number of simulations# Valuation Algorithmz = np.random.standard_normal(I) # pseudorandom numbersST = S0 * np.exp((r - 0.5 * sigma ** 2) * T + sigma * np.sqrt(T) * z)# index values at maturityhT = np.maximum(ST - K, 0) # inner values at maturityC0 = np.exp(-r * T) * np.sum(hT) / I # Monte Carlo estimator# Result Outputprint “Value of the European Call Option %5.3f” % C0