diff options
Diffstat (limited to 'R')
| -rw-r--r-- | R/cds_utils.R | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/R/cds_utils.R b/R/cds_utils.R index 09dee081..f7ab8708 100644 --- a/R/cds_utils.R +++ b/R/cds_utils.R @@ -40,8 +40,7 @@ addTenor <- function(date, tenor) { a <- as.numeric(attr(year, "capture.start"))
b <- a + attr(year, "capture.length") - 1
l <- as.numeric(substr(tenor, a,b))
- return ( adjust(calendar = "UnitedStates/GovernmentBond",
- seq(date, length=2, by=paste(l,"year"))[2]) )
+ return ( seq(date, length=2, by=paste(l,"year"))[2] )
}else{
stop("format not recognized")
}
@@ -118,7 +117,7 @@ IMMDate <- function(tradedate, type="next") { start.protection <- tradedate + 1
startyear <- as.numeric(format(start.protection, "%Y"))
startyear <- startyear - 1
- nextimmdates <- seq(as.Date(paste(startyear, 3, 20, sep="-")), length=7, by="3 months")
+ nextimmdates <- seq(as.Date(paste(startyear, 3, 20, sep="-")), length=9, by="3 months")
if(type == "next"){
val <- adjust(calendar = "UnitedStates/GovernmentBond",
nextimmdates[nextimmdates >= start.protection][1] )
|
