diff options
| author | Guillaume Horel <guillaume.horel@gmail.com> | 2017-05-04 15:57:22 -0400 |
|---|---|---|
| committer | Guillaume Horel <guillaume.horel@gmail.com> | 2017-05-04 15:57:22 -0400 |
| commit | 64187dbf722a5c58d175b9e687326d6d5cf06b97 (patch) | |
| tree | 99323acee1d8c92a133848e43ab58994874fba05 | |
| parent | 58aa1c21d9de2c76ec1da002bbe04936126233e5 (diff) | |
| download | pyisda-64187dbf722a5c58d175b9e687326d6d5cf06b97.tar.gz | |
test for nan
| -rw-r--r-- | pyisda/curve.pyx | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/pyisda/curve.pyx b/pyisda/curve.pyx index 730e066..c188b1a 100644 --- a/pyisda/curve.pyx +++ b/pyisda/curve.pyx @@ -1,4 +1,4 @@ -from libc.stdlib cimport malloc, free +from libc.stdlib cimport malloc, free, calloc from libc.string cimport memcpy from libc.math cimport log1p from libcpp.vector cimport vector @@ -384,12 +384,15 @@ cdef class SpreadCurve(Curve): cdef int n_dates = len(end_dates) cdef TDate* end_dates_c = <TDate*>malloc(n_dates * sizeof(TDate)) cdef TCurve* curve = NULL + cdef TBoolean* includes = <TBoolean*>calloc(n_dates, sizeof(TBoolean)) cdef size_t i if cash_settle_date_c < yc._thisptr.get().fBaseDate: raise ValueError("cash_settle_date: {0} is anterior to yc's base_date: {1}". format(cash_settle_date, yc.base_date)) for i, d in enumerate(end_dates): end_dates_c[i] = pydate_to_TDate(d) + if upfront_rates[i] == upfront_rates[i]: + includes[i] = 1 cdef TStubMethod stub_type if JpmcdsStringToStubMethod(b"f/s", &stub_type) != 0: @@ -404,7 +407,7 @@ cdef class SpreadCurve(Curve): end_dates_c, &coupon_rates[0], &upfront_rates[0], - NULL, + includes, &recovery_rates[0], pay_accrued_on_default, NULL, |
