diff options
Diffstat (limited to 'R/cds_utils.R')
| -rw-r--r-- | R/cds_utils.R | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/R/cds_utils.R b/R/cds_utils.R index 2a93c52f..63487e22 100644 --- a/R/cds_utils.R +++ b/R/cds_utils.R @@ -165,3 +165,10 @@ yearFrac <- function(date1, date2, daycount="act/365") { "act/365"=as.numeric( (as.Date(date2) - as.Date(date1)) / 365),
"act/360"=as.numeric( (as.Date(date2) - as.Date(date1)) / 360) )
}
+
+load.index <- function(index.name){
+ ## load index.name into the parent environment
+ indices <- yaml.load_file(file.path(root.dir, "code", "R", "index_definitions.yml"))
+ 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()))
+}
|
