diff options
| author | Guillaume Horel <guillaume.horel@gmail.com> | 2020-02-11 17:02:57 -0500 |
|---|---|---|
| committer | Guillaume Horel <guillaume.horel@gmail.com> | 2020-02-11 17:02:57 -0500 |
| commit | 763dbaca8b403bb8c23ae318a5a2ff73e110a06f (patch) | |
| tree | fcaa3ea54f25bed522457651d9e92afa26502b9b | |
| parent | 65437122646d2e8ea250d784f96b6c4203e39325 (diff) | |
| download | pyisda-763dbaca8b403bb8c23ae318a5a2ff73e110a06f.tar.gz | |
check for nan in coupon_rates too
| -rw-r--r-- | pyisda/curve.pyx | 4 |
1 files 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, " |
