From 58aa1c21d9de2c76ec1da002bbe04936126233e5 Mon Sep 17 00:00:00 2001 From: Guillaume Horel Date: Thu, 13 Apr 2017 12:25:03 -0400 Subject: fix hashing and pickling --- pyisda/legs.pyx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pyisda/legs.pyx b/pyisda/legs.pyx index 6decaa5..5b15cc8 100644 --- a/pyisda/legs.pyx +++ b/pyisda/legs.pyx @@ -32,14 +32,17 @@ cdef class ContingentLeg: free(self._thisptr) def __reduce__(self): - return (self.__class__, (TDate_to_pydate(self._thisptr.startDate), + return (self.__class__, (TDate_to_pydate(self._thisptr.startDate + + self._thisptr.protectStart), TDate_to_pydate(self._thisptr.endDate), self._thisptr.notional, self._thisptr.protectStart)) def __hash__(self): - return hash((self._thisptr.startDate, self._thisptr.endDate, - self._thisptr.notional, self._thisptr.protectStart)) + return hash((self._thisptr.startDate + self._thisptr.protectStart, + self._thisptr.endDate, + self._thisptr.notional, + self._thisptr.protectStart)) def pv(self, today, step_in_date, value_date, YieldCurve yc, SpreadCurve sc, double recovery_rate): -- cgit v1.2.3-70-g09d2