2014-02-12 03:03:45 +00:00
|
|
|
# Put-Call Parity
|
|
|
|
#
|
|
|
|
# Author: Francois Pelletier
|
|
|
|
#
|
|
|
|
# LGPL 3.0
|
|
|
|
###############################################################################
|
|
|
|
|
|
|
|
|
|
|
|
#' Put-Call Parity
|
|
|
|
#' @param optionvalue Option price
|
|
|
|
#' @param strikeprice Strike price
|
|
|
|
#' @param eval.time Evaluation time
|
|
|
|
#' @param expiry.time Expiry time
|
|
|
|
#' @param rate Continuously compounded interest rate (force of interest)
|
|
|
|
#' @param toPut Boolean, Call to Put or Put to Call ?
|
|
|
|
#' @return Option price
|
2014-03-06 02:52:41 +00:00
|
|
|
#' @export putcallparity
|
2014-02-12 03:03:45 +00:00
|
|
|
#' @author François Pelletier
|
2014-03-06 02:52:41 +00:00
|
|
|
putcallparity <- function(optionvalue,strikeprice,eval.time,expiry.time,rate,toPut=TRUE)
|
2014-02-12 03:03:45 +00:00
|
|
|
{
|
|
|
|
if(toPut)
|
|
|
|
{
|
2014-03-06 02:52:41 +00:00
|
|
|
return(optionvalue-1+strikeprice*zerobond(eval.time,expiry.time,rate))
|
2014-02-12 03:03:45 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-03-06 02:52:41 +00:00
|
|
|
return(1+optionvalue-strikeprice*zerobond(eval.time,expiry.time,rate))
|
2014-02-12 03:03:45 +00:00
|
|
|
}
|
|
|
|
}
|