Keywords - Function groups - @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Library: finance
See also: spdbl greeks

Quantlet: spdbs
Description: Using the assumptions of the Black-Scholes call-option pricing formula this quantlet calculates the Black- Scholes State-Price Density, Delta and Gamma from call-options data

Reference(s):

Usage: bsspd=spdbs(X,s,r,div,sigma,tau)
Input:
X N x 1 vector of the terminal stock price (use strike price)
s N x 1 vector of the spot price
r N x 1 vector of the interest rate
div N x 1 vector of the dividend process
sigma N x 1 vector of the implied volatility
tau N x 1 vector of the time-to-maturity
Output:
bsspd.fbs N x 1 vector of Black-Scholes SPD
bsspd.delta N x 1 vector of Black-Scholes option delta
bsspd.gamma N x 1 vector of Black-Scholes option gamma

Example:
library("finance")
data=read("XFGJan1997.dat")
names=readm("XFGkeyJan1997.dat")
date=names.text[,1]
type=names.text[,2]
l=list(date,type,data)
ind=(l.date=="02.01.1997")&&(l.data[,2]==0.25)&&(l.type=="C")
smdata=paf(l.data,ind)
vola=smdata[,1]
tau=smdata[,2]
m=smdata[,3]
r=smdata[,4]./100
s=smdata[,5]
F=s.*exp(r.*tau)
K=m.*F
data=m~vola
div=0
;create a finer grid to match local polynomial SPD
bw=0.001
m2=grid(min(m),bw,(max(m)-min(m))/bw+1)
;original strike grid only has 9 points
;the grid must be reconstructed to allow for the interpolated points
;multiply by the scalar mean(F) since for one day worth of options F remains constant
k=m2.*mean(F)
bsspd=spdbs(k,mean(s),mean(r),div,mean(vola),mean(tau))
;rescaling SPD so it can be expressed in terms of moneyness
r2=m2~(bsspd.fbs.*mean(F))
;plotting Black-Scholes SPD
res2 = setmask(r2, "line","blue")
d=createdisplay(1,1)
show(d,1,1,res2)
title="Black-Scholes SPD: 02-01-1997 tau=0.25"
xlabel="moneyness"
ylabel="density"
setgopt(d,1,1,"title",title,"xlabel",xlabel,"ylabel",ylabel)

Result:
Black-Scholes State-Price Density, Delta and Gamma for
January 2, 1997 with a time-to-maturity of 0.25 years
It also produces a plot of Black-Scholes SPD.



Author: K. Huynh, P. Kervella, W. Haerdle, 20010720 license MD*Tech
(C) MD*TECH Method and Data Technologies, 05.02.2006