summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuillaume Horel <guillaume.horel@gmail.com>2018-10-12 13:01:32 -0400
committerGuillaume Horel <guillaume.horel@gmail.com>2018-10-12 13:01:32 -0400
commitaaa78a5aeba58ef52adcd1fad27a0b1ae8fd8f5a (patch)
tree08a3de6a9f1df48df489916651af8d1b9e874b1d
parenta4f6952f4515bda0ee7bc37595569405a30d1174 (diff)
downloadpyisda-aaa78a5aeba58ef52adcd1fad27a0b1ae8fd8f5a.tar.gz
cleanup
-rw-r--r--pyisda/curve.pyx8
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, "