I've written code below that simulates GBM paths for determining the price of a given European call option and put option. The stock is priced at 150 USD, strike price at 155 USD, risk-free rate was assumed to be 0.02, expected return was equal to 0.05, volatility at 0.1 and it's one year to maturity.
function [call, put] = monte_carlo_price(S_init, K, T, r, mu, sigma, n)
% Computes European call and put options using Monte Carlo simulations
% 'S_init' is the current underlying stock price
% 'K' is the strike price
% 'T' is years to maturity
% 'r' is the risk-free rate
% 'mu' is the expected return
% 'sigma' is the volatility
%----------------------------------------------------------------------
Paths = n;
Steps = T*365;
MC_scenes = zeros(Steps+1, Paths);
dT = T/Steps;
% First asset price is the initial price
MC_scenes(1,:) = S_init;
% Generate paths
for iPath = 1:Paths
for iStep = 1:Steps
MC_scenes(iStep+1, iPath) = MC_scenes(iStep, iPath) * exp((mu - 0.5*sigma^2)*dT + sigma * sqrt(dT)*normrnd(0,1));
end
end
% Calculate put and call option payoffs
putPayoff = max(K-MC_scenes(end,:),0);
callPayoff = max(MC_scenes(end,:)-K,0);
% Discount prices back to present day
put = mean(putPayoff)* exp(-r*T) ;
call = mean(callPayoff) * exp(-r*T);
end
My problem is that I'm trying to come up with an efficient way to get my simulation results to within 10 cents of the Black-Scholes output (5.10 USD for the call and 7.04 USD for the put). I tried increasing my 'Paths' (number of scenarios) through iterating and I got what I needed, but it took way too long to run. Is there way I can optimize setting the 'Paths' and even 'Steps' get to within the Black-Scholes outputs??
Thanks.
MC_scenes(iStep+1, iPath) = paths(iStep, iPath) * exp((mu - 0.5*sigma^2)*dT + sigma * sqrt(dT)*normrnd(0,1));
- shouldn't the first term on the right hand side beMC_scenes(iStep, iPath)
instead? $\endgroup$paths
and I think you meant to writeMC_scenes
instead..? $\endgroup$Paths
(capital) butpaths
(lower case) on the right hand side of the line I referenced. $\endgroup$