Library: | finance |
See also: | ITTad ITTnewnodes ITT bitree grITTcrr |
Quantlet: | ITTcrr | |
Description: | builds up a constant-volatility trinomial tree and computes the option price of a given option with a given strike price |
Usage: | {ttree,optprice}=ITTcrr(S,K,r,sigma,time,opt,div) | |
Input: | ||
S | scalar; the spot price of the underlying | |
K | scalar; the exercise price | |
r | scalar; the CONTINUOUS interest rate from interval (0,1) | |
sigma | scalar; constant volatility | |
time | t x 1 vector; the time points | |
opt | scalar; 1 for a call option or 0 for a put option | |
div | scalar; the dividend rate from interval (0,1) | |
Output: | ||
ttree | matrix; the constant volatility trinomial tree - possible values of the stock price are in the upper "triangular". | |
optprice | scalar; the price of given option |
library("finance") library("graphic") S = 100 ; current index level K = 120 ; strike price r = 0.1 ; compounded riskless interest rate sigma = 0.2 ; constant volatility time = 0|1|3|6 ; time vector opt = 1 ; call option div = 0.05 ; dividend yield t=ITTcrr(S, K, r, sigma, time, opt, div) t.optprice ; show the option price tr=grITTcrr(t.ttree,time,0|0,1,2) d=createdisplay(1,1) show(d,1,1,tr)
Contents of optprice [1,] 14.992 A display of a trinomial tree with constant logarithmic spacing is returned additionally.