diff options
Diffstat (limited to 'R/load_cf.R')
| -rw-r--r-- | R/load_cf.R | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/R/load_cf.R b/R/load_cf.R index 27a8abce..b51d08d6 100644 --- a/R/load_cf.R +++ b/R/load_cf.R @@ -91,6 +91,10 @@ getdealcf <- function(dealnames, zipfiles, tradedate=Sys.Date()){ for(dealname in keys(dealnames)){
zip <- zipfiles[dealnames[[dealname]]]
dealdata <- getdealdata(dealname, tradedate)
+ if(dealdata$"Deal Next Pay Date">tradedate+90){
+ ## some new issue deals have next pay date too far back in the future
+ dealdata$"Deal Next Pay Date" <- seq(dealdata$"Deal Next Pay Date", length=2, by="-3 months")[2]
+ }
alldates <- getdealschedule(dealdata, "1 month")
config <- getconfig(dealname, tradedate)
@@ -133,7 +137,7 @@ getdealcf <- function(dealnames, zipfiles, tradedate=Sys.Date()){ k(r)
})
}
- if(length(names(cfdata[[dealname]]))==2){##meaning we existed early in the above loop
+ if(length(cfdata[[dealname]])<2+length(tranches)){##meaning we existed early in the above loop
cfdata[[dealname]] <- NULL
next
}
|
