LIVE
connecting to the live quote stream…
--:--:--UTC
mediumFinance○
#03

Implied volatility by bisection

mediumFinanceacceptance —~25 min

Implement implied_vol(price, S, K, T, r) — the volatility sigma at which the Black-Scholes call price equals the observed price. Bisect on sigma between 0.01 and 3.0 until the interval is narrower than 1e-8, pricing with N from statistics.NormalDist.

Quotes come as prices; models think in vols. Inverting the pricer is how every implied-vol surface on every screen gets built, and the workbench's IV solver bot does exactly this — thousands of times per chain.

Return sigma rounded to 4 decimal places.

example 1
input
price=10.4506, S=100.0, K=100.0, T=1.0, r=0.05
output
0.2
example 2
input
price=8.26, S=100.0, K=100.0, T=0.5, r=0.05
output
0.25
constraints
  • price is attainable: 0 < price < S
  • 0 < T ≤ 5
  • 0 ≤ r ≤ 0.2
teacher · 2 hints · the first is free
↗ read the theory
the chapter this problem is cut from
▶ open in the workbench
run the same math on a real tape
●solution.py· utf-8 · spaces:4
ln 1, col 1tab indent · esc leave editor
python 3.13 · pyodide
+ 6 hidden on submit
input · keyword arguments to implied_vol()
price=10.4506, S=100.0, K=100.0, T=1.0, r=0.05
expected
0.2

the judge calls implied_vol() with exactly these inputs · outputs are compared to 6 decimal places

● standing bypython 3.13 in your browser · pyodide 0.28.3 · judged on the server to 6 dp⌘↵ run · ⌘⇧↵ submit
paper only · educational · not advice