Skip to content

Commit ece8003

Browse files
committed
[EN-1980] exchange code correction in order events
1 parent 5a587d3 commit ece8003

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

dxfeed/core/listeners/listener.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ cdef void order_default_listener(int event_type,
243243
count=order[i].count,
244244
scope=order[i].scope,
245245
side=order[i].side,
246-
exchange_code=unicode_from_dxf_const_string_t(&order[i].exchange_code),
246+
exchange_code=unicode_from_dxf_const_string_t(&order[i].exchange_code, size=1),
247247
source=unicode_from_dxf_const_string_t(&order[i].source[0]),
248248
market_maker=unicode_from_dxf_const_string_t(order[i].market_maker),
249249
spread_symbol=unicode_from_dxf_const_string_t(order[i].spread_symbol))

dxfeed/core/utils/helpers.pxd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ cdef extern from *:
55
PyObject * PyUnicode_FromWideChar(dxf_const_string_t w, Py_ssize_t size)
66
dxf_const_string_t PyUnicode_AsWideCharString(object, Py_ssize_t *)
77

8-
cdef object unicode_from_dxf_const_string_t(dxf_const_string_t wcs)
8+
cdef object unicode_from_dxf_const_string_t(dxf_const_string_t wcs, int size=*)
99

1010
cdef dxf_const_string_t dxf_const_string_t_from_unicode(object symbol)

dxfeed/core/utils/helpers.pyx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,16 @@ from dxfeed.core.pxd_include.DXTypes cimport *
55
from pathlib import Path
66
import dxfeed
77

8-
cdef object unicode_from_dxf_const_string_t(dxf_const_string_t wcs):
8+
cdef object unicode_from_dxf_const_string_t(dxf_const_string_t wcs, int size=-1):
99
"""
1010
Cython function, callable from C to convert dxf_const_string_t(wchar_t) to unicode
1111
1212
Parameters
1313
----------
1414
wcs: dxf_const_string_t, wchar_t
1515
C string
16+
size: int
17+
Number of characters. By default -1
1618
1719
Returns
1820
-------
@@ -21,7 +23,7 @@ cdef object unicode_from_dxf_const_string_t(dxf_const_string_t wcs):
2123
"""
2224
if wcs == NULL:
2325
return ''
24-
ret_val = <object>PyUnicode_FromWideChar(wcs, -1)
26+
ret_val = <object>PyUnicode_FromWideChar(wcs, size)
2527
return ret_val
2628

2729
cdef dxf_const_string_t dxf_const_string_t_from_unicode(object symbol):

0 commit comments

Comments
 (0)