diff options
| -rw-r--r-- | R/build_cds_database.R (renamed from R/build_cds_data.R) | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/R/build_cds_data.R b/R/build_cds_database.R index 3ef4b10e..2d9e30e9 100644 --- a/R/build_cds_data.R +++ b/R/build_cds_database.R @@ -5,6 +5,22 @@ dbCon <- dbConnect(drv, dbname="mlpdb", user="mlpdb_user", password="Serenitas1" host="debian") bbgConn <- blpConnect(host='192.168.1.108', port='8194') + +newbasketID <- function(series, offset){ + maturities <- c("2017-06-20", "2019-06-20", "2021-06-20", "2024-06-20") + tenors <- c("Y3", "Y5", "Y7", "Y10") + sqlstr <- "INSERT INTO index_desc VALUES(%s, '%s', %s, '%s', '%s', 100, 0)" + indices <- c("HY", "IG") + for(i in seq_along(indices)){ + for(j in seq_along(tenors)){ + stmt <- sprintf(sqlstr, offset + 10*i, indices[i], series, + maturities[j], tenors[j]) + dbSendQuery(dbCon, stmt) + } + + } +} + ig.indices <- c("19", "21", "22") igpattern <- "CDXIG5%s Curncy" hy.indices <- c("15", "17", "19", "21", "22") @@ -12,6 +28,8 @@ hypattern <- "CDXHY5%s Curncy" itraxx.indices <- c("19", "20", "21") itraxxpattern <- "ITXEB5%s Curncy" + + ##assign all the member to the variables IGx, HYx and EUx for(index in ig.indices){ assign(paste0("IG", index), bds(bbgConn, sprintf(igpattern, index), "INDX_MEMBERS")) |
