From 7f8e946adea0a906a9afddd3423bb27a8df2b475 Mon Sep 17 00:00:00 2001 From: Guillaume Horel Date: Thu, 15 Mar 2018 14:22:07 -0400 Subject: call constructor instead --- pyisda/credit_index.pyx | 31 +------------------------------ 1 file changed, 1 insertion(+), 30 deletions(-) diff --git a/pyisda/credit_index.pyx b/pyisda/credit_index.pyx index e311560..4e4c0c9 100644 --- a/pyisda/credit_index.pyx +++ b/pyisda/credit_index.pyx @@ -160,39 +160,10 @@ cdef class CurveList: @curves.setter def curves(self, list l not None): - cdef: - size_t len_l = len(l) - size_t i - SpreadCurve sc - map[string, size_t].iterator it - self._curves.clear() self.tickers.clear() self._weights.clear() - - sc = l[0] - self.T.resize(sc._thisptr.get().fNumItems) - self.base_date = sc._thisptr.get().fBaseDate - - for i in range(self.T.size()): - self.T[i] = (sc._thisptr.get().fArray[i].fDate - self.base_date) / 365. - - i = 0 - for sc in l: - it = self.tickers.find(sc.ticker) - if it == self.tickers.end(): - self.tickers[sc.ticker] = i - if sc is not None: - self._curves.push_back(sc._thisptr) - else: - self._curves.push_back(shared_ptr[TCurve]()) - self._weights.push_back(1.) - i += 1 - else: - self._weights[deref(it).second] += 1 - - for i in range(self._curves.size()): - self._weights[i] /= len_l + CurveList.__init__(self, l) # def __deepcopy__(self, memo): # cdef: -- cgit v1.2.3-70-g09d2