diff options
| author | Guillaume Horel <guillaume.horel@serenitascapital.com> | 2016-06-30 15:02:10 -0400 |
|---|---|---|
| committer | Guillaume Horel <guillaume.horel@serenitascapital.com> | 2016-06-30 15:02:47 -0400 |
| commit | f1bed268cfd976966b6bab376a59c52dfd0216fa (patch) | |
| tree | d35cf7a08ec376ac0f5e53ec2aa88d12962528f2 | |
| parent | 6b0a14370d244d4ff3b6277c49a23b04b8957678 (diff) | |
| download | pyisda-f1bed268cfd976966b6bab376a59c52dfd0216fa.tar.gz | |
rename zerocurve to curve, and merge yearfrac with date
| -rw-r--r-- | cdsone.pxd | 2 | ||||
| -rw-r--r-- | cdsone.pyx | 7 | ||||
| -rw-r--r-- | curve.pxd (renamed from zerocurve.pxd) | 0 | ||||
| -rw-r--r-- | curve.pyx (renamed from zerocurve.pyx) | 0 | ||||
| -rw-r--r-- | date.pxd | 5 | ||||
| -rw-r--r-- | date.pyx | 12 | ||||
| -rw-r--r-- | yearfrac.pxd | 4 | ||||
| -rw-r--r-- | yearfrac.pyx | 11 |
8 files changed, 20 insertions, 21 deletions
@@ -1,5 +1,5 @@ from date cimport TDateInterval -from pyisda.zerocurve cimport TCurve +from curve cimport TCurve cdef extern from "isda/stub.h": ctypedef struct TStubMethod: @@ -1,8 +1,7 @@ -from pyisda.cdsone cimport (JpmcdsCdsoneUpfrontCharge, +from cdsone cimport (JpmcdsCdsoneUpfrontCharge, JpmcdsCdsoneSpread, JpmcdsStringToStubMethod) -from pyisda.zerocurve cimport ZeroCurve -from pyisda.date cimport JpmcdsStringToDateInterval, pydate_to_TDate -from pyisda.yearfrac cimport dcc +from curve cimport ZeroCurve +from date cimport JpmcdsStringToDateInterval, pydate_to_TDate, dcc cdef int SUCCESS = 0 diff --git a/zerocurve.pxd b/curve.pxd index d652ca0..d652ca0 100644 --- a/zerocurve.pxd +++ b/curve.pxd diff --git a/zerocurve.pyx b/curve.pyx index a5eb2d2..a5eb2d2 100644 --- a/zerocurve.pyx +++ b/curve.pyx @@ -1,3 +1,8 @@ +cdef extern from "isda/yearfrac.h": + int JpmcdsStringToDayCountConv(char* day_count, long* type) + +cdef long dcc(str day_count) + cdef extern from "isda/cdate.h": ctypedef struct TDateInterval: pass @@ -1,5 +1,5 @@ import datetime -from date cimport JpmcdsDate +from date cimport JpmcdsDate, JpmcdsStringToDayCountConv cdef TDate pydate_to_TDate(d): assert isinstance(d, datetime.date) @@ -9,3 +9,13 @@ cpdef object TDate_to_pydate(TDate d): cdef TMonthDayYear date if JpmcdsDateToMDY(d, &date) == 0: return datetime.date(date.year, date.month, date.day) + +cdef long dcc(str day_count): + cdef long r + dc_bytes = day_count.encode('utf-8') + cdef char* dc = dc_bytes + cdef err = JpmcdsStringToDayCountConv(<char*> dc, &r) + if err == 0: + return r + else: + raise ValueError('{0} is not a valid day count'.format(day_count)) diff --git a/yearfrac.pxd b/yearfrac.pxd deleted file mode 100644 index 739ca90..0000000 --- a/yearfrac.pxd +++ /dev/null @@ -1,4 +0,0 @@ -cdef extern from "isda/yearfrac.h": - int JpmcdsStringToDayCountConv(char* day_count, long* type) - -cdef long dcc(str day_count) diff --git a/yearfrac.pyx b/yearfrac.pyx deleted file mode 100644 index 48b8995..0000000 --- a/yearfrac.pyx +++ /dev/null @@ -1,11 +0,0 @@ -from pyisda.yearfrac cimport JpmcdsStringToDayCountConv - -cdef long dcc(str day_count): - cdef long r - dc_bytes = day_count.encode('utf-8') - cdef char* dc = dc_bytes - cdef err = JpmcdsStringToDayCountConv(<char*> dc, &r) - if err == 0: - return r - else: - raise ValueError('{0} is not a valid day count'.format(day_count)) |
