diff options
Diffstat (limited to 'R')
| -rw-r--r-- | R/new_index_series.R | 10 | ||||
| -rw-r--r-- | R/thetas-durations.R | 4 |
2 files changed, 7 insertions, 7 deletions
diff --git a/R/new_index_series.R b/R/new_index_series.R index fe234afc..238a7f90 100644 --- a/R/new_index_series.R +++ b/R/new_index_series.R @@ -66,7 +66,7 @@ newcurves <- function(indextype, series, basketid){ sqlstr <- paste0("INSERT INTO bbg_issuers", "(name, company_id, ticker, currency, seniority, doc_clause, cds_curve)", - "VALUES($1, $2, $3, $4, $5, $6, $7)") + "VALUES($1, $2, $3, $4, $5, $6, $7) ON CONFLICT DO NOTHING") with(prep.data, for(i in 1:nrow(prep.data)){ r <- dbSendQuery(serenitasdb, sqlstr, @@ -103,11 +103,11 @@ markit.mappings <- function(df){ } if(interactive()) { - basket.id <- newbasketID('HY', 26, 1, as.Date("2021-06-20"), 500) - df <- newcurves('HY', 26, basket.id) + basket.id <- newbasketID('IG', 28, 1, as.Date("2022-06-20"), 100) + df <- newcurves('IG', 28, basket.id) mappings <- data.frame(company_id = df$company_id, - markit_ticker=c("BLL","THEADT", "EQIX", "TRADIG", "TGRI-Ptnr", "ETE"), - seniority=c(rep("SNRFOR",3),"SUBLT2","SNRFOR","SECDOM"), coupon=500) + markit_ticker=c("ECACN","KINDERM", "JOHCON"), + seniority=rep("SNRFOR",3), coupon=100) markit.mappings(mappings) ## then update index_list in markit/import_quotes.py and rerun insert_cds } diff --git a/R/thetas-durations.R b/R/thetas-durations.R index 54e79f8f..b70b1726 100644 --- a/R/thetas-durations.R +++ b/R/thetas-durations.R @@ -76,11 +76,11 @@ sqlstr.duration <- paste("UPDATE index_quotes set duration=$1 where date=$2 and "and series=$4 and tenor=$5") sqlstr.theta <- paste("UPDATE index_quotes set theta=$1 where date=$2 and index=$3", "and series=$4 and tenor=$5") -for(index in c('IG', 'HY')){ +for(index in c('IG', 'HY')) { recov <- if(index=='IG') 0.4 else 0.3 coupon <- if(index=='IG') 0.01 else 0.05 tenors <- if(index=='IG') c("3yr", "5yr", "7yr", "10yr") else c("3yr", "5yr", "7yr") - for(series in 18:27){ + for(series in 18:28) { indexquotes <- get.indexquotes.table(index, series, tenors) if(nrow(indexquotes)==0){ next |
