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

1 Answer 1


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.

  • 1
    $\begingroup$ Thanks very much Phil-ZXX. I'm wondering if you can help me understand something basic. In my example above, the current price is over the strike price. The volatility is extreme but I'm still having trouble understanding why the price of the binary option (which I'm interpreting as the probability of expiring in the money) would be below 50 (50% odds). Assuming a random walk from the current price, isn't it more likely that it would expire above the strike? Thanks alot! $\endgroup$
    – Snapula
    Commented Jul 25, 2018 at 18:09
  • $\begingroup$ @Snapula better ask a new question to give other people the chance to respond as well. It's not ideal to leave everything in the comment section $\endgroup$
    – Phil-ZXX
    Commented Jul 25, 2018 at 23:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.