diff options
| -rw-r--r-- | pyisda/curve.pyx | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/pyisda/curve.pyx b/pyisda/curve.pyx index 65c37b5..798148c 100644 --- a/pyisda/curve.pyx +++ b/pyisda/curve.pyx @@ -1,4 +1,4 @@ -from libc.math cimport log1p, log, exp +from libc.math cimport log1p, log, exp, isnan from date cimport (JpmcdsStringToDateInterval, pydate_to_TDate, dcc, TMonthDayYear, JpmcdsDateIntervalToFreq, JpmcdsDateFwdThenAdjust, TDate_to_pydate, JpmcdsDateFromBusDaysOffset, JpmcdsStringToDayCountConv, ACT_360, @@ -472,7 +472,7 @@ cdef class SpreadCurve(Curve): @cython.boundscheck(False) @cython.wraparound(False) @cython.initializedcheck(False) - def __init__(self, today, YieldCurve yc, start_date, step_in_date, + def __init__(self, today, YieldCurve yc not None, start_date, step_in_date, cash_settle_date, end_dates, double[:] coupon_rates, double[:] upfront_rates, double[:] recovery_rates, bint pay_accrued_on_default=True, @@ -518,7 +518,7 @@ cdef class SpreadCurve(Curve): i = 0 for d in end_dates: end_dates_c[i] = pydate_to_TDate(d) - if upfront_rates[i] == upfront_rates[i]: + if not isnan(upfront_rates[i]): includes |= 1 << i i += 1 elif PyArray_CheckExact(end_dates): @@ -531,7 +531,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 upfront_rates[i] == upfront_rates[i]: + if not isnan(upfront_rates[i]): includes |= 1 << i else: raise ValueError("end_dates need to be a list of dates, " |
