R/analytic_comp_pois.R

Defines functions analytic_cpois

Documented in analytic_cpois

#' Analytic option price formula under Compensated Poisson log-returns
#'
#' @param spot current underlying share price
#' @param strike the agreed upon strike price of the option
#' @param maturity the years until expiration (in trading years)
#' @param rate the discounting rate (i.e. the risk-neutral rate)
#' @param a the jump coefficient
#' @param b the compensator coefficient
#' @param what the type of option to price, call or put
#' @param t the current time
#' @description {Analytic European option prices under exponential compensated Poisson process.}
#' @return numerical
#' @export analytic_cpois
analytic_cpois <- function(spot, strike, maturity, rate, a, b, what = "put", t = 0)
{
  duration <- (maturity-t)
  lambda <- (rate+b)/(exp(a)-1)
  lambda_forward <- lambda*exp(a)
  beta <- log(strike/spot)
  x <- (beta+b*duration)/a
  if(what == "call")
  {
    price <- spot*(1-stats::ppois(x, lambda = lambda_forward*duration))-strike*exp(-rate*duration)*(1-stats::ppois(x, lambda = lambda*duration))
  } else if(what == "put")
  {
    price <- strike*exp(-rate*duration)*(stats::ppois(x, lambda = lambda*duration))-spot*(stats::ppois(x, lambda = lambda_forward*duration))
  }
  return(price)
}
shill1729/OptionPricer documentation built on June 11, 2020, 12:18 a.m.