aboutsummaryrefslogtreecommitdiffstats
path: root/R/cds_utils.R
diff options
context:
space:
mode:
Diffstat (limited to 'R/cds_utils.R')
-rw-r--r--R/cds_utils.R14
1 files changed, 9 insertions, 5 deletions
diff --git a/R/cds_utils.R b/R/cds_utils.R
index cdccbb78..d5ecaa4d 100644
--- a/R/cds_utils.R
+++ b/R/cds_utils.R
@@ -90,11 +90,15 @@ couponSchedule <- function(nextpaydate=NULL, maturity,
if(coupontype == "FLOAT" && !is.na(margin)) {
## if is.na(margin) probably letter of credit
## we floor the coupon at the current gross rate
- if( missing(liborfloor) ) {
- coupons <- pmax(currentcoupon, forwards + margin)
- } else {
- coupons <- pmax(forwards, liborfloor) + margin
- }
+ coupons <- if( missing(liborfloor) ) {
+ if( is.na(currentcoupon) ) {
+ forwards + margin
+ } else {
+ pmax(currentcoupon, forwards + margin)
+ }
+ } else {
+ pmax(forwards, liborfloor) + margin
+ }
} else {
coupons <- rep(currentcoupon, length(dates))
}