diff options
| author | Guillaume Horel <guillaume.horel@gmail.com> | 2017-04-13 12:25:03 -0400 |
|---|---|---|
| committer | Guillaume Horel <guillaume.horel@gmail.com> | 2017-04-13 12:37:23 -0400 |
| commit | 58aa1c21d9de2c76ec1da002bbe04936126233e5 (patch) | |
| tree | 84911601744b2d5def060cee4cabd075215e50fb | |
| parent | 5d810dc7e1a9ce094c8458bf8e2aba69e073709d (diff) | |
| download | pyisda-58aa1c21d9de2c76ec1da002bbe04936126233e5.tar.gz | |
fix hashing and pickling
| -rw-r--r-- | pyisda/legs.pyx | 9 |
1 files 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): |
