diff options
Diffstat (limited to 'R/cds_utils.R')
| -rw-r--r-- | R/cds_utils.R | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/R/cds_utils.R b/R/cds_utils.R index 0b9c81e8..e594ad7c 100644 --- a/R/cds_utils.R +++ b/R/cds_utils.R @@ -146,10 +146,10 @@ yearFrac <- function(date1, date2, daycount="act/365") { "act/360"=as.numeric( (as.Date(date2) - as.Date(date1)) / 360) )
}
-load.index <- function(index.name){
+load.index <- function(index.name, file = "index_definitions.yml"){
## load index.name into the parent environment
require(yaml)
- indices <- yaml.load_file(file.path(root.dir, "code", "R", "index_definitions.yml"))
+ indices <- yaml.load_file(file.path(root.dir, "code", "R", file))
indices[[index.name]]$maturity <- as.Date(indices[[index.name]]$maturity, as.Date("1970-01-01"))
assign(index.name, indices[[index.name]], env = parent.env(environment()))
}
|
