再发一个不考虑未来股息现值的BS解析解的程序,大家比较一下
function [call,put]=blsc(s0,K,mu,T,sigma,q)
% 初始价格S,k为执行价格,mu为年收益率,T为时间长度(单位:年),年波动率sigma,连续红利率为q
d1 = log(s0/K) + (mu - q + sigma^2/2) * T;
d1 = d1 /(sigma*sqrt(T));
d2 = d1 - (sigma*sqrt(T));
d1(isnan(d1)) = 0;
d2(isnan(d2)) = 0;
call = s0* exp(-q*T) * normcdf( d1) - K* exp(-mu*T) * normcdf( d2);
put = K* exp(-mu*T) * normcdf(-d2) - s0* exp(-q*T) * normcdf(-d1);