附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