diff options
| -rw-r--r-- | R/calibration.R | 4 | ||||
| -rw-r--r-- | R/serenitasdb.R | 3 |
2 files changed, 7 insertions, 0 deletions
diff --git a/R/calibration.R b/R/calibration.R index 2658576c..fb7302b2 100644 --- a/R/calibration.R +++ b/R/calibration.R @@ -58,6 +58,10 @@ set.tranchedata <- function(index, tradedate){ return( NULL ) } temp <- get.tranchequotes(index$name, index$tenor, tradedate) + if(is.null(temp)){ + loginfo(paste(inde$name, "no quote for that day")) + return(NULL) + } index$quotes <- data.frame(maturity=index$maturity, refspread=temp$indexrefspread[1], refprice=temp$indexrefprice[1]) diff --git a/R/serenitasdb.R b/R/serenitasdb.R index b8480c16..86299d41 100644 --- a/R/serenitasdb.R +++ b/R/serenitasdb.R @@ -80,6 +80,9 @@ get.tranchequotes <- function(indexname, tenor='5yr', date=Sys.Date()){ distinct.quotes <- dbGetQuery(serenitasdb, sprintf(sqlstr, temp$index, temp$series, date, tenor)) flag <- FALSE ##we loop through the disctinct quotes until we find a complete set + if(nrow(distinct.quotes)==0){ + return(NULL) + } for(i in 1:nrow(distinct.quotes)){ if(temp$index == 'HY' && temp$series>=15){ ##don't want the tranchelets quoted by CITI sqlstr <- paste("select * from tranche_quotes where index='%s'", |
