% GBM_Euro_call_lookback.m % Extends GBM_paths.m to calculate price of European fixed strike lookback call option with % strike price K. clear K=100 Nrealiz=10^5 S=100 % stock price at time 0 sig=0.2 % volatility T=1 % end-time (in years) ri=0.06 % risk-free interest rate div=0.03 % dividend yield N=500 % number of time steps dt=T/N; nudt=(ri-div-0.5*sig^2)*dt; sigsdt=sig*sqrt(dt); x0=log(S); % initial value for x=ln(S) %figure %hold on tic sum_CT=0; sum_CT2=0; for i=1:Nrealiz x=zeros(N,1); t=zeros(N,1); x(1)=x0; % initial condition t(1)=0; r=randn(N,1); maxSt=0; for n=1:(N-1) x(n+1)=x(n)+nudt+sigsdt*r(n); t(n+1)=t(n)+dt; St=exp(x(n+1)); if St>maxSt maxSt=St; end end CT=max(0,maxSt-K); sum_CT=sum_CT+CT; sum_CT2=sum_CT2+CT^2; end call_value=sum_CT/Nrealiz*exp(-ri*T) SD=sqrt( (sum_CT2-sum_CT*sum_CT/Nrealiz)*exp(-2*ri*T)/(Nrealiz-1)) SE=SD/sqrt(Nrealiz) toc