aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--R/yieldcurve.R9
1 files changed, 2 insertions, 7 deletions
diff --git a/R/yieldcurve.R b/R/yieldcurve.R
index 8e01797b..8608467c 100644
--- a/R/yieldcurve.R
+++ b/R/yieldcurve.R
@@ -38,13 +38,8 @@ basic.advance <- function(date, n, unit){
## n is the number of steps
## unit is the unit (belongs in "day", "month" or "year"
stopifnot(class(date)=="Date")
- unit <- switch(unit,
- year=1,
- month=2,
- day=3)
- ymd <- as.numeric(unlist(strsplit(as.character(date),"-")))
- ymd[unit] <- ymd[unit]+n
- return( as.Date(paste(ymd, collapse="-")))
+ return(seq.Date(date, length=2, by=paste(n, unit))[2])
+
}
buildMarkitYC <- function(MarkitData, futurequotes, dt=0.25){