Option products are popular variety of derivative instruments that are traded in the financial markets. As the name suggests, an Option gives its holder the option to execute the option or not. For example, assume that you buy an option from me (by paying me a certain option premium amount) to buy a certain product in 3 months’ time at a certain specific price. Now assume that we are at 3-month maturity date, as you are the buyer of the option it is up to you whether you wish to exercise the option and buy the product OR whether you let the option go away worthless. The buyer of the option will only execute the option if its profitable to them. If not, then they will let the option expire worthless thereby losing only the amount of premium amount paid to the option seller. This is the mechanism of a basic option contract.
Our example in the paragraph above assumed a plain vanilla European option (we can buy the product at 3-month time point from today). Thus, our example is of an option whose type is European in nature. Like all other financial product, options also are priced for various purposes including: trading, risk measurement, accounting etc. Options can be priced using various models. Options may have any type of an asset as an underlying i.e. equity, FX etc. In this post we will study the pricing of an option product. We will discuss the pricing of a Barrier option which has some different characteristics than a plain vanilla European option. The first part of this post discusses the meaning of barrier options and the second part of this post considers the Python implementation for pricing of this product.
Barrier options are an enhancement over the plain vanilla options. Barrier options at times are classified under exotic options. In this post we will discuss one type of a barrier option, and we will assume the option type to be European in nature. Specifically, we will discuss Up and Out CALL barrier option pricing. We assume hypothetical equity stock to be the underlying for this option. A CALL option gives the option buyer the right but not the obligation to buy a certain underlying asset at a certain price in the future.
We assume the type of our barrier option to be European i.e, the option payoff will be calculated only at maturity date of the option. However, there is one additional characteristic i.e. we consider a certain Barrier level in this product. We specifically assume a Up and Out barrier option which implies that if the price of the underlying stock price touches this barrier level, the option will immediately expire/ cease to exist. If the underlying stock price does not touch the barrier level, the option stays alive and will provide a certain payoff at option maturity. However, the stock price needs to stay below the barrier level at all times prior to expiry date for option to stay alive.
We will be pricing our barrier option using Monte Carlo simulation approach. This approach involves simulating thousands of paths of the underlying stock and then using these to arrive at the price of the option. We use the popular Geometric Brownian Motion equation for a stock to simulate these paths for the stock.
A picture of a Monte Carlo simulation of stock price along multiple paths is depicted above. This picture is shown only for representation purpose for the reference of readers and is not generated using the code used in this post. However, a similar logic is implemented in the code.
The pricing logic for the barrier option is implemented in Python. Following steps are implemented for computing the price of the barrier option
· Importing the required libraries into the program:
· Defining the option product inputs that will be used for pricing of the option. We assume constant volatility for our example. Many a times, market participants prefer to use a time dependent volatility for pricing barrier options:
Next we specify the number of simulation paths:
· We then simulate the stock price along multiple paths. This is the Monte carlo path generation engine. Python is a powerful tool for generation of multiple paths which will enable the model to arrive at the best approximation of the option price . :
· Next we check if the simulated stock price has reached the barrier level ; and then we compute the option price using the formula for pricing of European CALL options.
Subsequently, we average the price of the barrier option along the simulated paths to arrive at the price of the barrier option.
This post demonstrates one of the methods for pricing of a Barrier option. There are other methods for pricing exotic options as well, we will discuss them in a separate post.