diff options
| -rw-r--r-- | R/mlpdb.R | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -55,9 +55,6 @@ indexsplit <- function(indexname){ } get.tranchequotes <- function(indexname, tenor='5yr', date=Sys.Date()){ - sqlstr <- paste("select distinct quotesource, quotedate from tranche_quotes", - "where index='%s' and series=%s and quotedate::date='%s'", - "and tenor = '%s' order by quotedate desc") temp <- indexsplit(indexname) ## first try the easy way: sqlstr <- paste("select * from tranche_quotes", @@ -71,6 +68,9 @@ get.tranchequotes <- function(indexname, tenor='5yr', date=Sys.Date()){ ##else we work harder ##we get the list of distinct quotes + sqlstr <- paste("select distinct quotesource, quotedate from tranche_quotes", + "where index='%s' and series=%s and quotedate::date='%s'", + "and tenor = '%s' order by quotedate desc") distinct.quotes <- dbGetQuery(mlpdbCon, sprintf(sqlstr, temp$index, temp$series, date, tenor)) flag <- FALSE ##we loop through the disctinct quotes until we find a complete set |
