# Introduction to Monte Carlo simulations and option pricing

In this post we are going to introduce the mathematical statistics concept Monte Carlo simulations. We will use financial option pricing as our use case in demonstrating the Monte Carlo approach, and will therefore also introduce derivate assets and financial options, and how we price these contracts. This post will serve as a introductory post to Pricing financial options using Monte Carlo simulations where we will price two rather complicated option examples using Monte Carlo simulations.

## Derivative assets and financial options

Before we get into the Monte Carlo simulations, we will start off with a quick introduction to derivative assets and financial options. A derivative is a financial contract between two (or more) parties, where the contract's value depends on another asset. We say that the derivative derives its value from the value of this underlying asset. Financial options are typical examples of derivative assets.

*It does not have to be complicated*

There are very many different types of derivative assets. They vary in terms of e.g. their structure, number and types of underlying assets, and time to maturity. Common examples of underlying assets are stocks, interest rates, bonds, currencies and market indexes. In this post we will only look at perhaps the simplest type of financial option that has one stock as the underlying asset, namely the European call option.

Consider that you want to buy a stock at some future time point $T$. You can of course just wait until this future time point, but this will leave you with the uncertainty of not knowing what you will have to pay for the stock. One way to get rid of the uncertainty is to enter a so called forward contract. This is a contract between you and a counterpart where you agree to exchange the stock at time $T$ for some fix value $K$ decided today when entering the contract. Denoting the value of the stock at time $t$ by $S(t)$, this will give you the following payoff at time $T$:

You can see it as buying the stock for $K$ in the forward contract and then selling the stock at market price $S(T)$. The value $K$ is set such that the value of the forward contract is free to enter for both parties, i.e. that the value of the contract today (at $t=0$) is zero.

So, with the help of the forward contract, we are able to get rid of the uncertainty of not knowing what we will have to pay for the stock. However, if the market price of the stock at time $T$ happens to be lower than $K$, we are still obligated to fulfill the forward contract, and thus making a loss since we could have bought the stock cheaper directly from the market. Rather, we would only want to exchange the stock if $S(T) > K$. This leads us in on financial option contracts. As the name indicates, it gives us the option to exercise the contract only if it is profitable to us.

In this case, we then like to have an option giving us the possibility of buying the stock at time $T$ for $K$ if $S(T)>K$, and if not, we do not exercise the option. This is called an European call option, and for this option we instead have the following payoff at time $T$:

with the corresponding payoff-diagram (when $K=90$):

*Payoff-diagram for the European call option*

With this option, we know that we will not have to pay more than $K$ for the stock, and have thus removed the uncertainty as well as eliminating the risk of the future stock price being lower than $K$. The counterpart in the contract is still obligated to sell the stock for $K$ even though it is worth more on the market, so the option contract is more advantageous to us, and is unlike the forward contract not a contract that is free to enter. The counterpart carries all the risk and should thus be compensated for this. So, the question is then what this compensation should be, i.e. how do we price this European call option. That is the question we will tackle throughout the rest of this blog post.

The way we price contracts of this kind is that we discount the expected future payoff back to today, so the price of an European call option today, which we denote $\Pi(0)$, is given as:

Note that the $r$ is the (continuously compounded) risk free interest rate, so $e^{-rT}$ is the discount factor. Maybe you have not encountered a discount factor before. There is a time value in money. It is always better to get money sooner than later, since we can invest it and get some return. You can see the discount factor as something that change the value of the future cash flow at time $T$, so that it is comparable to a cash flow today. Also, $\mathbb{E}$ denotes the expected value. So, if we are going to evaluate this expected value, we need a distribution for the underlying stock, i.e. we need the distribution for $S(T)$. Therefore, we need a model for the stock.

## The standard Black&Scholes model

Just as the dynamics of different phenomena in other areas often are described using differential equations, we use differential equations to model the stock as well. However, since the stock's price process is a stochastic (random) process, we will model the stock using stochastic differential equations. While the solution to an ordinary differential equation is the function that satisfies the equation, the solution to a stochastic differential equation is instead the random variable that satisfies the equation. There are many different models that we can use, all of different complexity. As a start, we will look at a rather simple model called the standard Black&Scholes model. This is the model that gives rise to the famous Black&Scholes formula for pricing European call and put options, a formula that typically shows up in finance courses.

In the standard Black&Scholes model, we have the following stochastic differential equation for the stock, also known as Geometric Brownian Motion:

Here $\sigma$ is a positive constant, $r$ is still the risk free interest rate and the $d$-symbol denotes the differential. The stochastic part enters with the $W(t)$, which is called a standard Brownian Motion, and is the following Gaussian process:

Now, since this post is not about stochastic differential and integral calculus, we will not show how we can derive the solution to the Geometric Brownian Motion, but instead just state the solution. For more information on Geometric Brownian Motions including how to solve the equation, you can look at the Wikipedia page for Geometric Brownian Motion. We have that:

where $S(0)$ is today's stock price. We can note that, since everything except $W(T) \sim N(0, T)$ are deterministic constants, the price is the exponential of a normal distribution, and thus has a log-normal distribution.

## Monte Carlo simulations

Now, after this quick introduction to derivative pricing, we can finally get into Monte Carlo simulations. In this fairly simple case with a European call option in the standard Black&Scholes model, we actually have an exact solution, namely the Black&Scholes formula mentioned before:

where $d_1 = \frac{1}{\sigma\sqrt{T}}\cdot\left(\log(\frac{S(0)}{K}) + (r+\frac{\sigma^2}{2})T\right)$, $d_2 = d_1 - \sigma\sqrt{T}$ and $N(x)$ is the distribution function of the standard normal distribution. Therefore, Monte Carlo simulations is not necessary in this case. However, it provides us with a simple example to introduce the concepts, and we also have an exact solution to compare our Monte Carlo estimates to.

Alright, Monte Carlo simulations. It is a method for estimating expected values of random variables. The basic Monte Carlo sampler is really just based upon one result in mathematical statistics, namely the law of large numbers. It states that if $X_1,X_2,...,X_n$ are independent, identically distributed random variables, then:

where $\varphi$ is some function satisfying $\mathbb{E}[\varphi(X)]<\infty$. Inspired by this result, denoting our Monte Carlo estimate using $N$ simulations by $\mathbb{E}[\varphi(X)]_N^{MC}$, the basic Monte Carlo sampler is given by:

Comparing with the European call option in the standard Black&Scholes model, we can estimate the price $\Pi(0)$ using the following Monte Carlo sampler:

Now assuming that the initial stock price is $S(0)=100$, the so called strike price $K=90$, the risk free interest rate $r=1\%$, the volatility of the stock $\sigma=0.2$ and that the time to maturity $T=1$ year, we can implement the following Monte Carlo sampler in Python:

Running a simulation (with $N=100000$) gives us the following price estimate and 95% confidence interval for the Monte Carlo estimated price:

We can compare with the exact value given by Black&Scholes formula by implementing this in Python as well:

This gives us that $\Pi(0)=14.193$, which we see lies in the confidence interval for our Monte Carlo estimatad price. Note that we will get a different estimate if we were to repeat the Monte Carlo simulation, but if we look at the figure below of the estimate of 1000 different simulations, we see that they on average coincide with the exact value given by the Black&Scholes formula.

*Different simulations of the option price and the exact value by B&S formula*

## Conclusion

In this post, we managed to:

Introduce derivative assets and financial options, especially the European call option

Look at our first model for stocks, namely the standard Black&Scholes model

Introduce the concept of Monte Carlo simulations

Look at our first pricing example

As mentioned before, the pricing example we looked at here actually has an exact solution - the Black&Scholes formula - so the Monte Carlo approach was not necessary in this case.

In the follow-up blogpost

Pricing financial options using Monte Carlo simulations

we will look at two examples examples when we actually need to use the Monte Carlo approach demonstrated in this blogpost. Both these examples are definetely more challenging mathematically, but the ideas are the same as here in this post. The first example is a so called Basket call option, and in the second example we return to the European call option, but instead use a more complex stock model. In both cases, we cannot find an explicit formula for the price, so we actually need the Monte Carlo simulations to price the options.