summaryrefslogtreecommitdiffstats
path: root/legs.pyx
diff options
context:
space:
mode:
Diffstat (limited to 'legs.pyx')
-rw-r--r--legs.pyx10
1 files changed, 8 insertions, 2 deletions
diff --git a/legs.pyx b/legs.pyx
index 5db39d3..27bcf19 100644
--- a/legs.pyx
+++ b/legs.pyx
@@ -14,6 +14,9 @@ cdef class ContingentLeg:
pydate_to_TDate(end_date),
notional,
protect_start)
+ if self._thisptr is NULL:
+ raise ValueError
+
def __dealloc__(self):
if self._thisptr is not NULL:
free(self._thisptr)
@@ -38,14 +41,17 @@ cdef class FeeLeg:
coupon_rate,
dcc(payment_dcc),
<long>'M',
- NULL,
+ b'NONE',
protect_start)
+ if self._thisptr is NULL:
+ raise ValueError
+
@property
def cashflows(self):
cdef TCashFlowList* cfl = JpmcdsFeeLegFlows(self._thisptr)
cdef TCashFlow cf
result = []
- for i in range(cf.fNumItems):
+ for i in range(cfl.fNumItems):
cf = cfl.fArray[i]
result.append((TDate_to_pydate(cf.fDate), cf.fAmount))
return result