diff options
| -rw-r--r-- | pyisda/credit_index.pyx | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/pyisda/credit_index.pyx b/pyisda/credit_index.pyx index d8187dd..207a8e0 100644 --- a/pyisda/credit_index.pyx +++ b/pyisda/credit_index.pyx @@ -460,21 +460,15 @@ cdef class CreditIndex(CurveList): TDate maturity_c = pydate_to_TDate(maturity) TContingentLeg* cl size_t i - int found + double cl_pv, r = 0 + TCurve* sc + double* recovery_rate - found = get_maturity_index(maturity_c, self._maturities) - if found == -1: + with nogil: cl = JpmcdsCdsContingentLegMake(self.start_date, maturity_c, 1., True) - else: - cl = self.contingent_legs[found] - cdef: - double cl_pv, r = 0 - TCurve* sc - double* recovery_rate - with nogil: with parallel(): for i in prange(self._curves.size()): sc = self._curves[i].get() @@ -491,7 +485,6 @@ cdef class CreditIndex(CurveList): deref(recovery_rate), &cl_pv) r += self._weights[i] * cl_pv - if found == -1: free(cl) return r |
