Get Started

Compute Black-Scholes price of an option

The Black_Scholes() function in the package qrmtools can be used to price European call and put options using the standard Black-Scholes options pricing formula for a non-dividend-paying stock.

In this exercise you will price in succession: an out-of-the-money European call, an in-the-money European call, an in-the-money European put and an out-of-the-money European put. An option is in-the-money if immediate exercise would result in a positive payout and out-of-the-money if it would not.

The main point of the exercise is to understand the different risk factors that go into the price calculation: the current stock price, the current volatility and the current interest rate.

This is a part of the course

“Quantitative Risk Management in R”

View Course

Exercise instructions

  • Set the current interest rate r to be 0.01, the current volatility sigma to be 0.2 and the strike K to be 100.
  • Look at the arguments of the Black_Scholes() function.
  • Price a European call option that matures in T = 1 year if the current stock price is S = 80.
  • Price a European call option that matures in T = 1 year if the current stock price is S = 120.
  • Price a European put option that matures in T = 1 year if the current stock price is S = 80.
  • Price a European put option that matures in T = 1 year if the current stock price is S = 120.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Set the interest rate r to be 0.01, the volatility sigma to be 0.2 and the strike K to be 100
r <- 0.01



# Look at the arguments of the Black_Scholes function
args(___)

# Price a European call option that matures in one year if the current stock price is 80
Black_Scholes(0, ___, r, sigma, K, 1, "call")

# Price a European call option that matures in one year if the current stock price is 120


# Price a European put option that matures in one year if the current stock price is 80
Black_Scholes(___, ___, r, sigma, K, ___,"put")

# Price a European put option that matures in one year if the current stock price is 120

This exercise is part of the course

Quantitative Risk Management in R

BeginnerSkill Level
4.8+
8 reviews

Work with risk-factor return series, study their empirical properties, and make estimates of value-at-risk.

In this chapter, the concept of value-at-risk and simple methods of estimating VaR based on historical simulation are introduced.

Exercise 1: Value-at-risk and expected shortfallExercise 2: Computing VaR and ES for normal distributionExercise 3: International equity portfolioExercise 4: Examining risk factors for international equity portfolioExercise 5: Historical simulationExercise 6: Estimating VaR and ESExercise 7: Option portfolio and Black ScholesExercise 8: Compute Black-Scholes price of an option
Exercise 9: Equity and implied volatility risk factorsExercise 10: Historical simulation for the option exampleExercise 11: Historical simulation of losses for option portfolioExercise 12: Estimating VaR and ES for option portfolioExercise 13: Computing VaR for weekly lossesExercise 14: Wrap-up

What is DataCamp?

Learn the data skills you need online at your own pace—from non-coding essentials to data science and machine learning.

Start Learning for Free