Black Scholes期权定价模型

data BS;
   input S X r v T;
      d1 = (log(S/X) + (r+v**2/2)*T)/v/sqrt(T);
      d2 = d1 - v*sqrt(T);
   *编辑公式计算买权call和卖put的定价;
      C = S*cdf('Normal',d1) - X*exp(-r*T)*cdf('Normal',d2);
      P = X*exp(-r*T)*cdf('Normal',-d2) - S*cdf('Normal',-d1);
      *利用sas自带函数计算期权定价;
      CALL=blkshclprc(X,T,S,R,V);
      PUT =BLKSHPTPRC(X,T,S,R,V);
label 
   S = 'Spot Price'
   X = 'Strike Price' 
   r = 'Risk Free Rate'
   v = 'Volatility'
   T = 'Time Periods'
   C = 'BS Call Price'
   P = 'BS Put Price' ;

* Input as many input values as needed;

cards;
120 95 0.08 0.2 3
120 100 0.08 0.2 3
120 110 0.08 0.2 3
120 120 0.08 0.2 3
;
run;

 


参考:

http://wiki.mbalib.com/wiki/Black-Scholes%E6%9C%9F%E6%9D%83%E5%AE%9A%E4%BB%B7%E6%A8%A1%E5%9E%8B

http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000245860.htm

http://www.espenhaug.com/black_scholes.html

你可能感兴趣的:(c,input)