Displaying 1 result from an estimated 1 matches for "optionprice".
2012 Mar 13
1
3D Black-Scholes Graph Help!
...- sigma * sqrt(t)
ifelse(call==TRUE,s*pnorm(d1) - k*exp(-r*t)*pnorm(d2),k*exp(-r*t)
* pnorm(-d2) - s*pnorm(-d1))
}
plotbs <- function(price){
#create
s<-seq(0,price,len=price/2)
k<-s
t<-0:5
sigma<-seq(0,0.9,by=.1)
#expand information
OptionPrice<-matrix(nrow=length(s),ncol=length(k))
for(i in 1:length(s)) OptionPrice[i,]<-mapply(blackscholes,s[i],k)
grid <- expand.grid(list(Time=t, UnderlyingPrice=s))
#plot
wireframe(OptionPrice~Time*UnderlyingPrice,data=grid,main="3D
Option",
drape=...