diff options
| author | Guillaume Horel <guillaume.horel@gmail.com> | 2017-02-14 17:10:26 -0500 |
|---|---|---|
| committer | Guillaume Horel <guillaume.horel@gmail.com> | 2017-02-14 17:36:34 -0500 |
| commit | 2d1015b1a9307854b61bcccd7eda47fae6297508 (patch) | |
| tree | 98b97485f59c413995872a96d177493732a02257 | |
| parent | c6ea69394eb6a518b5e6a27f08ae77f85cb733e6 (diff) | |
| download | pyisda-2d1015b1a9307854b61bcccd7eda47fae6297508.tar.gz | |
can copy a curve now
| -rw-r--r-- | pyisda/curve.pyx | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/pyisda/curve.pyx b/pyisda/curve.pyx index 0864019..a62e103 100644 --- a/pyisda/curve.pyx +++ b/pyisda/curve.pyx @@ -58,6 +58,20 @@ cdef class Curve(object): 'day_count_convention': dcc_tostring(self._thisptr.fDayCountConv), 'data': fArray_to_list(self._thisptr.fArray, self._thisptr.fNumItems)} + + def __deepcopy__(self, memo): + cdef Curve sc = type(self).__new__(type(self)) + cdef TCurve* newcurve = <TCurve*>malloc(sizeof(TCurve)) + newcurve.fNumItems = self._thisptr.fNumItems + newcurve.fBaseDate = self._thisptr.fBaseDate + newcurve.fDayCountConv = self._thisptr.fDayCountConv + newcurve.fArray = <TRatePt*>malloc(sizeof(TRatePt) * newcurve.fNumItems) + newcurve.fBasis = self._thisptr.fBasis + memcpy(newcurve.fArray, <char*>self._thisptr.fArray, + sizeof(TRatePt) * newcurve.fNumItems) + sc._thisptr = newcurve + return sc + @property def forward_hazard_rates(self): cdef double t1, h1, t2, h2 @@ -343,7 +357,7 @@ cdef class SpreadCurve(Curve): Flat hazard rate. basis : int, optional Default to :data:`CONTINUOUS` - day_count_cont : str, optional + day_count_conv : str, optional Default to 'Actual/365F' """ |
