aboutsummaryrefslogtreecommitdiffstats
path: root/R/calibration.R
diff options
context:
space:
mode:
Diffstat (limited to 'R/calibration.R')
-rw-r--r--R/calibration.R7
1 files changed, 4 insertions, 3 deletions
diff --git a/R/calibration.R b/R/calibration.R
index 38f7d329..b6a05c91 100644
--- a/R/calibration.R
+++ b/R/calibration.R
@@ -69,7 +69,7 @@ set.tranchedata <- function(index, tradedate){
stop("index is NULL")
}
temp <- get.tranchequotes(index$name, index$tenor, tradedate)
- if(is.null(temp)){
+ if(nrow(temp) == 0) {
stop(paste(index$name, "no quote for day", as.character(tradedate)))
}
index$quotes <- data.frame(maturity=index$maturity,
@@ -83,7 +83,7 @@ set.tranchedata <- function(index, tradedate){
}else{
index$quotes$price <- snacpv(index$cs, index$quotes$refspread[1]*1e-4, index$quotes$spread,
- 0.4, tradedate)
+ if (index$type %in% c("IG", "EU")) 0.4 else 0.3, tradedate)
}
if(length(indexpv(index, tradedate=tradedate)) == 1) {
stop("why am I stopping?")
@@ -135,7 +135,8 @@ set.tranchedata <- function(index, tradedate){
}else{
dirtyquotes <- temp$trancheupfrontmid/100 - accrued
}
- index$tranches <- data.frame(upfront=temp$trancheupfrontmid,
+ index$tranches <- data.frame(id = temp$id,
+ upfront=temp$trancheupfrontmid,
running=temp$trancherunningmid * 1e-4,
quotes=dirtyquotes,
mkt.delta=temp$tranchedelta,