aboutsummaryrefslogtreecommitdiffstats
path: root/deal_pricer.R
diff options
context:
space:
mode:
Diffstat (limited to 'deal_pricer.R')
-rw-r--r--deal_pricer.R22
1 files changed, 0 insertions, 22 deletions
diff --git a/deal_pricer.R b/deal_pricer.R
deleted file mode 100644
index 0fb821de..00000000
--- a/deal_pricer.R
+++ /dev/null
@@ -1,22 +0,0 @@
-library(RPostgreSQL)
-drv <- dbDriver("PostgreSQL")
-dbCon <- dbConnect(drv, dbname="ET", user="et_user", password="Serenitas;1")
-dealnames <- dbGetQuery(dbCon, "select dealname from clo_universe")
-pricingcoverage <- c()
-for (dealname in dealnames$dealname){
- r <- dbGetQuery(dbCon, paste(
- paste("select sum(currentbalance* coalesce(b.bid,c.price))/sum(currentbalance) as wap,",
- "sum(currentbalance) as pricedbalance from et_collateral a",
- "left join latest_markit_prices b on a.loanxid=b.loanxid",
- "left join bloomberg_corp c on a.cusip=c.cusip",
- "where a.dealname='"),
- dealname,
- "' and coalesce(b.bid,c.price) is not Null",sep=""))
- s <- dbGetQuery(dbCon,
- paste("select sum(currentbalance) as totalbalance from et_collateral where dealname='",dealname,"'",sep=""))
- pricingcoverage <- rbind(pricingcoverage, c(dealname,r$wap,r$pricedbalance/s$totalbalance))
-}
-pricingcoverage <- data.frame(dealname=dealnames$dealname,wap=as.numeric(pricingcoverage[,2]), coverage = as.numeric(pricingcoverage[,3]))
-
-dbDisconnect(dbCon)
-