diff options
| author | Guillaume Horel <guillaume.horel@serenitascapital.com> | 2016-07-12 15:37:45 -0400 |
|---|---|---|
| committer | Guillaume Horel <guillaume.horel@serenitascapital.com> | 2016-07-12 15:37:45 -0400 |
| commit | 10e9385b9dce32513d865f75003c0eccff75faa0 (patch) | |
| tree | 6706ae2e1c7f5efe5ba4dc44a2e15eb927974614 /date.pyx | |
| parent | 1f1d6128c664ee4e79ad01bdd914583d905eb209 (diff) | |
| download | pyisda-10e9385b9dce32513d865f75003c0eccff75faa0.tar.gz | |
reorganize project
Diffstat (limited to 'date.pyx')
| -rw-r--r-- | date.pyx | 28 |
1 files changed, 0 insertions, 28 deletions
diff --git a/date.pyx b/date.pyx deleted file mode 100644 index b7a79ab..0000000 --- a/date.pyx +++ /dev/null @@ -1,28 +0,0 @@ -import datetime -from cpython cimport datetime as c_datetime -from date cimport JpmcdsDate, JpmcdsStringToDayCountConv, JpmcdsFormatDayCountConv - -c_datetime.import_datetime() - -cdef TDate pydate_to_TDate(c_datetime.date d): - return JpmcdsDate(<long>d.year, <long>d.month, <long>d.day) - -cpdef c_datetime.date TDate_to_pydate(TDate d): - cdef TMonthDayYear date - if JpmcdsDateToMDY(d, &date) == 0: - return c_datetime.date_new(date.year, date.month, date.day) - -cdef long dcc(str day_count) except -1: - 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)) - -def dcc_tostring(long day_count): - cdef char* c_string = JpmcdsFormatDayCountConv(day_count) - s = c_string.decode('utf-8') - return s |
