if (FALSE) {
# define two vectos for the underlying and the volatility
und.seq <- seq(10,180,by=2)
vol.seq <- seq(0.1,0.9,by=0.1)
# evaluate them along with three scalar parameters
EOarr <- EuropeanOptionArrays("call", underlying=und.seq,
strike=100, dividendYield=0.01,
riskFreeRate=0.03,
maturity=1, volatility=vol.seq)
# and look at four of the result arrays: value, delta, gamma, vega
old.par <- par(no.readonly = TRUE)
par(mfrow=c(2,2),oma=c(5,0,0,0),mar=c(2,2,2,1))
plot(EOarr$parameters.underlying, EOarr$value[,1], type='n',
main="option value", xlab="", ylab="")
topocol <- topo.colors(length(vol.seq))
for (i in 1:length(vol.seq))
lines(EOarr$parameters.underlying, EOarr$value[,i], col=topocol[i])
plot(EOarr$parameters.underlying, EOarr$delta[,1],type='n',
main="option delta", xlab="", ylab="")
for (i in 1:length(vol.seq))
lines(EOarr$parameters.underlying, EOarr$delta[,i], col=topocol[i])
plot(EOarr$parameters.underlying, EOarr$gamma[,1],type='n',
main="option gamma", xlab="", ylab="")
for (i in 1:length(vol.seq))
lines(EOarr$parameters.underlying, EOarr$gamma[,i], col=topocol[i])
plot(EOarr$parameters.underlying, EOarr$vega[,1],type='n',
main="option vega", xlab="", ylab="")
for (i in 1:length(vol.seq))
lines(EOarr$parameters.underlying, EOarr$vega[,i], col=topocol[i])
mtext(text=paste("Strike is 100, maturity 1 year, riskless rate 0.03",
"\nUnderlying price from", und.seq[1],"to", und.seq[length(und.seq)],
"\nVolatility from",vol.seq[1], "to",vol.seq[length(vol.seq)]),
side=1,font=1,outer=TRUE,line=3)
par(old.par)
}
Run the code above in your browser using DataLab