Skip to content
LeetQuant

Hard · Derivatives Pricing & Greeks · Coding · ~20 min · #31

Implied Volatility by Bisection

Implement implied_vol(price, S, K, T, r) that returns the Black–Scholes implied volatility of a European call (no dividends) given its market price.

Use a robust root-finding method. The Black–Scholes call price is strictly increasing in σ\sigma, so bisection on σ∈[10−6,5]\sigma \in [10^{-6}, 5] always converges when a solution exists. Return a float accurate to within 10−410^{-4}.

A helper bs_call is provided in the starter code.

Examples

Input: implied_vol(10.450583572185565, 100, 100, 1, 0.05)

Output: 0.2

Input: implied_vol(6.263001431193985, 100, 110, 0.5, 0.01)

Output: 0.35

Constraints

  • •

    0 < T ≤ 5, 0 ≤ r ≤ 0.1

  • •

    Input prices are consistent with some σ in (0, 5).

  • •

    Use only the Python standard library.

Hints · 0 of 3 shown

Worked solution

Give the problem an honest attempt first, then reveal the full explanation.

Related questions

Concepts

Implied volatilityBisectionMonotonicity of price in volatility

Relevant for

Quant DeveloperQuant ResearcherDesk Quant