用python进行简单欧式期权定价

来源:互联网 发布:映客直播android源码 编辑:程序博客网 时间:2024/04/27 18:04

python3.5版本

源代码:

###期权计算
from math import log,sqrt,exp
from scipy.stats import norm
def call_option_pricer(spot,strike,maturity,r,vol):
    d1=(log(spot/strike)+(r+0.5*vol*vol)*maturity)/vol/sqrt(maturity)
    d2=d1-vol*sqrt(maturity)
    price=spot*norm.cdf(d1)-strike*exp(-r*maturity)*norm.cdf(d2)
    return price
print('期权价格:%.4f'%call_option_pricer(spot=2.45,strike=2.5,maturity=0.25,r=0.05,
                                    vol=0.25))

我们想知道下面的一只期权的价格:

  • 当前价 spot : 2.45
  • 行权价 strike : 2.50
  • 到期期限 maturity : 0.25
  • 无风险利率 r : 0.05
  • 波动率 vol : 0.25

Call(S,K,r,τ,σ)d1d2= SN(d1)KerτN(d2),=ln(S/K)+(r+12σ2)τστ,=d1στ.

关于这样的简单欧式期权的定价,有经典的Black - Scholes [1] 公式:

其中S为标的价格,K为执行价格,r为无风险利率,τ=Tt为剩余到期时间。 N(x)为标准正态分布的累积概率密度函数。Call(S,K,r,τ,σ)为看涨期权的价格。

其中



0 0
原创粉丝点击