Black-Scholes-Merton model in R

We can use the Black-Scholes-Merton (BSM) model to price European options in R using the derivmkts package by Robert McDonald.

Let’s start by loading the package in the R session:

If you don’t have the package installed, read the instructions in binomial trees in R on how to install it.

We can use the bscall and bsput functions to price European call and put options, respectively.

Example: Pricing a European call option

As an example, let’s price a European call option with the following parameters:

  • Current stock price (s): $50
  • Strike price (k): $52
  • Volatility (v): 20% (0.20)
  • Risk-free interest rate (r): 5% (0.05)
  • Time to expiration (tt): 1 year
  • Dividend yield (d): 2% (0.02)

The result is the value of the European call option based on the BSM model.

Example: Pricing a European put option

Let’s price a European put option with the same parameters:

  • Current stock price (s): $50
  • Strike price (k): $52
  • Volatility (v): 20% (0.20)
  • Risk-free interest rate (r): 5% (0.05)
  • Time to expiration (tt): 1 year
  • Dividend yield (d): 2% (0.02)

The result is the value of the European put option based on the BSM model.

Try to change the parameters and see how the option price varies!

Comparing BSM and Binomial Tree Models

Let’s compare the results with those obtained using a binomial tree model1.

As you can see the binomial tree model with just three steps provides a poor approximation of the BSM price. Increasing the number of steps in the binomial tree will improve the accuracy of the approximation. Let’s try with 100 steps:

The results are now much closer. As we increase the number of steps in the binomial tree, the option price converges to the BSM price. Let’s try with 1000 steps:

Footnotes

  1. Read binomial trees in R.↩︎