diff options
| -rw-r--r-- | pyisda/legs.pyx | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/pyisda/legs.pyx b/pyisda/legs.pyx index f80f5f7..6decaa5 100644 --- a/pyisda/legs.pyx +++ b/pyisda/legs.pyx @@ -37,6 +37,10 @@ cdef class ContingentLeg: self._thisptr.notional, self._thisptr.protectStart)) + def __hash__(self): + return hash((self._thisptr.startDate, 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): """ @@ -117,6 +121,15 @@ cdef class FeeLeg: dcc_tostring(self._thisptr.dcc), self._thisptr.obsStartOfDay)) + def __hash__(self): + return hash((self._thisptr.accStartDates[0], + self._thisptr.payDates[self._thisptr.nbDates-1], + <int>self._thisptr.accrualPayConv, + self._thisptr.notional, + self._thisptr.couponRate, + self._thisptr.dcc, + self._thisptr.obsStartOfDay)) + def inspect(self): """convenience method to study the C struct""" cdef list acc_start_dates = [] |
