Skip to content
All library documents

Correcting the d₂ Formula for a Black–Scholes Binary Option

Article Quant Q&A · Author: Snapula

Summary

The document explains a parenthesis error in a Python calculation of a cash-or-nothing binary option price using the Black–Scholes framework. The denominator in d₂ must include the product of volatility and the square root of time to expiry. Without parentheses, Python evaluates the division by volatility before multiplying by the square root of time, producing an incorrect d₂ and option value.

The answer says that correcting the grouping changes the result to approximately 0.390 and identifies it as the correct value for the stated inputs. This is a focused implementation correction, not a derivation of binary option pricing or a discussion of payout units, market conventions, or model assumptions. The example uses a zero interest rate and specifies volatility and time as inputs, but does not explore how changes in those assumptions affect the price.

Key ideas

  • In the binary option calculation, d₂ divides the full numerator by volatility times the square root of time.
  • Missing parentheses change Python’s order of operations and produce an incorrect result.
  • The document reports an approximate corrected option value for the example inputs.
  • The answer addresses an implementation error rather than broader model assumptions.

Tags

Full text
# Black-Scholes for Binary Option


# Black-Scholes for Binary Option












Something is wrong with this python code designed to apply Black Scholes to the price of a binary option (all or nothing, 0 or 100 payout).

The results I get here is 0.4512780109614. Which I know is wrong, can anyone point me to the error in the formula?

```
S = 110 #current_price
K = 100 #ATM strike
v = 1.20 #annualized volatility
r = 0.00 #interest rate
T =  0.44 #days remaining (annualized)

from scipy.stats import norm
from math import exp, log, sqrt

d2 = (log(S/K) + (r - 0.5 * v**2) * T) / v*sqrt(T)
print exp(-r * T) * norm.cdf(d2)
> 0.451278010961
```

## Answer by Phil-ZXX (score 2, accepted)

https://quant.stackexchange.com/a/40922

You are missing brackets around `v*sqrt(T)`. That is, `d2` should be

```
 d2 = (log(S/K) + (r - 0.5 * v**2) * T) / (v*sqrt(T))
```

Then you should get `0.390...`, which is the correct answer.

Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.