From 9dcdd914578ad795040399e580e99d3f68a23c12 Mon Sep 17 00:00:00 2001 From: shuo_at_work Date: Thu, 4 Jan 2018 10:22:22 +0800 Subject: [PATCH] black formula was incorrect. --- vnpy/pricing/black.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vnpy/pricing/black.py b/vnpy/pricing/black.py index e1a28ce8..7649c409 100644 --- a/vnpy/pricing/black.py +++ b/vnpy/pricing/black.py @@ -46,10 +46,10 @@ def calculatePrice(f, k, r, t, v, cp): # 如果波动率为0,则直接返回期权空间价值 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 #----------------------------------------------------------------------