aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--R/mlpdb.R12
1 files changed, 9 insertions, 3 deletions
diff --git a/R/mlpdb.R b/R/mlpdb.R
index e1034973..7136a153 100644
--- a/R/mlpdb.R
+++ b/R/mlpdb.R
@@ -81,9 +81,15 @@ get.tranchequotes <- function(indexname, tenor='5yr', date=Sys.Date()){
flag <- FALSE
##we loop through the disctinct quotes until we find a complete set
for(i in 1:nrow(distinct.quotes)){
- sqlstr <- paste("select * from tranche_quotes where index='%s'",
- "and series=%s and tenor = '%s' and quotedate='%s'",
- "and detach not in(5,10) and quotesource='%s' order by attach asc")
+ if(temp$index == 'HY'){ ##don't want the tranchelets quoted by CITI
+ sqlstr <- paste("select * from tranche_quotes where index='%s'",
+ "and series=%s and tenor = '%s' and quotedate='%s'",
+ "and detach not in(5,10) and quotesource='%s' order by attach asc")
+ }else{
+ sqlstr <- paste("select * from tranche_quotes where index='%s'",
+ "and series=%s and tenor = '%s' and quotedate='%s'",
+ "and quotesource='%s' order by attach asc")
+ }
r <- dbGetQuery(mlpdbCon, sprintf(sqlstr, temp$index, temp$series, tenor,
distinct.quotes$quotedate[i],
distinct.quotes$quotesource[i]))