# Asian Option Pricing using Monte Carlo Simulation Method in Matlab

Matlab → Simulations → Monte Carlo →  Antithetic Technique → Asian Option

The following Matlab codes calculate Asian Option Prices using Monte Carlo Simulation Method in Matlab. In the first code we used the `for` loop to calculate the arithmetic Asian call option price. Later, we used the powerful `cumprod` command to simplify the Matlab codes. In the end, the for loop is used to calculate the geometric Asian call option.

Asian call option using Monte Carlo option pricing method
```function Asian = AsianMonteCarlo(so,k,r,v,t,m,n) dt = t/m; AsianPayoffSum=0; for i=1:n s = so; stSum = so; at = so; for j=1:m st = s*exp(((r-v^2/2)*dt)+(v*randn*sqrt(dt))); stSum = stSum + st; % For geometric: STSum = STSum*ST; at = stSum/(j+1); % For geometric: AT = (STSum)^(1/(J+1)); s = st; end AsianPayoff = max(at-k,0); AsianPayoffSum = AsianPayoffSum + AsianPayoff; end AsianCall = exp(-r*t)*(AsianPayoffSum/n)``` We can also calculate the Asian call and put option prices using the `cumprod` function instead of using the for loop. For example,

```function Asian = AsianMonteCarlo(s,k,r,v,t,m,n) dt = t/m; st = s*[ones(n,1),cumprod(exp((r-0.5*v^2)*dt+v*sqrt(dt)*randn(n,m)),2)]; averagePrice = mean(st,2); payoffCall = max(averagePrice-k,0); payoffPut = max(k-averagePrice,0); AsianCall = exp(-r*t)*mean(payoffCall) AsianPut = exp(-r*t)*mean(payoffPut)``` And, to calculate geometric Asian option prices using Monte Carlo method, we need to change `mean` by `geomean` in line 4 of the above Matlab code. Like,

```function Asian = AsianMonteCarlo(s,k,r,v,t,m,n) dt = t/m; st = s*[ones(n,1),cumprod(exp((r-0.5*v^2)*dt+v*sqrt(dt)*randn(n,m)),2)]; averagePrice = geomean(st,2); payoffCall = max(averagePrice-k,0); payoffPut = max(k-averagePrice,0); AsianCall = exp(-r*t)*mean(payoffCall) AsianPut = exp(-r*t)*mean(payoffPut)```

In the next example, Both Asian call and put option prices are calculated using Monte Carlo simulation method for option pricing. Here we used the antithetic variable technique for variance reduction.

```function Asian = AsianMonteCarlo(s,k,r,v,t,m,n) dt = t/m; st1 = s*[ones(n,1),cumprod(exp((r-0.5*v^2)*dt+v*sqrt(dt)*randn(n,m)),2)]; st2 = s*[ones(n,1),cumprod(exp((r-0.5*v^2)*dt+v*sqrt(dt)*(-randn(n,m))),2)]; averagePrice1 = mean(st1,2); averagePrice2 = mean(st2,2); payoffCall1 = max(averagePrice1-k,0); payoffCall2 = max(averagePrice2-k,0); payoffCall = 0.5*(payoffCall1+payoffCall2); payoffPut1 = max(k-averagePrice1,0); payoffPut2 = max(k-averagePrice2,0); payoffPut = 0.5*(payoffPut1+payoffPut2); AsianCall = exp(-r*t)*mean(payoffCall) AsianPut = exp(-r*t)*mean(payoffPut)```

In the next example geometric Asian call option price is calculate when we have used the `for` loop.

```function Asian = AsianMonteCarlo(so,k,r,v,t,m,n) dt = t/m;; AsianPayoffSum=0; for i=1:n s = so; stSum = so; at = so; for j=1:m st = s*exp(((r-v^2/2)*dt)+(v*randn*sqrt(dt))); stSum = stSum*st; at = (stSum)^(1/(j+1)); s = st; end AsianPayoff = max(at-k,0); AsianPayoffSum = AsianPayoffSum + AsianPayoff; end AsianCall = exp(-r*t)*(AsianPayoffSum/n)```

Posted