aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--R/calibration.R36
1 files changed, 31 insertions, 5 deletions
diff --git a/R/calibration.R b/R/calibration.R
index 7e3aafa7..51ab4fce 100644
--- a/R/calibration.R
+++ b/R/calibration.R
@@ -27,7 +27,7 @@ set.singlenamesdata <- function(index, tradedate){
tenor <- names(cds.cs$cdsdates)
index$portfolio <- list()
for(i in seq_along(quotes$tickers)){
- if(quotes$ticker[i] %in% c("IACI", "TITANC")){
+ if(quotes$ticker[i] %in% c("IACI", "TITANC", "ESPSAN", "CBRY")){
quotes$spread_curve[i,] <- rep(0.001,8)
quotes$upfront_curve[i,] <- rep(0,8)
quotes$recovery[i,] <- rep(0.4,8)
@@ -47,6 +47,10 @@ set.singlenamesdata <- function(index, tradedate){
}
index$portfolio <- c(index$portfolio, buildSC(quote, cds.cs$cs, cds.cs$cdsdates))
}
+ if(index$name == "EU9"){
+ index$issuerweights <- rep(0.08, 124)
+ index$issuerweights[quotes$ticker=="GDFS"] <- 0.08*2
+ }
index$issuerweights <- rep(1/length(index$portfolio), length(index$portfolio))
index$recov <- sapply(index$portfolio, attr, "recovery")
return( index )
@@ -89,14 +93,36 @@ set.tranchedata <- function(index, tradedate){
index$K <- adjust.attachments(K, index$loss, index$factor)
## convert snac prices to proper upfront
- if(substr(index$name,1, 2) %in% c("xo")){
+ if(index$type == "XO"){
+ coupon <- 500
temp$trancheupfrontmid[4] <- 100 * ( 1 - snacpv(index$cs, temp$trancherunningmid[4]*1e-4,
- 0.05, 0.4, tradedate))
- temp$trancherunningmid[4] <- 500
+ coupon*1e-4, 0.4, tradedate))
+ temp$trancherunningmid[4] <- coupon
+ }
+ if(index$type =="EU"){
+ if(index$series>=21){
+ coupon <- 100
+ temp$trancheupfrontmid[3] <- 100 * ( 1 - snacpv(index$cs, temp$trancherunningmid[3]*1e-4,
+ coupon*1e-4, 0, tradedate))
+ temp$trancheupfrontmid[4] <- 100 * ( 1 - snacpv(index$cs, temp$trancherunningmid[4]*1e-4,
+ coupon*1e-4, 0.4, tradedate))
+ temp$trancherunningmid[3:4] <- coupon
+ }else if(index$series == 9){
+ for(i in 4:5){
+ coupon <- 100
+ temp$trancheupfrontmid[i] <- 100 * ( 1 - snacpv(index$cs, temp$trancherunningmid[i]*1e-4,
+ coupon*1e-4, 0, tradedate))
+ temp$trancherunningmid[i] <- coupon
+ }
+ coupon <- 25
+ temp$trancheupfrontmid[6] <- 100 * ( 1 - snacpv(index$cs, temp$trancherunningmid[6]*1e-4,
+ coupon*1e-4, 0.4, tradedate))
+ temp$trancherunningmid[6] <- coupon
+ }
}
## compute dirty protection price
accrued <- cdsAccrued(tradedate, temp$trancherunningmid*1e-4)
- if(substr(index$name, 1, 2) %in% c("hy")){
+ if(index$type == "HY"){
dirtyquotes <- 1 - temp$trancheupfrontmid/100 - accrued
}else{
dirtyquotes <- temp$trancheupfrontmid/100 - accrued