summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pyisda/credit_index.pyx7
1 files changed, 7 insertions, 0 deletions
diff --git a/pyisda/credit_index.pyx b/pyisda/credit_index.pyx
index 77f41cf..d13a8e9 100644
--- a/pyisda/credit_index.pyx
+++ b/pyisda/credit_index.pyx
@@ -200,6 +200,9 @@ cdef class CurveList:
copy.tickers = self.tickers
return copy
+ def __reduce__(self):
+ return (self.__class__, (self.curves, self.weights))
+
cdef class CreditIndex(CurveList):
def __init__(self, start_date, maturities, list curves, double[:] weights=None):
CurveList.__init__(self, curves, weights)
@@ -270,6 +273,10 @@ cdef class CreditIndex(CurveList):
copy.contingent_legs[i] = copyContingentLeg(self.contingent_legs[i])
return copy
+ def __reduce__(self):
+ return (self.__class__,
+ (TDate_to_pydate(self.start_date), self.maturities, self.curves, self.weights))
+
#@cython.initializedcheck(False)
def pv_vec(self, step_in_date, value_date, YieldCurve yc, double recovery_rate):
cdef: