Tuesday, June 23, 2015
Monte-Carlo Methods For Valuing A Call Option
In Paul Wilmott's FAQ in Quantitative Finance, he describes 3 main numerical methods to value option contracts. These include finite difference, numerical quadrature and Monte Carlo methods. In this post, we will explore how to value a simple call option using c++ implementation. This follows the work described in 'c++ Design Patterns and Derivative Pricing' by M Joshi.
We begin with a model of stock price evolution under a risk-neutral process with risk free rate r
$$ dS_t = rS_tdt + \sigma S_t dW_t$$
Solving the stochastic differential equation using Ito's lemma so that
$$ dlogS_t = \left(r-\frac{1}{2}\sigma^2 \right)dt + \sigma dW_t$$
Using the fact that the process is constant coefficient and $W_t$ ~ Brownian Motion ~ $\sqrt{T}N(0, 1)$ where T is the time to expiry we obtain
$$ logS_t = log S_0 + \left(r-\frac{1}{2}\sigma^2 \right)T + \sigma \sqrt{T}N(0, 1)$$
so that $$S_T = S_0 e^{\left(r-\frac{1}{2}\sigma^2 \right)T + \sigma \sqrt{T}N(0, 1)}$$
Black–Scholes pricing theory then tells us that the price of a vanilla option, with expiry T and pay-off f , is equal to the expectation of the pay-off such that the price P is given by
$$P =E[f(S_0 e^{\left(r-\frac{1}{2}\sigma^2 \right)T + \sigma \sqrt{T}N(0, 1)})] $$
Thus all is required is to randomly generate normal (0, 1) random numbers, plugging them into the formula and calculating the average price.
The code can be found below:
There are a few differences in the code found in Joshi's book. For example, instead of using header files to generate random numbers using box mulller or gaussian summation, I have opted to use the library and the normal distribution generator.
I will be trying to go through the subsequent chapters of Joshi's book to generalise the above code to puts and other option types while incorporating OOP practices.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment