diff options
| -rw-r--r-- | pyisda/credit_index.pxd | 1 | ||||
| -rw-r--r-- | pyisda/credit_index.pyx | 5 |
2 files changed, 6 insertions, 0 deletions
diff --git a/pyisda/credit_index.pxd b/pyisda/credit_index.pxd index 005d166..e52a33d 100644 --- a/pyisda/credit_index.pxd +++ b/pyisda/credit_index.pxd @@ -11,6 +11,7 @@ cdef class CurveList: cdef vector[double] T cdef vector[shared_ptr[TCurve]] curves cdef unordered_map[string, size_t] tickers + cdef vector[double[:]] recovery_rates cdef class CreditIndex(CurveList): cdef TDate start_date diff --git a/pyisda/credit_index.pyx b/pyisda/credit_index.pyx index c93b177..8bfc769 100644 --- a/pyisda/credit_index.pyx +++ b/pyisda/credit_index.pyx @@ -43,8 +43,10 @@ cdef class CurveList: self.tickers[sc.ticker] = i if sc is not None: self.curves.push_back(sc._thisptr) + self.recovery_rates.push_back(sc.recovery_rates) else: self.curves.push_back(shared_ptr[TCurve]()) + #self.recovery_rates.push_back(double[:]) self.weights.push_back(1.) i += 1 else: @@ -69,6 +71,7 @@ cdef class CurveList: else: sc = SpreadCurve.__new__(SpreadCurve) sc._thisptr = self.curves[deref(got).second] + sc.recovery_rates = self.recovery_rates[deref(got).second] sc.ticker = ticker_cpp return sc @@ -82,6 +85,7 @@ cdef class CurveList: sc = SpreadCurve.__new__(SpreadCurve) sc._thisptr = self.curves[p.second] sc.ticker = p.first + sc.recovery_rates = self.recovery_rates[p.second] yield (sc.ticker.decode(), self.weights[p.second], sc) @property @@ -107,6 +111,7 @@ cdef class CurveList: sc = SpreadCurve.__new__(SpreadCurve) sc._thisptr = self.curves[p.second] sc.ticker = p.first + sc.recovery_rates = self.recovery_rates[p.second] r.append(sc) return r |
