1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
root.dir <- "//WDSENTINEL/share/CorpCDOs"
source(file.path(root.dir, "code", "R", "intex_deal_functions.R"))
source(file.path(root.dir, "code", "R", "index_definitions.R"))
source(file.path(root.dir, "code", "R", "etdb.R"))
getdealdata <- function(dealnames){
sqlstring <- sprintf("select * from latest_clo_universe where dealname in ('%s')",
paste(dealnames, collapse="','"))
return( dbGetQuery(dbCon, sqlstring) )
}
workdate <- "2013-01-16"
dealnames <- listdealnames()
files <- list.files(path=file.path(root.dir, "Scenarios", paste("Portfolios", workdate, sep="_")), pattern="*.RData")
for(file in files){
load(file.path(root.dir, "Scenarios", paste("Portfolios", workdate, sep="_"), file))
sqlstring <- sprintf(paste0("UPDATE et_dealname_model_numbers SET spread = %s, cdopercentage = %s,",
"stale= %s WHERE dealname= '%s'"),
deal.spread,
deal.portfolio$cdopercentage,
deal.portfolio$stale,
strsplit(file, "\\.")[[1]][1])
dbGetQuery(dbCon, sqlstring)
}
|