Library: | finance |
See also: | bitree IBTdk IBTbc IBTlocsigma IBTsdisplot |
Quantlet: | IBTvolaplot | |
Description: | shows the implied local volatility surface sigma(S,tau) in the implied tree at different time and stock price levels |
Usage: | IBTvolaplot(loc, step, startpoint, endpoint, m) | |
Input: | ||
loc | Matrix: 3 columns, which contain the stock prices, the time to expiration (by year), the estimated local implied volatility | |
step | scalar: the bandwidth of the time interval | |
startpoint | scalar: the startpoint giving the lowest limit in the strike dimension of the volatility surface | |
endpoint | scalar: the startpoint giving the highest limit in the strike dimension of the volatility surface | |
m | scalar: the number of the steps to be estimated |
library("finance") proc(sigma)=volafunc(K, S, time) sigma=0.1+(S-K)/S/10*0.5 endp r=0.03 ; riskless annual interest rate S=100 ; the underlying asset price lev=20 ; the number of time steps expiration=5 ; time to expiration ibtree=IBTdk(S, r, lev, expiration, "volafunc") ptree=ibtree.Tree prob=ibtree.prob deltat=expiration/lev m=20 loc=IBTlocsigma(ptree, prob,m, deltat) startpoint=50 endpoint=150 n=10 step=0.5 IBTvolaplot(loc, step, startpoint, endpoint, n)
a surface plot to show the local implied volatility in implied tree changing with time and stock price levels