aboutsummaryrefslogtreecommitdiffstats
path: root/R/parse_intex.R
diff options
context:
space:
mode:
Diffstat (limited to 'R/parse_intex.R')
-rw-r--r--R/parse_intex.R18
1 files changed, 18 insertions, 0 deletions
diff --git a/R/parse_intex.R b/R/parse_intex.R
new file mode 100644
index 00000000..b9c52e07
--- /dev/null
+++ b/R/parse_intex.R
@@ -0,0 +1,18 @@
+root = "//WDSENTINEL/share/CorpCDOs"
+source(file.path(root, "R", "intex_deals_functions.R"))
+source(file.path(root, "R", "etdb.R"))
+dealnames <- c("limes", "stonln1")
+cusips <- cusipsfromdealnames(dealnames)
+
+deals.universe <- dbGetQuery(dbCon, "select distinct dealname from clo_universe order by dealname asc")$dealname
+cusips.universe <- cusipsfromdealnames(deals.universe)
+n.scenarios <- 100
+offset <- 2
+r <- data.frame()
+for(cusip in cusips){
+ data <- read.table(paste(cusip, "-PY.txt", sep=""), sep="\t", header=T, nrow=3)
+ price <- sum(as.numeric(sub("\\((.*)\\)", "-\\1", data[1,1:n.scenarios+offset])), na.rm=T)/n.scenarios
+ wal <- sum(as.numeric(sub("\\((.*)\\)", "-\\1", data[2,1:n.scenarios+offset])), na.rm=T)/n.scenarios
+ duration <- sum(as.numeric(sub("\\((.*)\\)", "-\\1", data[3,1:n.scenarios+offset])), na.rm=T)/n.scenarios
+ r <- rbind(r, data.frame(cusip, price, wal, duration))
+}