diff options
Diffstat (limited to 'R/load_cf.R')
| -rw-r--r-- | R/load_cf.R | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/R/load_cf.R b/R/load_cf.R index 06780887..337b033c 100644 --- a/R/load_cf.R +++ b/R/load_cf.R @@ -200,9 +200,13 @@ getdealcf <- function(params, workdate=Sys.Date()){ Discounts=DC$discounts,
T=T, key="Date")
cfdata[[dealname]] <- list(mv = mv, currbal = sqldata$"Curr Collat Bal")
- config <- file.path(file.path(root.dir, "Scenarios", paste("Intex curves", workdate, sep="_"), "csv"),
- paste0(dealname, ".config"))
- config <- yaml.load_file(config)
+ configfile <- file.path(root.dir, "Scenarios", paste("Intex curves", workdate, sep="_"),
+ "csv", paste0(dealname, ".config"))
+ if(file.exists(configfile)){
+ config <- yaml.load_file(configfile)
+ }else{
+ config <- list(reinvflag=TRUE)
+ }
if(is.na(sqldata$"Reinv End Date")||!config$reinvflag){
tranches <- "COLLAT"
}else{
@@ -216,7 +220,6 @@ getdealcf <- function(params, workdate=Sys.Date()){ colnames(r) <- fields
for(i in 1:n.scenarios){
filename <- paste0(paste(toupper(dealname), tranche, "CF", paste0("Scen", i), sep="-"), ".txt")
-
conn <- unz(zip, filename)
data <- read.table(conn, sep="\t", header=TRUE, colClasses="character", comment.char="")
data <- data.table(data)
|
