From 173d9207b8e20eb314c5539e37f1166a476021f5 Mon Sep 17 00:00:00 2001 From: iamishalkin Date: Tue, 6 Oct 2020 13:59:01 +0300 Subject: [PATCH 1/5] [EN-1980] Order type crash fix --- dxfeed/core/listeners/listener.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dxfeed/core/listeners/listener.pyx b/dxfeed/core/listeners/listener.pyx index a56c6c5..5251f79 100644 --- a/dxfeed/core/listeners/listener.pyx +++ b/dxfeed/core/listeners/listener.pyx @@ -244,7 +244,7 @@ cdef void order_default_listener(int event_type, scope=order[i].scope, side=order[i].side, exchange_code=unicode_from_dxf_const_string_t(&order[i].exchange_code), - source=unicode_from_dxf_const_string_t(&order[i].source[DXF_RECORD_SUFFIX_SIZE]), + source=unicode_from_dxf_const_string_t(&order[i].source[0]), market_maker=unicode_from_dxf_const_string_t(order[i].market_maker), spread_symbol=unicode_from_dxf_const_string_t(order[i].spread_symbol)) py_data.cython_internal_update_method(events) From 5a587d3b417557781ffe949c46b1cda73daa7d19 Mon Sep 17 00:00:00 2001 From: iamishalkin Date: Tue, 6 Oct 2020 15:37:09 +0300 Subject: [PATCH 2/5] [EN-1980] version change --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 4051e56..7607b05 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = 'dxfeed' -version = '0.5.0' +version = '0.5.1' description = 'DXFeed Python API via C API' authors = ['Index Management Team '] build = 'build.py' From ece80034221e0f10e885613cf5acb0f70f42db04 Mon Sep 17 00:00:00 2001 From: iamishalkin Date: Tue, 6 Oct 2020 20:39:58 +0300 Subject: [PATCH 3/5] [EN-1980] exchange code correction in order events --- dxfeed/core/listeners/listener.pyx | 2 +- dxfeed/core/utils/helpers.pxd | 2 +- dxfeed/core/utils/helpers.pyx | 6 ++++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/dxfeed/core/listeners/listener.pyx b/dxfeed/core/listeners/listener.pyx index 5251f79..f6fe998 100644 --- a/dxfeed/core/listeners/listener.pyx +++ b/dxfeed/core/listeners/listener.pyx @@ -243,7 +243,7 @@ cdef void order_default_listener(int event_type, count=order[i].count, scope=order[i].scope, side=order[i].side, - exchange_code=unicode_from_dxf_const_string_t(&order[i].exchange_code), + exchange_code=unicode_from_dxf_const_string_t(&order[i].exchange_code, size=1), source=unicode_from_dxf_const_string_t(&order[i].source[0]), market_maker=unicode_from_dxf_const_string_t(order[i].market_maker), spread_symbol=unicode_from_dxf_const_string_t(order[i].spread_symbol)) diff --git a/dxfeed/core/utils/helpers.pxd b/dxfeed/core/utils/helpers.pxd index 6cc4cda..9722442 100644 --- a/dxfeed/core/utils/helpers.pxd +++ b/dxfeed/core/utils/helpers.pxd @@ -5,6 +5,6 @@ cdef extern from *: PyObject * PyUnicode_FromWideChar(dxf_const_string_t w, Py_ssize_t size) dxf_const_string_t PyUnicode_AsWideCharString(object, Py_ssize_t *) -cdef object unicode_from_dxf_const_string_t(dxf_const_string_t wcs) +cdef object unicode_from_dxf_const_string_t(dxf_const_string_t wcs, int size=*) cdef dxf_const_string_t dxf_const_string_t_from_unicode(object symbol) \ No newline at end of file diff --git a/dxfeed/core/utils/helpers.pyx b/dxfeed/core/utils/helpers.pyx index 4c55b20..c1fd9ec 100644 --- a/dxfeed/core/utils/helpers.pyx +++ b/dxfeed/core/utils/helpers.pyx @@ -5,7 +5,7 @@ from dxfeed.core.pxd_include.DXTypes cimport * from pathlib import Path import dxfeed -cdef object unicode_from_dxf_const_string_t(dxf_const_string_t wcs): +cdef object unicode_from_dxf_const_string_t(dxf_const_string_t wcs, int size=-1): """ Cython function, callable from C to convert dxf_const_string_t(wchar_t) to unicode @@ -13,6 +13,8 @@ cdef object unicode_from_dxf_const_string_t(dxf_const_string_t wcs): ---------- wcs: dxf_const_string_t, wchar_t C string + size: int + Number of characters. By default -1 Returns ------- @@ -21,7 +23,7 @@ cdef object unicode_from_dxf_const_string_t(dxf_const_string_t wcs): """ if wcs == NULL: return '' - ret_val = PyUnicode_FromWideChar(wcs, -1) + ret_val = PyUnicode_FromWideChar(wcs, size) return ret_val cdef dxf_const_string_t dxf_const_string_t_from_unicode(object symbol): From 0b748ea97633b3edf0e585025cd93443dfcb78db Mon Sep 17 00:00:00 2001 From: iamishalkin Date: Tue, 6 Oct 2020 20:46:35 +0300 Subject: [PATCH 4/5] [EN-1980] exchange code correction in all events --- dxfeed/core/listeners/listener.pyx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/dxfeed/core/listeners/listener.pyx b/dxfeed/core/listeners/listener.pyx index f6fe998..097fa4a 100644 --- a/dxfeed/core/listeners/listener.pyx +++ b/dxfeed/core/listeners/listener.pyx @@ -31,7 +31,7 @@ cdef void trade_default_listener(int event_type, events[i] = TradeTuple(symbol=unicode_from_dxf_const_string_t(symbol_name), sequence=trades[i].sequence, price=trades[i].price, - exchange_code=unicode_from_dxf_const_string_t(&trades[i].exchange_code), + exchange_code=unicode_from_dxf_const_string_t(&trades[i].exchange_code, size=1), size=trades[i].size, tick=trades[i].tick, change=trades[i].change, @@ -66,11 +66,11 @@ cdef void quote_default_listener(int event_type, time=quotes[i].time, time_nanos=quotes[i].time_nanos, bid_time=quotes[i].bid_time, - bid_exchange_code=unicode_from_dxf_const_string_t("es[i].bid_exchange_code), + bid_exchange_code=unicode_from_dxf_const_string_t("es[i].bid_exchange_code, size=1), bid_price=quotes[i].bid_price, bid_size=quotes[i].bid_size, ask_time=quotes[i].ask_time, - ask_exchange_code=unicode_from_dxf_const_string_t("es[i].ask_exchange_code), + ask_exchange_code=unicode_from_dxf_const_string_t("es[i].ask_exchange_code, size=1), ask_price=quotes[i].ask_price, ask_size=quotes[i].ask_size, scope= quotes[i].scope) @@ -102,7 +102,7 @@ cdef void summary_default_listener(int event_type, dxf_const_string_t symbol_nam prev_day_volume=summary[i].prev_day_volume, open_interest=summary[i].open_interest, raw_flags=summary[i].raw_flags, - exchange_code=unicode_from_dxf_const_string_t(&summary[i].exchange_code), + exchange_code=unicode_from_dxf_const_string_t(&summary[i].exchange_code, size=1), day_close_price_type=summary[i].day_close_price_type, prev_day_close_price_type=summary[i].prev_day_close_price_type, scope=summary[i].scope) @@ -166,7 +166,7 @@ cdef void time_and_sale_default_listener(int event_type, event_flags=tns[i].event_flags, index=tns[i].index, time=tns[i].time, - exchange_code=unicode_from_dxf_const_string_t(&tns[i].exchange_code), + exchange_code=unicode_from_dxf_const_string_t(&tns[i].exchange_code, size=1), price=tns[i].price, size=tns[i].size, bid_price=tns[i].bid_price, From 10186c426eee50c4dedaab3f59dacf680c42daa0 Mon Sep 17 00:00:00 2001 From: Aleksandr Salynskii Date: Wed, 7 Oct 2020 15:31:22 +0200 Subject: [PATCH 5/5] [EN-1980] Minor style fixes --- dxfeed/core/listeners/listener.pyx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dxfeed/core/listeners/listener.pyx b/dxfeed/core/listeners/listener.pyx index 097fa4a..59ea437 100644 --- a/dxfeed/core/listeners/listener.pyx +++ b/dxfeed/core/listeners/listener.pyx @@ -66,11 +66,13 @@ cdef void quote_default_listener(int event_type, time=quotes[i].time, time_nanos=quotes[i].time_nanos, bid_time=quotes[i].bid_time, - bid_exchange_code=unicode_from_dxf_const_string_t("es[i].bid_exchange_code, size=1), + bid_exchange_code=unicode_from_dxf_const_string_t("es[i].bid_exchange_code, + size=1), bid_price=quotes[i].bid_price, bid_size=quotes[i].bid_size, ask_time=quotes[i].ask_time, - ask_exchange_code=unicode_from_dxf_const_string_t("es[i].ask_exchange_code, size=1), + ask_exchange_code=unicode_from_dxf_const_string_t("es[i].ask_exchange_code, + size=1), ask_price=quotes[i].ask_price, ask_size=quotes[i].ask_size, scope= quotes[i].scope)