(1)打开Excel-VBA或直接打开Excel按ALT+F11,贴上程序(见最后)。 (2)在excel当中建立如图表格,标黄部分需要手动变化。
(3)在C列相应表格输入以下公式。
(4)参数说明。
s,就是标的证券当前价格,文中以上证50ETF为例。
k,就是行权价,假设我们要算的是2.15的call和put。
t,年化的到期剩余日,这个地方要注意的是有人用365天来年化,也有人一年是用工作日255左右,文中使用的是255天
r,年利率,拿一年定存利率计算,以2%为例。
v,历史波动率,波动率是重要的内容,这边以40%为例。
附Excel-VBA程序:
Function cal_d1(s As Double, k As Double, t As Double, r As Double, v As Double) As Double
cal_d1 = (Log(s / k)+ (r + v ^ 2 / 2) * t) / (v * Sqr(t))
End Function
Function cal_d2(s As Double, k As Double, t As Double, r As Double, v As Double)
cal_d2 = cal_d1(s,k, t, r, v) - v * Sqr(t)
End Function
Functioncalloption(s As Double, k As Double, t As Double, r As Double, v As Double)
calloption = s *Application.NormSDist(cal_d1(s, k, t, r, v)) - k * Exp(-(r * t)) *Application.NormSDist(cal_d2(s, k, t, r, v))
End Function
Function putoption(s As Double, k As Double, t As Double, r As Double, v As Double)
putoption = k *Exp(-r * t) * Application.NormSDist(-cal_d2(s, k, t, r, v)) - s *Application.NormSDist(-cal_d1(s, k, t, r, v))
End Function
|