From f4173c0e8a6b925dc75a9890b56e1e9a146964e9 Mon Sep 17 00:00:00 2001 From: Guillaume Horel Date: Tue, 11 Feb 2020 17:05:53 -0500 Subject: faster way of constructing date --- pyisda/date.pyx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pyisda/date.pyx b/pyisda/date.pyx index 682fb03..2482fbd 100644 --- a/pyisda/date.pyx +++ b/pyisda/date.pyx @@ -1,5 +1,6 @@ import datetime from cpython cimport datetime as c_datetime +from cpython.datetime cimport date_year, date_month, date_day from cpython.version cimport PY_MAJOR_VERSION from libc.stdlib cimport malloc, free cimport cython @@ -11,7 +12,7 @@ c_datetime.import_datetime() cdef int SUCCESS = 0 cpdef TDate pydate_to_TDate(c_datetime.date d): - return JpmcdsDate(d.year, d.month, d.day) + return JpmcdsDate(date_year(d), date_month(d), date_day(d)) cpdef c_datetime.date TDate_to_pydate(TDate d): cdef TMonthDayYear date -- cgit v1.2.3-70-g09d2