Skip to content

Commit 5a55352

Browse files
committed
[EN-1791] Merge branch 'EN-1792-named-listener-fields'
# Conflicts: # dxfeed/core/listeners/listener.pyx
2 parents 5707067 + 8307da6 commit 5a55352

File tree

7 files changed

+196
-185
lines changed

7 files changed

+196
-185
lines changed

dxfeed/__init__.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,12 @@
11
from dxfeed.wrappers.endpoint import Endpoint
22
from dxfeed.core.utils.handler import EventHandler, DefaultHandler
3+
import pkg_resources
4+
import toml
5+
from pathlib import Path
6+
7+
8+
try:
9+
__version__ = pkg_resources.get_distribution('dxfeed').version
10+
except pkg_resources.DistributionNotFound:
11+
pyproject = toml.load(Path(__file__).parents[1] / 'pyproject.toml')
12+
__version__ = pyproject['tool']['poetry']['version']

dxfeed/core/listeners/listener.pyx

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
from dxfeed.core.utils.helpers cimport *
22
from dxfeed.core.utils.handler cimport EventHandler
33
from collections import namedtuple
4-
cimport cython
54

65
cdef class FuncWrapper:
76
def __cinit__(self):
@@ -15,12 +14,10 @@ cdef class FuncWrapper:
1514

1615

1716
TRADE_COLUMNS = ['Symbol', 'Sequence', 'Price', 'ExchangeCode', 'Size', 'Tick', 'Change', 'DayVolume',
18-
'DayTurnover', 'Direction', 'Time', 'Nanos', 'RawFlags', 'IsETH', 'Scope']
17+
'DayTurnover', 'Direction', 'Time', 'TimeNanos', 'RawFlags', 'IsETH', 'Scope']
1918
TradeTuple = namedtuple('Trade', ['symbol', 'sequence', 'price', 'exchange_code', 'size', 'tick', 'change',
2019
'day_volume', 'day_turnover', 'direction', 'time', 'time_nanos', 'raw_flags',
2120
'is_eth', 'scope'])
22-
@cython.boundscheck(False)
23-
@cython.wraparound(False)
2421
cdef void trade_default_listener(int event_type,
2522
dxf_const_string_t symbol_name,
2623
const dxf_event_data_t*data,
@@ -49,8 +46,8 @@ cdef void trade_default_listener(int event_type,
4946

5047
py_data.cython_internal_update_method(events)
5148

52-
QUOTE_COLUMNS = ['Symbol', 'Sequence', 'Time', 'Nanos', 'BidTime', 'BidExchangeCode', 'BidPrice', 'BidSize', 'AskTime',
53-
'AskExchangeCode', 'AskPrice', 'AskSize', 'Scope']
49+
QUOTE_COLUMNS = ['Symbol', 'Sequence', 'Time', 'TimeNanos', 'BidTime', 'BidExchangeCode', 'BidPrice', 'BidSize',
50+
'AskTime', 'AskExchangeCode', 'AskPrice', 'AskSize', 'Scope']
5451
QuoteTuple = namedtuple('Quote', ['symbol', 'sequence', 'time', 'time_nanos', 'bid_time', 'bid_exchange_code',
5552
'bid_price', 'bid_size', 'ask_time', 'ask_exchange_code', 'ask_price', 'ask_size',
5653
'scope'])
@@ -188,8 +185,8 @@ cdef void time_and_sale_default_listener(int event_type,
188185
scope=tns[i].scope)
189186
py_data.cython_internal_update_method(events)
190187

191-
CANDLE_COLUMNS = ['Symbol', 'EventFlags', 'Index', 'Time', 'Sequence', 'Count', 'Open', 'High', 'Low', 'Close', 'Volume', 'VWap',
192-
'BidVolume', 'AskVolume', 'OpenInterest', 'ImpVolatility']
188+
CANDLE_COLUMNS = ['Symbol', 'EventFlags', 'Index', 'Time', 'Sequence', 'Count', 'Open', 'High', 'Low', 'Close',
189+
'Volume', 'VWap', 'BidVolume', 'AskVolume', 'OpenInterest', 'ImpVolatility']
193190
CandleTuple = namedtuple('Candle', ['symbol', 'event_flags', 'index', 'time', 'sequence', 'count', 'open', 'high',
194191
'low', 'close', 'volume', 'vwap', 'bid_volume', 'ask_volume', 'open_interest',
195192
'imp_volatility'])
@@ -221,10 +218,10 @@ cdef void candle_default_listener(int event_type,
221218
imp_volatility=candle[i].imp_volatility)
222219
py_data.cython_internal_update_method(events)
223220

224-
ORDER_COLUMNS = ['Symbol', 'EventFlags', 'Index', 'Time', 'Nanos', 'Sequence', 'Price', 'Size', 'Count', 'Scope',
225-
'Side', 'ExchangeCode', 'MarketMaker', 'SpreadSymbol']
221+
ORDER_COLUMNS = ['Symbol', 'EventFlags', 'Index', 'Time', 'TimeNanos', 'Sequence', 'Price', 'Size', 'Count', 'Scope',
222+
'Side', 'ExchangeCode', 'Source', 'MarketMaker', 'SpreadSymbol']
226223
OrderTuple = namedtuple('Order', ['symbol', 'event_flags', 'index', 'time', 'time_nanos', 'sequence', 'price', 'size',
227-
'count', 'scope', 'side', 'exchange_code', 'market_maker', 'spread_symbol'])
224+
'count', 'scope', 'side', 'exchange_code', 'source', 'market_maker', 'spread_symbol'])
228225
cdef void order_default_listener(int event_type,
229226
dxf_const_string_t symbol_name,
230227
const dxf_event_data_t*data,
@@ -247,6 +244,7 @@ cdef void order_default_listener(int event_type,
247244
scope=order[i].scope,
248245
side=order[i].side,
249246
exchange_code=unicode_from_dxf_const_string_t(&order[i].exchange_code),
247+
source=unicode_from_dxf_const_string_t(&order[i].source[DXF_RECORD_SUFFIX_SIZE]),
250248
market_maker=unicode_from_dxf_const_string_t(order[i].market_maker),
251249
spread_symbol=unicode_from_dxf_const_string_t(order[i].spread_symbol))
252250
py_data.cython_internal_update_method(events)

0 commit comments

Comments
 (0)