This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from math import * | |
# Cumulative standard normal distribution | |
def cdf(x): | |
return (1.0 + erf(x / sqrt(2.0))) / 2.0 | |
# Intermediate calculation used by both the Bjerksund Stensland 1993 and 2002 approximations | |
def phi(s, t, gamma, h, i, r, a, v): | |
lambda1 = (-r + gamma * a + 0.5 * gamma * (gamma - 1) * v**2) * t | |
dd = -(log(s / h) + (a + (gamma - 0.5) * v**2) * t) / (v * sqrt(t)) |
OlderNewer