aboutsummaryrefslogtreecommitdiffstats
path: root/R/serenitasdb.R
diff options
context:
space:
mode:
Diffstat (limited to 'R/serenitasdb.R')
-rw-r--r--R/serenitasdb.R3
1 files changed, 3 insertions, 0 deletions
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'",