diff options
Diffstat (limited to 'R/tranches_RV_BC.R')
| -rw-r--r-- | R/tranches_RV_BC.R | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/R/tranches_RV_BC.R b/R/tranches_RV_BC.R index bd06e244..48f9847d 100644 --- a/R/tranches_RV_BC.R +++ b/R/tranches_RV_BC.R @@ -19,7 +19,7 @@ option_list <- list( help="Tenor of index1 [default %default]"),
make_option(c("-t2", "--tenor2"), default="5yr",
help="Tenor of index2 [default %default]"),
- make_option("--until", default=Sys.Date()-1, type="character"
+ make_option("--until", default=Sys.Date()-1, type="character",
help="last day to run [default %default]"))
args <- parse_args(OptionParser(option_list=option_list,
@@ -50,6 +50,9 @@ for(i in seq_along(runs$name1)){ tenor2 <<- tenor2[i]})
filename <- file.path(root.dir,"Tranche_data","Runs",
paste0(paste(index.name2, tenor2, "using", index.name1, tenor1),".csv"))
+ if(!file.exists(filename)){
+ args$update <- FALSE
+ }
if(args$update){
runfile <- read.csv(filename)
begin.date <- as.Date(runfile[nrow(runfile), 1])+1
@@ -64,9 +67,6 @@ for(i in seq_along(runs$name1)){ next
}
alldates <- seq(begin.date, as.Date(as.character(args$until)), by="1 day")
- if(index.name2=="ig19"){
- alldates <- alldates[alldates!=as.Date("2013-11-29")] ##people are lazy the day after Thanksgiving
- }
bus.dates <- alldates[isBusinessDay(calendar="UnitedStates/GovernmentBond", alldates)]
for(j in seq_along(bus.dates)){
@@ -74,7 +74,7 @@ for(i in seq_along(runs$name1)){ index1 <- load.index(index.name1, tenor1, tradedate)
index2 <- load.index(index.name2, tenor2, tradedate)
if(any(c(is.null(index1), is.null(index2)))){
- loginfo(paste("skipping pair ", index.name1, tenor1, index.name2, tenor2))
+ loginfo(paste("skipping pair", index.name1, tenor1, index.name2, tenor2))
break
}
accrued2 <- cdsAccrued(tradedate, index2$tranches$running)
|
