function [X] = BlackScholesMertonEuro(callput, assetP, strike, riskFree, div, tmat, vol) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Computes the Black-Scholes-Merton European Call/Put Option Values based % on the following inputs: % callput = Call = 1, Put = 0 % assetP = Underlying Asset Price % strike = Strike Price of Option % riskFree = Risk Free rate of interest % div = Dividend Yield of Underlying % tmat = Time to Maturity % vol = Volatility of the Underlying % Please note that the use of this code is not restricted in anyway. % However, referencing the author of the code would be appreciated. % To run this program, simply use the function defined in the 1st line. % http://www.global-derivatives.com % info@global-derivatives.com % Kevin Cheng (Nov 2003) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% z = 1; if ~callput z = -1; end dt = vol * sqrt(tmat); df = riskFree - div + 0.5 * vol ^ 2; % Computes the drift term d1 = (log( assetP / strike ) + df * tmat ) / dt; % Calculates the d1 term used in Black-Scholes d2 = d1 - dt; % Calculates the d2 term used in Black-Scholes % The cumulative normal distribution functions for use in computing call % and put prices nd1 = normcdf(z * d1); nd2 = normcdf(z * d2); price = z * (assetP * exp(-div * tmat) * nd1 - strike * exp(-riskFree * tmat) * nd2); X = price;