使用漂移参数为0.1,波动率为0.5的几何布朗运动模型,在图表中模拟50个样本路径,代表了在90天内股票价格为80美元的变化情况。垂直坐标轴表示价格选项,水平坐标轴表示时间。在图表中展示这一过程。计算在90天内期权价格上升至少到100美元的概率。
library(sde)
mu<-0.1
sigma<-0.5
P0<-80 #initial price
T <-90/360 #time in years
nt=10000 #number of trajectories within each simulation
n=100 #time periods
dt<-T/n #length of time periods
t <- seq(0,T,by=dt)
X=matrix(rep(0,length(t)*nt),nrow = nt)
for(i in 1:nt) {
X[i,]=GBM(x=P0, r=mu, sigma=sigma, T=T, N=n)
}
ymax=max(X); ymin=min(X) #bounds for simulated prices
plot(t,X[1,],type="l", ylim=c(ymin,ymax), col=1, xlab="Time", ylab="Price Y(t)")
for(i in 2:nt){
lines(t,X[i,], type='l', ylim=c(ymin, ymax), col=i)
}
Prob<-sum(nt>=100)/nt
Prob