aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--R/calibration.R7
1 files changed, 7 insertions, 0 deletions
diff --git a/R/calibration.R b/R/calibration.R
index 79760284..2658576c 100644
--- a/R/calibration.R
+++ b/R/calibration.R
@@ -42,6 +42,10 @@ set.singlenamesdata <- function(index, tradedate){
running = quotes$spread_curve[i, tenor] * 1e-4,
upfront = quotes$upfront_curve[i, tenor] * 0.01,
recovery = as.double(quotes$recovery[i,tenor][1]))
+ if(all(is.na(quote$upfront))){
+ loginfo(paste("no quotes available for", quote$ticker))
+ return( NULL )
+ }
index$portfolio <- c(index$portfolio, buildSC(quote, cds.cs$cs, cds.cs$cdsdates))
}
index$issuerweights <- rep(1/length(index$portfolio), length(index$portfolio))
@@ -50,6 +54,9 @@ set.singlenamesdata <- function(index, tradedate){
}
set.tranchedata <- function(index, tradedate){
+ if(is.null(index)){
+ return( NULL )
+ }
temp <- get.tranchequotes(index$name, index$tenor, tradedate)
index$quotes <- data.frame(maturity=index$maturity,
refspread=temp$indexrefspread[1],