From 44d70ed8307e29c0e4583175075dc7c420ba8880 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Pelletier?= Date: Sun, 16 Feb 2014 16:46:12 -0500 Subject: [PATCH] Ajout de la fonction putHeston et putEpps --- R/putEpps.R | 4 ++-- R/putHeston.R | 26 ++++++++++++++++++++++++++ man/putEpps.Rd | 8 ++++---- man/putHeston.Rd | 37 +++++++++++++++++++++++++++++++++++++ 4 files changed, 69 insertions(+), 6 deletions(-) create mode 100644 R/putHeston.R create mode 100644 man/putHeston.Rd diff --git a/R/putEpps.R b/R/putEpps.R index b340075..31104fb 100644 --- a/R/putEpps.R +++ b/R/putEpps.R @@ -8,8 +8,8 @@ #' European put option pricing using characteristic function #' #' As seen in Epps (2009) -#' @param char.fn Characteristic function of the price level at expiry time #' @param strikeprice Strike price, relative to a unit stock price +#' @param char.fn Characteristic function of the price level at expiry time #' @param eval.time Evaluation time #' @param expiry.time Expiry time #' @param rate Continuously compounded interest rate (force of interest) @@ -18,7 +18,7 @@ #' @return European put option price #' #' @author Francois Pelletier -putEpps <- function(char.fn,strikeprice,eval.time,expiry.time,rate,...,int.bounds=c(-Inf,Inf)) +putEpps <- function(strikeprice,char.fn,eval.time,expiry.time,rate,...,int.bounds=c(-Inf,Inf)) { # function to integrate (zhi) zhi <- function(x,char.fn,strikeprice,eval.time,expiry.time,rate,...) diff --git a/R/putHeston.R b/R/putHeston.R new file mode 100644 index 0000000..439ceb6 --- /dev/null +++ b/R/putHeston.R @@ -0,0 +1,26 @@ +# European put option pricing using Heston method +# +# Author: Francois Pelletier +# +# LGPL 3.0 +############################################################################### + +#' European put option pricing using Heston method +#' @param strikeprice Strike price, relative to a unit stock price +#' @param dist.fn Distribution function for the risk neutral log-price process +#' @param ess.dist.fn Esscher transformed (with h=1) distribution function for the risk neutral log-price process +#' @param eval.time Evaluation time +#' @param expiry.time Expiry time +#' @param rate Continuously compounded interest rate (force of interest) +#' @param ... Parameters of the distribution function dist.fn +#' @return European put option price +#' +#' @author Francois Pelletier +putHeston <- function(strikeprice,dist.fn,ess.dist.fn,eval.time,expiry.time,rate,...) +{ + exp(-rate*(expiry.time-eval.time)) * strikeprice*dist.fn(log(strikeprice),...) - + ess.dist.fn(log(strikeprice),...) +} + + + diff --git a/man/putEpps.Rd b/man/putEpps.Rd index 92cb8b9..13452c6 100644 --- a/man/putEpps.Rd +++ b/man/putEpps.Rd @@ -2,16 +2,16 @@ \alias{putEpps} \title{European put option pricing using characteristic function} \usage{ -putEpps(char.fn, strikeprice, eval.time, expiry.time, rate, ..., +putEpps(strikeprice, char.fn, eval.time, expiry.time, rate, ..., int.bounds = c(-Inf, Inf)) } \arguments{ - \item{char.fn}{Characteristic function of the price level - at expiry time} - \item{strikeprice}{Strike price, relative to a unit stock price} + \item{char.fn}{Characteristic function of the price level + at expiry time} + \item{eval.time}{Evaluation time} \item{expiry.time}{Expiry time} diff --git a/man/putHeston.Rd b/man/putHeston.Rd new file mode 100644 index 0000000..cd71629 --- /dev/null +++ b/man/putHeston.Rd @@ -0,0 +1,37 @@ +\name{putHeston} +\alias{putHeston} +\title{European put option pricing using Heston method} +\usage{ +putHeston(strikeprice, dist.fn, ess.dist.fn, eval.time, expiry.time, rate, ...) +} +\arguments{ + \item{strikeprice}{Strike price, relative to a unit stock + price} + + \item{dist.fn}{Distribution function for the risk neutral + log-price process} + + \item{ess.dist.fn}{Esscher transformed (with h=1) + distribution function for the risk neutral log-price + process} + + \item{eval.time}{Evaluation time} + + \item{expiry.time}{Expiry time} + + \item{rate}{Continuously compounded interest rate (force + of interest)} + + \item{...}{Parameters of the distribution function + dist.fn} +} +\value{ +European put option price +} +\description{ +European put option pricing using Heston method +} +\author{ +Francois Pelletier +} +