aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--R/build_portfolios.R2
-rw-r--r--R/build_scenarios.R4
-rw-r--r--R/intex_deal_functions.R8
-rw-r--r--R/load_cf.R2
-rw-r--r--python/intex_scenarios.py2
-rw-r--r--python/load_cf.py4
6 files changed, 11 insertions, 11 deletions
diff --git a/R/build_portfolios.R b/R/build_portfolios.R
index 8acc94a3..33f3d15c 100644
--- a/R/build_portfolios.R
+++ b/R/build_portfolios.R
@@ -50,7 +50,7 @@ for(i in seq_along(dealnames)){
next
}
deal.data <- getdealdata(deal.name, calibration.date)
- if(is.na(deal.data$"Reinv End Date")){
+ if(is.na(deal.data$reinv_end_date)){
global.params$reinvflag <- FALSE
}
if(deal.data$"Curr Collat Bal" < 1 ||is.na(deal.data$maturity)||deal.data$maturity <= Sys.Date()+90){
diff --git a/R/build_scenarios.R b/R/build_scenarios.R
index 1e26f62d..4e29cb33 100644
--- a/R/build_scenarios.R
+++ b/R/build_scenarios.R
@@ -55,7 +55,7 @@ params <- yaml.load_file(file.path(root.dir, "code", "etc", "params.yml"))
for(j in seq_along(dealnames)){
load(file.path(root.dir, "Scenarios", paste("Portfolios", tradedate, sep="_"),
paste(dealnames[j], "RData", sep=".")))
- if(is.na(deal.data$"Reinv End Date")){
+ if(is.na(deal.data$reinv_end_date)){
reinvflags[j] <- FALSE
}
dp <- A$DP
@@ -129,7 +129,7 @@ for(j in seq_along(dealnames)){
recoverymonthly <- pmin(recoverymonthly,1)
recoverymonthly[!is.finite(recoverymonthly)] <- 100
- if(!is.na(deal.data$"Reinv End Date") && deal.data$"Reinv End Date" <= tradedate){
+ if(!is.na(deal.data$reinv_end_date) && deal.data$reinv_end_date <= tradedate){
## we cap rolling maturity at the current weighted average maturity of the portfolio
rollingmaturity <- (crossprod(sapply(deal.portfolio$SC, creditcurve.maturity),
deal.portfolio$notional)/sum(deal.portfolio$notional)
diff --git a/R/intex_deal_functions.R b/R/intex_deal_functions.R
index f9167b0e..6396136d 100644
--- a/R/intex_deal_functions.R
+++ b/R/intex_deal_functions.R
@@ -21,8 +21,8 @@ getdealdata <- function(dealname, workdate){
"dealname = '%s' and updatedate<='%s')")
sqlstring <- sprintf(sqlstring, dealname, dealname, workdate)
mv <- dbGetQuery(dbCon, sqlstring)$marketvalue
- sqlstring <- sprintf(paste0("select \"Curr Collat Bal\", \"Reinv End Date\", ",
- "\"Deal Next Pay Date\" , maturity, \"Principal Bal\" , \"Pay Day\" from ",
+ sqlstring <- sprintf(paste0("select \"Curr Collat Bal\", reinv_end_date, ",
+ "first_pay_date , maturity, \"Principal Bal\" , pay_day from ",
"historical_clo_universe('%s', '%s')"), dealname, workdate)
dealdata <- dbGetQuery(dbCon, sqlstring)
dealdata$mv <- mv
@@ -86,7 +86,7 @@ dealnamefromcusip <- function(cusips){
cusipsfromdealnames <- function(dealnames){
sqlstring <-
- sprintf("select unnest(\"Deal Cusip List\") from latest_clo_universe where dealname in ('%s')",
+ sprintf("select unnest(\"Deal Cusip List\") from deal_indicative where dealname in ('%s')",
paste(dealnames, collapse="','"))
return( dbGetQuery(dbCon, sqlstring)$unnest )
}
@@ -256,7 +256,7 @@ buildSC.portfolio <- function(dealname, dealdata, cusipdata, global.params, star
portfolio <- foreach(line.item = iter(collatdata, by='row')) %:% {
when( !is.na(line.item$maturity) && line.item$currentbalance > 1
&& line.item$assettype!="Equity") } %dopar% {
- buildSC(line.item, dealdata$"Reinv End Date", dealdata$maturity, global.params, startdate)
+ buildSC(line.item, dealdata$reinv_end_date, dealdata$maturity, global.params, startdate)
}
missingpricenotional <- sum(collatdata[is.na(price) & maturity>startdate &
(is.na(iscdo)|!iscdo), currentbalance])
diff --git a/R/load_cf.R b/R/load_cf.R
index 870ec999..7d187de9 100644
--- a/R/load_cf.R
+++ b/R/load_cf.R
@@ -106,7 +106,7 @@ getdealcf <- function(dealnames, zipfiles, tradedate=Sys.Date()){
T=T, key="Date")
cfdata[[dealname]] <- list(mv = dealdata$mv, currbal = dealdata$"Curr Collat Bal")
- if(is.na(dealdata$"Reinv End Date")||!config$reinvflag){
+ if(is.na(dealdata$reinv_end_date)||!config$reinvflag){
tranches <- "COLLAT"
}else{
tranches <- c("COLLAT_INITIAL", "COLLAT_REINVEST")
diff --git a/python/intex_scenarios.py b/python/intex_scenarios.py
index fe1200d0..2650b25a 100644
--- a/python/intex_scenarios.py
+++ b/python/intex_scenarios.py
@@ -57,7 +57,7 @@ def get_recovery(dealname, workdate, defaultrecovery = 50):
return float(recovery)
def get_reinvenddate(dealname):
- sqlstr = 'SELECT \"Reinv End Date\" from latest_clo_universe where dealname=%s'
+ sqlstr = 'SELECT reinv_end_date from deal_indicative where dealname=%s'
reinvenddate = query_db(sqlstr, params = (dealname,))[0]
if reinvenddate:
reinvenddate = reinvenddate.strftime("%Y%m%d")
diff --git a/python/load_cf.py b/python/load_cf.py
index c749b712..87ab59aa 100644
--- a/python/load_cf.py
+++ b/python/load_cf.py
@@ -70,8 +70,8 @@ def get_dist(date):
return {"L": np.array(dist[0]),"R": np.array(dist[1])}
def get_dealdata(dealname, tradedate):
- sqlstr = "select \"Curr Collat Bal\" AS currbal, \"Reinv End Date\", \"Deal Next Pay Date\"," \
- "maturity, \"Principal Bal\", \"Pay Day\" from historical_clo_universe(%s, %s)"
+ sqlstr = "select \"Curr Collat Bal\" AS currbal, reinv_end_date, first_pay_date," \
+ "maturity, \"Principal Bal\", pay_day from historical_clo_universe(%s, %s)"
data = {k: v for k, v in query_db(sqlstr, (dealname, tradedate)).items()}
data["mv"] = query_db("select marketvalue from latest_deal_model_numbers where dealname = %s",
(dealname,))[0]