From 763dbaca8b403bb8c23ae318a5a2ff73e110a06f Mon Sep 17 00:00:00 2001 From: Guillaume Horel Date: Tue, 11 Feb 2020 17:02:57 -0500 Subject: check for nan in coupon_rates too --- pyisda/curve.pyx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyisda/curve.pyx b/pyisda/curve.pyx index aaecddc..fe5ba62 100644 --- a/pyisda/curve.pyx +++ b/pyisda/curve.pyx @@ -580,7 +580,7 @@ cdef class SpreadCurve(Curve): i = 0 for d in end_dates: end_dates_c[i] = pydate_to_TDate(d) - if not isnan(upfront_rates[i]): + if not isnan(upfront_rates[i]) and not isnan(coupon_rates[i]): includes |= 1 << i i += 1 elif PyArray_CheckExact(end_dates): @@ -593,7 +593,7 @@ cdef class SpreadCurve(Curve): freeup = True _roll_date(today_c, tenors_c, n_dates, end_dates_c) for i in range(upfront_rates.shape[0]): - if not isnan(upfront_rates[i]): + if not isnan(upfront_rates[i]) and not isnan(coupon_rates[i]): includes |= 1 << i else: raise ValueError("end_dates need to be a list of dates, " -- cgit v1.2.3-70-g09d2