summaryrefslogtreecommitdiffstats
path: root/curve.pyx
diff options
context:
space:
mode:
authorGuillaume Horel <guillaume.horel@serenitascapital.com>2016-07-05 16:16:00 -0400
committerGuillaume Horel <guillaume.horel@serenitascapital.com>2016-07-05 16:16:00 -0400
commit34368d0b4a8ec83335d41237eae84ae83e749070 (patch)
tree2ea927b05e5edf3a07bdff60da0cf3d86b9738a9 /curve.pyx
parentf3dd7b7badc1ce32db9ff76800c386f87fe59e23 (diff)
downloadpyisda-34368d0b4a8ec83335d41237eae84ae83e749070.tar.gz
add method to inspect content of curve
Diffstat (limited to 'curve.pyx')
-rw-r--r--curve.pyx15
1 files changed, 13 insertions, 2 deletions
diff --git a/curve.pyx b/curve.pyx
index 7aa620a..c956295 100644
--- a/curve.pyx
+++ b/curve.pyx
@@ -3,6 +3,7 @@ from curve cimport JpmcdsBuildIRZeroCurve, JpmcdsZeroPrice
from date cimport (JpmcdsStringToDateInterval, pydate_to_TDate, dcc,
JpmcdsDateIntervalToFreq, JpmcdsDateFwdThenAdjust, TDate_to_pydate,
JpmcdsDateFromBusDaysOffset)
+from date import dcc_tostring
from cdsone cimport JpmcdsStringToStubMethod, TStubMethod
cdef int SUCCESS = 0
@@ -18,7 +19,17 @@ cdef class Curve:
JpmcdsFreeTCurve(self._thisptr)
def inspect(self):
- return {'base_date': TDate_to_pydate(self._thiptr.fBaseDate)}
+ return {'base_date': TDate_to_pydate(self._thisptr.fBaseDate),
+ 'basis': self._thisptr.fBasis,
+ 'day_count_convention': dcc_tostring(self._thisptr.fDayCountConv),
+ 'data': fArray_to_list(self._thisptr.fArray, self._thisptr.fNumItems)}
+
+cdef fArray_to_list(TRatePt* fArray, int fNumItems):
+ cdef size_t i
+ cdef list l = []
+ for i in range(fNumItems):
+ l.append((TDate_to_pydate(fArray[i].fDate), fArray[i].fRate))
+ return l
cdef class ZeroCurve(Curve):
@@ -49,7 +60,7 @@ cdef class ZeroCurve(Curve):
period_bytes = p.encode('utf-8')
if JpmcdsStringToDateInterval(period_bytes, routine, &tmp) != SUCCESS:
raise ValueError
- if JpmcdsDateFwdThenAdjust(settle_date, &tmp, NONE,
+ if JpmcdsDateFwdThenAdjust(settle_date, &tmp, MODIFIED,
"None", &self._dates[i]) != SUCCESS:
raise ValueError('Invalid interval')