aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--R/mlpdb.R6
1 files changed, 3 insertions, 3 deletions
diff --git a/R/mlpdb.R b/R/mlpdb.R
index d45fd9df..c77d7c12 100644
--- a/R/mlpdb.R
+++ b/R/mlpdb.R
@@ -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