Ajout des return() et update du namespace avec roxygen
This commit is contained in:
parent
38bf503e77
commit
3166d19feb
9 changed files with 20 additions and 25 deletions
10
NAMESPACE
10
NAMESPACE
|
@ -1,8 +1,2 @@
|
|||
export(callCarrMadan,
|
||||
dampedcfcallCarrMadan,
|
||||
EppsPulley.test,
|
||||
parity,
|
||||
putEpps,
|
||||
putHeston,
|
||||
zerobond
|
||||
)
|
||||
export(dampedcfcallCarrMadan)
|
||||
export(putcallparity)
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#' @param x Sample
|
||||
#' @param alpha Tolerance level
|
||||
#' @return A list containing the test statistics
|
||||
#'
|
||||
#' @export EppsPulley.test
|
||||
#' @author François Pelletier
|
||||
EppsPulley.test <- function(x,alpha=0.05)
|
||||
{
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
#' @param ... Parameters of the characteristic function
|
||||
#' @param fft.control Control parameters list for the FFT discretization
|
||||
#' @return A European call option price vector
|
||||
#'
|
||||
#' @export callCarrMadan
|
||||
#' @author Francois Pelletier
|
||||
callCarrMadan <- function(strikeprice,char.fn,eval.time,expiry.time,rate,alpha,
|
||||
...,fft.control=list(N=2^14,eta=.1))
|
||||
|
|
|
@ -17,15 +17,15 @@
|
|||
#' @param moneyness Boolean for moneyness of call option
|
||||
#' (TRUE if strike price is lower than stock price)
|
||||
#' @return Characteristic function value
|
||||
#'
|
||||
#' @export dampedcfcallCarrMadan
|
||||
#' @author Francois Pelletier
|
||||
dampedcfcallCarrMadan <- function(u,char.fn,eval.time,expiry.time,rate,alpha,...,moneyness=TRUE)
|
||||
{
|
||||
if(moneyness)
|
||||
{
|
||||
exp(-rate*(expiry.time-eval.time))*
|
||||
return(exp(-rate*(expiry.time-eval.time))*
|
||||
char.fn(u-1i*(alpha+1),expiry.time-eval.time,...) /
|
||||
(alpha^2+alpha-u^2+1i*u*(2*alpha+1))
|
||||
(alpha^2+alpha-u^2+1i*u*(2*alpha+1)))
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -35,8 +35,8 @@ dampedcfcallCarrMadan <- function(u,char.fn,eval.time,expiry.time,rate,alpha,...
|
|||
(1/(1+1i*u)-exp(rate*(expiry.time-eval.time))/
|
||||
(1i*u)-char.fn(u-1i,expiry.time-eval.time,...)/(u^2-1i*u))
|
||||
}
|
||||
(auxiliairyf(u-1i*alpha,char.fn,eval.time,expiry.time,rate,alpha,...)-
|
||||
auxiliairyf(u+1i*alpha,char.fn,eval.time,expiry.time,rate,alpha,...))/2
|
||||
return((auxiliairyf(u-1i*alpha,char.fn,eval.time,expiry.time,rate,alpha,...)-
|
||||
auxiliairyf(u+1i*alpha,char.fn,eval.time,expiry.time,rate,alpha,...))/2)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
#' @param ... Parameters of the characteristic function
|
||||
#' @param int.bounds Integration bounds for the integrate() method used. Defaults to infinite bounds.
|
||||
#' @return European put option price vector
|
||||
#'
|
||||
#' @export putEpps
|
||||
#' @author Francois Pelletier
|
||||
putEpps <- function(strikeprice,char.fn,eval.time,expiry.time,rate,...,int.bounds=c(-Inf,Inf))
|
||||
{
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#' @param rate Continuously compounded interest rate (force of interest)
|
||||
#' @param ... Parameters of the distribution function dist.fn
|
||||
#' @return European put option price
|
||||
#'
|
||||
#' @export putHeston
|
||||
#' @author Francois Pelletier
|
||||
putHeston <- function(strikeprice,dist.fn,ess.dist.fn,eval.time,expiry.time,rate,...)
|
||||
{
|
||||
|
|
|
@ -14,17 +14,17 @@
|
|||
#' @param rate Continuously compounded interest rate (force of interest)
|
||||
#' @param toPut Boolean, Call to Put or Put to Call ?
|
||||
#' @return Option price
|
||||
#'
|
||||
#' @export putcallparity
|
||||
#' @author François Pelletier
|
||||
parity <- function(optionvalue,strikeprice,eval.time,expiry.time,rate,toPut=TRUE)
|
||||
putcallparity <- function(optionvalue,strikeprice,eval.time,expiry.time,rate,toPut=TRUE)
|
||||
{
|
||||
if(toPut)
|
||||
{
|
||||
optionvalue-1+strikeprice*zerobond(eval.time,expiry.time,rate)
|
||||
return(optionvalue-1+strikeprice*zerobond(eval.time,expiry.time,rate))
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
1+optionvalue-strikeprice*zerobond(eval.time,expiry.time,rate)
|
||||
return(1+optionvalue-strikeprice*zerobond(eval.time,expiry.time,rate))
|
||||
}
|
||||
}
|
|
@ -15,7 +15,7 @@
|
|||
#' @param rate Continuously compounded interest rate (force of interest)
|
||||
#' @param face Face value
|
||||
#' @return Actualised price of bond
|
||||
#'
|
||||
#' @export zerobond
|
||||
#' @author François Pelletier
|
||||
|
||||
zerobond <- function(eval.time,expiry.time,rate,face=1)
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
\name{parity}
|
||||
\alias{parity}
|
||||
\name{putcallparity}
|
||||
\alias{putcallparity}
|
||||
\title{Put-Call Parity}
|
||||
\usage{
|
||||
parity(optionvalue, strikeprice, eval.time, expiry.time, rate, toPut = TRUE)
|
||||
putcallparity(optionvalue, strikeprice, eval.time, expiry.time, rate,
|
||||
toPut = TRUE)
|
||||
}
|
||||
\arguments{
|
||||
\item{optionvalue}{Option price}
|
Loading…
Add table
Reference in a new issue