diff options
| -rw-r--r-- | pyisda/curve.pyx | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/pyisda/curve.pyx b/pyisda/curve.pyx index cbe2174..730e066 100644 --- a/pyisda/curve.pyx +++ b/pyisda/curve.pyx @@ -34,7 +34,7 @@ cdef class Curve(object): def __getstate__(self): cdef TCurve* curve = self._thisptr.get() - cdef int num_items = curve.fNumItems; + cdef int num_items = curve.fNumItems return (num_items, <bytes>(<char*>curve.fArray)[:sizeof(TRatePt)*num_items], curve.fBaseDate, @@ -59,6 +59,15 @@ cdef class Curve(object): new_curve.fDayCountConv = dcc self._thisptr = make_shared(new_curve) + def __hash__(self): + cdef TCurve* curve = self._thisptr.get() + cdef int num_items = curve.fNumItems + return hash((num_items, + <bytes>(<char*>curve.fArray)[:sizeof(TRatePt)*num_items], + curve.fBaseDate, + curve.fBasis, + curve.fDayCountConv)) + def inspect(self): """ method to inspect the content of the C struct |
