aboutsummaryrefslogtreecommitdiffstats
path: root/R/cds_utils.R
diff options
context:
space:
mode:
Diffstat (limited to 'R/cds_utils.R')
-rw-r--r--R/cds_utils.R6
1 files changed, 3 insertions, 3 deletions
diff --git a/R/cds_utils.R b/R/cds_utils.R
index 9b830cef..3685056e 100644
--- a/R/cds_utils.R
+++ b/R/cds_utils.R
@@ -26,7 +26,7 @@ convertTenor <- function(tenor) {
}else if ( year != -1) {
a <- as.numeric(attr(year, "capture.start"))
b <- a + attr(year, "capture.length") - 1
- l <- as.numeric(substr(tenor, a,b))
+ l <- as.numeric(substr(tenor, a, b))
return ( 365 * l )
}else{
stop("format not recognized")
@@ -77,7 +77,7 @@ creditSchedule <- function(startdate, enddate) {
}
couponSchedule <- function(nextpaydate=NULL, maturity, frequency, coupontype, currentcoupon,
- margin, startdate=today()){
+ margin, startdate=Sys.Date()){
## computes the coupon schedule
## inputs:
## nextpaydate: first payment date of the coupon schedule
@@ -105,7 +105,7 @@ couponSchedule <- function(nextpaydate=NULL, maturity, frequency, coupontype, cu
dates <- c(dates, maturity)
}
}
- dates <- dates[ dates >= today()]
+ dates <- dates[ dates >= startdate]
DC <- switch(frequency,
S = DiscountCurve(L6m$params, L6m$tsQuotes, yearFrac(L6m$params$tradeDate, dates)),
Q = DiscountCurve(L3m$params, L3m$tsQuotes, yearFrac(L3m$params$tradeDate, dates)),