aboutsummaryrefslogtreecommitdiffstats
path: root/R/load_cf.R
diff options
context:
space:
mode:
Diffstat (limited to 'R/load_cf.R')
-rw-r--r--R/load_cf.R6
1 files changed, 5 insertions, 1 deletions
diff --git a/R/load_cf.R b/R/load_cf.R
index ff9a8d6b..a8500225 100644
--- a/R/load_cf.R
+++ b/R/load_cf.R
@@ -1,5 +1,6 @@
library(RPostgreSQL)
library(RQuantLib)
+library(yaml)
args <- commandArgs(trailingOnly=TRUE)
@@ -69,7 +70,10 @@ getdealcf <- function(dealnames, workdate=Sys.Date()){
sqldata <- dbGetQuery(dbCon, sqlstring)
cfdata[[dealname]]$mv <- mv
cfdata[[dealname]]$currbal <- sqldata$"Curr Collat Bal"
- if(is.na(sqldata$"Reinv End Date")){
+ config <- file.path(file.path(root.dir, "Scenarios", paste("Intex curves", workdate, sep="_"), "csv"),
+ paste0(dealname, ".config"))
+ config <- yaml.load_file(config)
+ if(is.na(sqldata$"Reinv End Date")||!config$reinvflag){
tranches <- "COLLAT"
}else{
tranches <- c("COLLAT_INITIAL", "COLLAT_REINVEST")