diff options
| -rw-r--r-- | pyisda/credit_index.pyx | 14 | ||||
| -rw-r--r-- | pyisda/curve.pxd | 1 |
2 files changed, 13 insertions, 2 deletions
diff --git a/pyisda/credit_index.pyx b/pyisda/credit_index.pyx index b229cdd..f058839 100644 --- a/pyisda/credit_index.pyx +++ b/pyisda/credit_index.pyx @@ -507,9 +507,19 @@ cdef class CreditIndex(CurveList): TDate maturity_c = pydate_to_TDate(maturity) unsigned long mask = fill_mask(maturity_c, self._maturities, self._curves[0]) shared_ptr[TCurve] sc + TCurve* sc_orig, *sc_copy + size_t i + if inplace: + for sc in self._curves: + tweak_curve(sc.get(), sc.get(), epsilon, mask) + else: + for i in range(self._curves.size()): + sc_orig = self._curves[i].get() + sc_copy = JpmcdsCopyCurve(sc_orig) + tweak_curve(sc_orig, sc_copy, epsilon, mask) + self._curves[i].reset(sc_copy, JpmcdsFreeTCurve) + - for sc in self._curves: - tweak_curve(sc.get(), sc.get(), epsilon, mask) def survival_matrix(self, TDate[:] schedule): cdef: diff --git a/pyisda/curve.pxd b/pyisda/curve.pxd index 6064c75..c30f502 100644 --- a/pyisda/curve.pxd +++ b/pyisda/curve.pxd @@ -202,6 +202,7 @@ cdef extern from "<memory>" namespace "std" nogil: shared_ptr() shared_ptr(T*, D) T* get() + void reset(T*, D) bool operator!() long use_count() |
