Introduction

In this post I am going to explain option pricing via Euler-Maruyama. As discussed before we only need to be able to price call options to get the price of put options.

In another post before we used a binomial tree for option pricing. This time we will basically do the same, but start from an opposite direction.

Assume the price of the underlying is described by the stochastical differential equation of geometric brownian motion: where is brownian motion. The variable corresponds to drift and behaves like volatility. We also need a known .

This is slightly more general than in the post before.

We can now simulate some paths of the underlying on the time interval up to expiry via Euler-Maruyama and compute the expected payoff as the mean, if it exists.

Coding

To be more precise we want to approximate the SDE on the interval . The strike price is denoted with . If we discretize the SDE we get an approximation with where are i.i.d and normally distributed with mean and variance . So let us write this in slow Python code.

import numpy as np
import random
 
#Parameters
tbegin = 0
tend = 1
deltat = .0001
t = np.arange(tbegin, tend, deltat)

E=1.0

sigma = 0.8
mu = 0.4
S0 = 1

sqrtdt = np.sqrt(deltat)


N=np.zeros(10000) #do 10000 simulations
for i in xrange(0,N.size):
  y = S0
  for j in xrange(1, t.size):
      y = y + y * mu * deltat + y * sigma * random.gauss(0, np.sqrt(deltat))
  N[i]=y

N=np.maximum(0,N-E) #payoff for call option
print(N.mean())

Outlook

If you are clever or if you can use google, then you know, that the price of european options can also be computed explicitly. Yes, that is right, but that was not the point of my post. The point of my post was to show an easy example of how to price derivatives.
According to the same method you can price any kind of exotic option, where the payoff is not only dependant on the price of the asset at expiration but on other stuff. Or you can price options with multiple possible expiration times, like American or Bermudan options.

You may also argue that we do not know all those parameters like the volatility and mean of the underlying. Yes, that is also right, but we can guess them, for example via maximum-likelihood estimation, if we have historical data of the asset.

Another interesting argument would be, that normal assets are unlikely to follow geometric brownian motion. That is also right. Distributions of returns have fat tails. But in the code above you can plug in any stochastic process, instead of the geometric brownian motion we used. You can also use a stochastic volatility model, i.e., a model, where the volatility itself is another stochastical process. I, as an arrogant mathematician would say that this is an easy exercise. If you do not trust me, try it yourself.



Published

08 August 2015

Category

Lesson

Tags