search for: price_call

Displaying 2 results from an estimated 2 matches for "price_call".

2011 Aug 26
3
How to vectorize a function to handle two vectors
...*gamma); rplus <- (beta + d)/(2*gamma); rminus <- (beta - d)/(2*gamma); g <- rminus / rplus; D <- rminus * (1 - exp(-d*t))/ (1 - g*exp(-d*t)); C <- lambda * (rminus * t - 2/eta^2 * log( (1 - g*exp(-(d*t)))/(1 - g) ) ); return(exp(C*theta + D*v0)); } } Price_call <- function(phi, k, t) { integrand <- function(u){Re(exp(-1i*u*k)*phi(u - 1i/2, t)/(u^2 + 1/4))}; res <- 1 - exp(k/2)/pi*integrate(integrand,lower=0,upper=Inf)$value; return(res); } subHeston <- c(0.6067,-0.7571,0.2928,0.0707,0.0654); kV <- c(0.9,1,1.2,1.3) tV <- c(0....
2011 Aug 18
3
Error message: object of type 'closure' is not subsettable
...61 eta <- 0.002124704 theta <- 0.0001421415 v0 <- 0.0001421415 q <- 0.02145608 r <- 0.01268737 #----------------------------------------------------------------------------- #### The price of a Call option (Eq. (5.6) of The Volatility Surface, Gatheral) # In terms of log moneyness Price_call <- function(phi, k, t) { integrand <- function(u) {Re(exp(-1i*u*k)*phi(u - 1i/2, t)/(u^2 + 1/4))} res <- S0*exp(-q*t) - exp(k/2)/pi*integrate(integrand,lower=0,upper=Inf)$value return(res) } Price_callVec <- function(phi, k, t) { mapply(Price_call, phi, k, t) } # The characteric...