Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Black-Scholes European Call Pricing

MediumPython00:00
Practice interviewer
In session
5 left
00:00

Your question is Black-Scholes European Call Pricing. Start with the requirements on the right.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.

Problem

Implement a function to calculate the Black-Scholes price of a European call option.

Use continuous compounding and the standard normal cumulative distribution function. Return the option price as a floating-point number.

Signature: def black_scholes_call(S, K, T, r, sigma):

Inputs are spot price S, strike price K, time to expiration T in years, continuously compounded risk-free rate r, and volatility sigma. Define the price at T = 0 as max(S - K, 0), and handle sigma = 0 using its deterministic limit.

Constraints

  • 0 < S
  • 0 < K
  • 0 <= T
  • r may be positive, zero, or negative
  • 0 <= sigma
  • Use floating-point arithmetic
  • Answers are judged with a tolerance of 1e-9

Function Signature

def black_scholes_call(S, K, T, r, sigma):
Your solutionPython 3
You need to log in / sign up to run or submit.
Run your code to see test output