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-03-06 02:52:41 +00:00
|
|
|
#' @export putEpps
|
2014-02-14 04:47:34 +00:00
|
|
|
#' @author Francois Pelletier
|
2014-05-24 15:26:40 +00:00
|
|
|
putEpps <- function(strikeprice,char.fn,param,eval.time,expiry.time,rate,...,int.bounds=c(-Inf,0))
|
2014-02-14 04:47:34 +00:00
|
|
|
{
|
|
|
|
# function to integrate (zhi)
|
2014-05-24 15:26:40 +00:00
|
|
|
zhi <- function(x,char.fn,param,strikeprice,eval.time,expiry.time,...)
|
2014-02-14 04:47:34 +00:00
|
|
|
{
|
|
|
|
Re(strikeprice^{-1i*x} *
|
2014-05-24 15:26:40 +00:00
|
|
|
char.fn(x,param,eval.time,expiry.time,...) /
|
2014-02-14 04:47:34 +00:00
|
|
|
(x*(1i+x)))
|
|
|
|
}
|
|
|
|
# function to integrate with strike price as first parameter
|
2014-05-24 15:26:40 +00:00
|
|
|
integrate.K <- function(strikeprice,zhi,char.fn,param,int.bounds,eval.time,expiry.time,rate,...)
|
2014-02-14 04:47:34 +00:00
|
|
|
{
|
|
|
|
exp(-rate*(expiry.time-eval.time)) *
|
|
|
|
strikeprice *
|
2014-05-24 15:26:40 +00:00
|
|
|
(.5 - integrate(zhi,int.bounds[1],int.bounds[2],char.fn,param,strikeprice,eval.time,expiry.time,...)$value / (pi))
|
2014-02-14 04:47:34 +00:00
|
|
|
}
|
2014-05-24 15:26:40 +00:00
|
|
|
lapply(as.list(strikeprice),integrate.K,zhi,char.fn,param,int.bounds,eval.time,expiry.time,rate,...)
|
2014-02-14 19:59:52 +00:00
|
|
|
}
|