diff options
| -rw-r--r-- | R/load_bloomberg_data.R | 27 |
1 files changed, 3 insertions, 24 deletions
diff --git a/R/load_bloomberg_data.R b/R/load_bloomberg_data.R index 26fa09e6..99d4808d 100644 --- a/R/load_bloomberg_data.R +++ b/R/load_bloomberg_data.R @@ -2,19 +2,18 @@ library(Rbbg) if(.Platform$OS.type == "unix"){
root.dir <- "/home/share/CorpCDOs"
+ bbgCon <- blpConnect(host='192.168.1.108', port=8194, throw.ticker.errors=FALSE)
}else{
root.dir <- "//WDSENTINEL/share/CorpCDOs"
+ bbgCon <- blpConnect(throw.ticker.errors=FALSE)
}
load(file.path(root.dir, "data", "bloomberg_data.RData"))
-bbgCon <- blpConnect(throw.ticker.errors=FALSE)
-
fields.corp <- c("PX_LAST","LAST_UPDATE_DT","ISSUER","MATURITY","CPN","CPN_TYP",
"CPN_FREQ","FLT_SPREAD","LIBOR_FLOOR","LN_CURRENT_MARGIN",
"LN_COVENANT_LITE","SECOND_LIEN_INDICATOR","DEFAULTED", "PRICING_SOURCE")
-
corpcusips <- scan(file = file.path(root.dir, "data", "bbgcusips.txt"), what="char")
corpcusips <- unique(corpcusips)
secCorp <- paste(corpcusips, "Corp")
@@ -29,26 +28,6 @@ fh <- file(file.path(root.dir, "data", "bloomberg", write.csv(dataCorp, file=fh, row.names=F)
close(fh)
blpDisconnect(bbgCon)
-## fields.mtge <- c("LAST_UPDATE_DT", "ISSUER","MATURITY","CPN","CPN_TYP","CPN_FREQ","FLT_SPREAD","RTG_MOODY","RTG_MDY_INITIAL")
-## chunkSize <- 5000
-## dataMtge <- c()
-## for(i in 1:(length(mtgecusips)/chunkSize)){
-## cusipSample <- mtgecusips[((i-1)*chunkSize+1):(i*chunkSize)]
-## secMtge <- paste(cusipSample, "Mtge")
-## dataMtge <- rbind(dataMtge, bdp(bbgCon, secMtge, fields.mtge))
-## }
-## i <- i+1
-## secMtge <- paste(mtgecusips[((i-1)*chunkSize+1):length(mtgecusips)], "Mtge")
-## dataMtge <- rbind(dataMtge, bdp(bbgCon, secMtge, fields.mtge))
-## mtgecusips <- substr(rownames(dataMtge[which(!is.na(dataMtge$ISSUER)),]),1,9)
-## dataMtge <- dataMtge[which(!is.na(dataMtge$ISSUER)),]
-## rownames(dataMtge) <- substr(rownames(dataMtge), 1, 9)
-## dataMtge <- data.frame(CUSIP=rownames(dataMtge), dataMtge )
-## fh <- file(file.path(root.dir, "data", "bloomberg",
-## paste0("bloomberg_datamtge_", Sys.Date(), ".csv"), "wb"))
-## write.csv(dataMtge, file=fh, row.names=F)
-## close(fh)
-
## save(corpcusips, mtgecusips, dataCorp, dataMtge, file="bloomberg_data.RData")
-save(corpcusips, mtgecusips, dataCorp, dataMtge, file=file.path(root.dir, "data", "bloomberg_data.RData"))
+save(corpcusips, dataCorp, file=file.path(root.dir, "data", "bloomberg_data.RData"))
|
