diff options
| -rw-r--r-- | pyisda/credit_index.pyx | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/pyisda/credit_index.pyx b/pyisda/credit_index.pyx index 2f7a37b..1a63c26 100644 --- a/pyisda/credit_index.pyx +++ b/pyisda/credit_index.pyx @@ -1,4 +1,4 @@ -#cython: cdivision=True, boundscheck=False +#cython: cdivision=True, boundscheck=False, c_string_type=unicode, c_string_encoding=ascii from libc.stdlib cimport malloc, free from libc.math cimport nan from libc.string cimport memcpy, memset @@ -94,7 +94,7 @@ cdef class CurveList: def __getitem__(self, str ticker): cdef: - string ticker_cpp = ticker.encode() + string ticker_cpp = ticker map[string, size_t].iterator got = \ self.tickers.find(ticker_cpp) SpreadCurve sc @@ -119,7 +119,7 @@ cdef class CurveList: 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) + yield (sc.ticker, self._weights[p.second], sc) @property def weights(self): @@ -136,7 +136,7 @@ cdef class CurveList: cdef pair[string, size_t] p cdef np.ndarray out = np.PyArray_EMPTY(1, &shape, np.NPY_OBJECT, 1) for p in self.tickers: - out[p.second] = p.first.decode('utf-8') + out[p.second] = p.first return out @property @@ -328,7 +328,7 @@ cdef class CreditIndex(CurveList): for p in self.tickers: sc = self._curves[p.second].get() - tickers.append(p.first.decode()) + tickers.append(p.first) for j in range(self._maturities.size()): JpmcdsContingentLegPV(self.contingent_legs[j], sc.fBaseDate, @@ -489,7 +489,7 @@ cdef class CreditIndex(CurveList): for p in self.tickers: sc = self._curves[p.second] - tickers[p.second] = p.first.decode('utf-8') + tickers[p.second] = p.first for i in range(n[1]): sp[p.second, i] = JpmcdsForwardZeroPrice(sc.get(), self.base_date, schedule[i]) return sp, tickers |
