2014-02-14 04:47:34 +00:00
|
|
|
# European put option pricing using characteristic function
|
|
|
|
#
|
|
|
|
# Author: Francois Pelletier
|
|
|
|
#
|
|
|
|
# LGPL 3.0
|
|
|
|
###############################################################################
|
|
|
|
|
|
|
|
#' European put option pricing using characteristic function
|
|
|
|
#'
|
|
|
|
#' As seen in Epps (2009)
|
2014-02-22 18:29:17 +00:00
|
|
|
#' @param strikeprice Strike price vector, relative to a unit stock price
|
2014-02-16 21:46:12 +00:00
|
|
|
#' @param char.fn Characteristic function of the price level at expiry time
|
2014-02-14 04:47:34 +00:00
|
|
|
#' @param eval.time Evaluation time
|
|
|
|
#' @param expiry.time Expiry time
|
|
|
|
#' @param rate Continuously compounded interest rate (force of interest)
|
|
|
|
#' @param ... Parameters of the characteristic function
|
|
|
|
#' @param int.bounds Integration bounds for the integrate() method used. Defaults to infinite bounds.
|
2014-02-22 18:29:17 +00:00
|
|
|
#' @return European put option price vector
|
2014-02-14 04:47:34 +00:00
|
|
|
#'
|
|
|
|
#' @author Francois Pelletier
|
2014-02-16 21:46:12 +00:00
|
|
|
putEpps <- function(strikeprice,char.fn,eval.time,expiry.time,rate,...,int.bounds=c(-Inf,Inf))
|
2014-02-14 04:47:34 +00:00
|
|
|
{
|
|
|
|
# function to integrate (zhi)
|
|
|
|
zhi <- function(x,char.fn,strikeprice,eval.time,expiry.time,rate,...)
|
|
|
|
{
|
|
|
|
Re(strikeprice^{-1i*x} *
|
|
|
|
char.fn(x,strikeprice,eval.time,expiry.time,rate,...) /
|
|
|
|
(x*(1i+x)))
|
|
|
|
}
|
|
|
|
# function to integrate with strike price as first parameter
|
|
|
|
integrate.K <- function(strikeprice,zhi,int.bounds,eval.time,expiry.time,rate,...)
|
|
|
|
{
|
|
|
|
exp(-rate*(expiry.time-eval.time)) *
|
|
|
|
strikeprice *
|
|
|
|
(.5 - integrate(zhi,int.bounds[1],int.bounds[2],strikeprice,eval.time,expiry.time,rate,...)$value / (2*pi))
|
|
|
|
}
|
2014-02-14 19:59:52 +00:00
|
|
|
mclapply(as.list(strikeprice),integrate.K,zhi,int.bounds,eval.time,expiry.time,rate,...)
|
|
|
|
}
|