在python中,可以使用期权价格计算。
from math import *
def bs_call(S,X,T,r,sigma):
d1 = (log(S/X)+(r+sigma*sigma/2.)*T)/(sigma*sqrt(T))
d2 = d1-sigma*sqrt(T)
return S*CND(d1)-X*exp(-r*T)*CND(d2)
请指导我怎么做(如果有的话,最好使用内置的函数)julia。
你可以使用 BS.jl
包--readme显示了如何使用它。请注意,它没有被注册,所以你必须要有 ]add https://github.com/felipenoris/BS.jl
来添加它。