To apply Monte-Carlo simulations and calculate price of American style options.
Use of Monte-Carlo Simulations
In order to calculate Option prices, we need to calculate the expected price at Expiry date of the underlying asset. One of the ways to do this is by running Monte-Carlo simulations as I had pointed out in my previous blog.
Calculate Expected Payoffs
Once we have expected prices calculated, next step is to calculate the Option payoffs for those prices.
Present Value of expected Payoffs
Now, we have the expected Options payoffs; so the next step is to calculate their Present Value using the discount factor dependent on risk-free rate and time to expiry (in years).
We use the above discount factor to calculate the present-value of option payoffs returns through the Monte-Carlo simulations.
Ct = PV(E[max(0,PriceAtExpiry−Strike)])
Pt = PV(E[max(0,Strike−PriceAtExpiry)])
Below code performs this exact calculation and returns the American Call and Put Option prices
Calculate Present Value of Expected Option Payoffs
Running for an extremely volatile asset - TSLA
We have everything setup, so lets start these simulations and calculations on TSLA stock to calculate prices for Call and Put option expiring Sept 7th, 2018 (i.e. 1 month from now) and with Strike price of $370.
The output we receive is Call Option priced at $11.162 and Put option prices at $25.102. Given the current Spot price is $355.49 (as of EOD Aug 10th), this price somewhat looks fine; but let's confirm it with other sites.
Output for TSLA Strike 370 expiring September 7th, 2018
As we can see from above Yahoo screenshots, our calculated option prices are pretty close to the ones found in Yahoo. I wonder if the recent news of Tesla going private adds additional volatility to the stock; causing this minor increase in both Call and Put option prices. What do you think?
To perform Monte-Carlo simulations and use it to calculate expected price at a given future date.
What are Monte-Carlo Simulations?
Monte-Carlo simulations are basically simulations of probability. As per investopedia:
"Monte Carlo simulations are used to model the probability of different outcomes in a process that cannot easily be predicted due to the intervention of random variables. "
Basically, given a set of parameters and some random variables, we perform thousands of simulations and then seek expected outcome.
Gaussian Process and Brownian Motion
In our case, we will make use of Gaussian Process that provides us with the random variable and then use it along with Asset Volatility, Risk-free rate, and time duration to calculate the expected price at a given future date.
This continuous-time stochastic process represents the Brownian motion (aka the Wiener Process).
Primary use of this Gaussian based Monte-Carlo simulations is to generate asset prices is used to calculate American Option prices, which we will go over in another blog.
Below is the Python library to generate value from Gaussian distribution.
Gaussian random variable in Python
Fetch underlying data
In order to successfully apply Monte-Carlo simulations on this Gaussian process, we need to get below data:
Panda library has a useful function to download these prices from Morningstar, Quandl, Yahoo, etc. Downloads from Yahoo are having some issue recently; hence, in our case we will use combination of Quandl and Morningstar.
Download Asset Prices
Download Treasury rate
Now that we have historical asset prices, we will go ahead and calculate the asset volatility.
We do this by first calculating the Log returns for each day. Once, we have log returns for each day, we calculate the standard deviation using the ever helpful Pandas' std function. Note, this will provide us with daily standard deviation; hence, we need to annualize it by multiplying it with 252 (i.e. expected number of trading days in an year). Once we have annualized standard deviation, we take square root of it to calculate annualized volatility.
Below code reflects how easy it is in Pandas:
Calculate annualized volatility from daily asset prices
Apply Gaussian Process and perform Simulations
We now have all the required inputs and are ready to apply Gaussian Process to calculate expected asset price using Monte-Carlo simulations. For each simulation, we calculate expected price using below equation:
ST = St * exp( (Rf− 0.5*σ^2)(T−t) + σϵ√(T−t) )
ST = Expected asset price at time
St = Current asset price at time t (aka Spot price)
Rf = Risk free rate or 3-month treasury rate
σ = Annualized Volatility
(T−t) = Time to maturity in years
ϵ = Random variable based on Gaussian Distribution
Once, we get expected stock price using above equation, we repeat this calculation for N number of simulations. The only variable changing in each simulation is the Gaussian process; thereby, we representing a continuous time stochastic process, i.e. Wiener process.
Below Python code performs these Monte-Carlo simulations:
Monte-Carlo simulations and Wiener Process
Running Simulations on Tesla Stock (TSLA) for a future date
I am a passionate, driven polyglot programmer and architect with a knack of solving complex problems in quick and efficient way. Along with programming, software development, financial products, and management expertise, I also bring skills in statistical modeling, empowering me to work on challenging projects that require combination of software development and quantitative analysis.