Approaches to implementing Monte Carlo methods in MATLAB
28 Sep 2011
(Updated 14 Oct 2011)
Code for the article in the September 2011 article
% Function to compute Arithmetic Asian Option price ; Using PCT
% See article "Approaches to implementing Monte Carlo methods in MATLAB"
% by Sri Krishnamurthy,CFA and Jorge Paloschi,PHD
% in the September 2011 article of Wimott Magazine or at
% Copyright 2011 MathWorks, Inc.
function [Price] = PriceArithmeticAsianOptionPCT(S0,X,r,T,sigma,NSteps,NPaths)
nuT = (r - 0.5*sigma^2)*dt;
siT = sigma * sqrt(dt);
% Pre-allocate the grid
Path = S0.*cumprod(exp(nuT+siT*randn(1,NSteps)));
DiscPayoff(i) = exp(-r*T) .* max(sum(Path)./NSteps - X,0);
Price = mean(DiscPayoff);