black formula was incorrect.
This commit is contained in:
parent
16c616ece1
commit
9dcdd91457
@ -47,9 +47,9 @@ def calculatePrice(f, k, r, t, v, cp):
|
||||
if v <= 0:
|
||||
return max(0, cp * (f - k))
|
||||
|
||||
d1 = (log(f / k) + (0.5 * pow(v, 2) + r) * t) / (v * sqrt(t))
|
||||
d1 = (log(f / k) + (0.5 * pow(v, 2)) * t) / (v * sqrt(t))
|
||||
d2 = d1 - v * sqrt(t)
|
||||
price = cp * (f * cdf(cp * d1) - k * cdf(cp * d2) * exp(-r * t))
|
||||
price = cp * (f * cdf(cp * d1) - k * cdf(cp * d2)) * exp(-r * t)
|
||||
return price
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user