Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Call option formula for Geometric Laplace distributed stock
# Call option formula for Laplace distributed outcomes call <- function(r,S0,vol,K) { b<-vol/sqrt(2) d<-(log(S0/K)+r+log(1-b^2))/b if (d>0) { return(S0-K*exp(-r)+(b/(2*(1+b)))*K*exp(-r-d)) } else { return((b/(2*(1-b)))*K*exp(-r+d)) } } range<-0.5+1.5*ppoints(100) range2<-ppoints(12)/4 x<-c() for (vol in range2) { y<-c() for (k in range) { y<-c(y,call(0,1,vol,k))} x<-rbind(x,y) } matplot(range,t(x),type='l',xlab='Strikes',main='Call option prices for GLM') # Call option price through Monte Carlo for Laplace distributed outcomes call2 <- function(r,S0,vol,K,nsim) { b<-vol/sqrt(2) U<-runif(nsim)-0.5 L<--sign(U)*log(1-2*abs(U)) S<-S0*exp(r+log(1-b^2)+b*L) return(mean(exp(-r)*pmax(S-K,0))) } z<-c() for (vol in range2) { y<-c() for (k in range) { y<-c(y,call2(0,1,vol,k,10000))} z<-rbind(z,y) } matplot(range,t(z),type='l',xlab='Strikes',main='Call option prices (Monte Carlo)')
run
|
edit
|
history
|
help
0
Functions for partial factorials, factorials, binomial coeffs., & rows of Pascale's Triangle.
Ex11-03-21EdsonAmanda
03-08-2020-Derivada-Numerica
Regressão linear
Polynomial Regression with Interaction
voke
Change text from ALL CAPS to Title Case
Inferences for Two Population Means [Cement Hydration]
Mandelbrot 2
Hiring Activity