R/pide_kou.R

Defines functions pide_kou

Documented in pide_kou

#' Solve a PIDE/variational inequality under Kou's jump-diffusion dynamics
#' 
#' @param spot the spot price
#' @param strike the strike sprice
#' @param maturity the maturity of the option contract
#' @param parameters the vector of parameters, see details.
#' @param what the payoff to use
#' @param style 'european' for PDE/PIDE problems, 'american' for variational inequalities
#' @param output "greeks", "price" or "grid" for the format to return the solution in
#' @param N the time resolution
#' @param M the space resolution
#' @param L the jump resolution
#' 
#' @description {Solve a PIDE/variational equality under Kou's jump-diffusion dynamics using an implicit-explicit finite difference scheme. A composite trapezoid rule
#' is used to approximate the jump-integral term.}
#' @details {The vector \code{parameters} must contain:
#' \itemize{
#' \item \code{rate} the risk-neutral rate
#' \item \code{div} the dividend yield rate
#' \item \code{volat} the annual volatility
#' \item \code{lambda} the mean rate of jumps per year
#' \item \code{prob} the probability of upward jump
#' \item \code{alpha} the mean size of upward jumps
#' \item \code{beta} the mean size of downward jumps
#' \item \code{ku} the displacement from the origin of upward jumps
#' \item \code{kd} the displacement from the origin of downward jumps
#' }}
#' @export pide_kou
pide_kou <- function(spot, strike, maturity, parameters, what = "call", style = "american", output = "greeks", N = 200, M = 200, L = 101)
{
  if(output == "greeks")
  {
    x <- data.frame(t(pide_kou_greeks(spot, strike, maturity, parameters, N, M, L, what, style)))
    names(x) <- c("fee", "delta", "gamma", "theta")
    return(x)
  } else if(output == "price")
  {
    return(pide_kou_price(spot, strike, maturity, parameters, N, M, L, what, style))
  } else if(output == "grid")
  {
    return(pide_kou_grid(spot, strike, maturity, parameters, N, M, L, what, style))
  } else{
    stop("argument 'output' must be: greeks, price, or grid ")
  }
}
shill1729/OptionPricer documentation built on June 11, 2020, 12:18 a.m.