diff options
Diffstat (limited to 'R/intex_deal_functions.R')
| -rw-r--r-- | R/intex_deal_functions.R | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/R/intex_deal_functions.R b/R/intex_deal_functions.R index 8f844598..8ccf6567 100644 --- a/R/intex_deal_functions.R +++ b/R/intex_deal_functions.R @@ -6,17 +6,6 @@ source(file.path(root.dir, "code", "R", "yieldCurve.R")) source(file.path(root.dir, "code", "R", "cds_functions_generic.R"))
source(file.path(root.dir, "code", "R", "etdb.R"))
source(file.path(root.dir, "code", "R", "tranche_functions.R"))
-load(file.path(root.dir, "code", "R", "bloomberg_data.RData"))
-
-cdorating <- function(cusip){
- return( sub("[0-9]","", dataMtge[dataMtge$CUSIP %in% cusip,]$RTG_MDY_INITIAL ))
-}
-
-getcollateral <- function(dealname, date=Sys.Date()){
- sqlstring <- sprintf("select * from et_aggdealinfo_historical('%s', '%s')", dealname, date)
- collatdata <- dbGetQuery(dbCon, sqlstring)
- return(collatdata)
-}
getdealdata <- function(dealnames){
sqlstring <- sprintf("select * from latest_clo_universe where dealname in ('%s')",
@@ -32,7 +21,7 @@ listdealnames <- function(){ cusip.data <- function(){
sqlstring <- "SELECT a.cusip, b.maturity, a.coupon AS grosscoupon, a.spread,
CASE WHEN a.floater_index like 'LIBOR%' THEN 'FLOAT' ELSE 'FIXED' END
-AS fixedorfloat from cusip_universe a LEFT JOIN latest_clo_universe b ON a.dealname = b.dealname"
+AS fixedorfloat, a.orig_moody from cusip_universe a LEFT JOIN latest_clo_universe b ON a.dealname = b.dealname"
data <- dbGetQuery(dbCon, sqlstring)
return( data )
}
@@ -174,8 +163,7 @@ buildSC <- function(line.item, reinvdate, dealmaturity, global.params, startdate ## cat(line.item$issuername, "\n")
if(!is.na(line.item$iscdo) && line.item$iscdo && is.na(line.item$price)){
##we have prices for some cdos e.g. 210795PS3
- orig.moody <- cdorating(line.item$cusip)
- if(length(orig.moody)==0){
+ if(length(line.item$orig.moody)==0){
orig.moody <- "NR"
}
line.item$price <- as.numeric(global.params$cdoprices[orig.moody])
@@ -230,7 +218,7 @@ buildSC.portfolio <- function(dealname, dealdata, cusipdata, global.params, star notionalvec <- c()
SCvec <- c()
betavec <- c()
- fields <- c("maturity", "fixedorfloat", "spread", "grosscoupon")
+ fields <- c("maturity", "fixedorfloat", "spread", "grosscoupon", "orig_moody")
for(i in 1:nrow(collatdata)){
line.item <- collatdata[i,]
if( is.na(line.item$maturity) ){
|
