Approaches to implementing Monte Carlo methods in MATLAB
28 Sep 2011
14 Oct 2011)
Code for the article in the September 2011 article
% Function to compute Arithmetic Asian Option price ; Using Financial
% Tooolbox functions
% 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] = PriceArithmeticAsianOptionFin(S0,X,r,T,sigma,NSteps,NPaths)
RetSeries = squeeze(portsim(r, sigma^2, NSteps,dt, NPaths, 'Expected'));
Path = ret2tick(RetSeries, repmat(S0, 1, NPaths))';
% Pre-allocate the grid
DiscPayoff(i) = exp(-r*T) .* max(sum(Path(i,2:end))./NSteps - X,0);
Price = mean(DiscPayoff);