Skip to content

Commit 8307da6

Browse files
committed
[EN-1792] Merge branch 'master' into EN-1792-named-listener-fields
# Conflicts: # dxfeed/core/listeners/listener.pyx
2 parents 944d007 + 190ec83 commit 8307da6

File tree

7 files changed

+214
-200
lines changed

7 files changed

+214
-200
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: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ cdef class FuncWrapper:
1414

1515

1616
TRADE_COLUMNS = ['Symbol', 'Sequence', 'Price', 'ExchangeCode', 'Size', 'Tick', 'Change', 'DayVolume',
17-
'DayTurnover', 'Direction', 'Time', 'Nanos', 'RawFlags', 'IsETH', 'Scope']
17+
'DayTurnover', 'Direction', 'Time', 'TimeNanos', 'RawFlags', 'IsETH', 'Scope']
1818
TradeTuple = namedtuple('Trade', ['symbol', 'sequence', 'price', 'exchange_code', 'size', 'tick', 'change',
1919
'day_volume', 'day_turnover', 'direction', 'time', 'time_nanos', 'raw_flags',
2020
'is_eth', 'scope'])
@@ -44,8 +44,8 @@ cdef void trade_default_listener(int event_type,
4444
scope=trades[i].scope)
4545
py_data.cython_internal_update_method(trade_event)
4646

47-
QUOTE_COLUMNS = ['Symbol', 'Sequence', 'Time', 'Nanos', 'BidTime', 'BidExchangeCode', 'BidPrice', 'BidSize', 'AskTime',
48-
'AskExchangeCode', 'AskPrice', 'AskSize', 'Scope']
47+
QUOTE_COLUMNS = ['Symbol', 'Sequence', 'Time', 'TimeNanos', 'BidTime', 'BidExchangeCode', 'BidPrice', 'BidSize',
48+
'AskTime', 'AskExchangeCode', 'AskPrice', 'AskSize', 'Scope']
4949
QuoteTuple = namedtuple('Quote', ['symbol', 'sequence', 'time', 'time_nanos', 'bid_time', 'bid_exchange_code',
5050
'bid_price', 'bid_size', 'ask_time', 'ask_exchange_code', 'ask_price', 'ask_size',
5151
'scope'])
@@ -122,24 +122,24 @@ cdef void profile_default_listener(int event_type,
122122
py_data = <EventHandler> user_data
123123
for i in range(data_count):
124124
profile_event = ProfileTuple(symbol=unicode_from_dxf_const_string_t(symbol_name),
125-
beta=p[i].beta,
126-
eps=p[i].eps,
127-
div_freq=p[i].div_freq,
128-
exd_div_amount=p[i].exd_div_amount,
129-
exd_div_date=p[i].exd_div_date,
130-
high_price=p[i]._52_high_price,
131-
low_price=p[i]._52_low_price,
132-
shares=p[i].shares,
133-
free_float=p[i].free_float,
134-
high_limit_price=p[i].high_limit_price,
135-
low_limit_price=p[i].low_limit_price,
136-
halt_start_time=p[i].halt_start_time,
137-
halt_end_time=p[i].halt_end_time,
138-
description=unicode_from_dxf_const_string_t(p[i].description),
139-
raw_flags=p[i].raw_flags,
140-
status_reason=unicode_from_dxf_const_string_t(p[i].status_reason),
141-
trading_status=p[i].trading_status,
142-
ssr=p[i].ssr)
125+
beta=p[i].beta,
126+
eps=p[i].eps,
127+
div_freq=p[i].div_freq,
128+
exd_div_amount=p[i].exd_div_amount,
129+
exd_div_date=p[i].exd_div_date,
130+
high_price=p[i]._52_high_price,
131+
low_price=p[i]._52_low_price,
132+
shares=p[i].shares,
133+
free_float=p[i].free_float,
134+
high_limit_price=p[i].high_limit_price,
135+
low_limit_price=p[i].low_limit_price,
136+
halt_start_time=p[i].halt_start_time,
137+
halt_end_time=p[i].halt_end_time,
138+
description=unicode_from_dxf_const_string_t(p[i].description),
139+
raw_flags=p[i].raw_flags,
140+
status_reason=unicode_from_dxf_const_string_t(p[i].status_reason),
141+
trading_status=p[i].trading_status,
142+
ssr=p[i].ssr)
143143
py_data.cython_internal_update_method(profile_event)
144144

145145
TIME_AND_SALE_COLUMNS = ['Symbol', 'EventFlags', 'Index', 'Time', 'ExchangeCode', 'Price', 'Size', 'BidPrice',
@@ -180,8 +180,8 @@ cdef void time_and_sale_default_listener(int event_type,
180180
scope=tns[i].scope)
181181
py_data.cython_internal_update_method(tns_event)
182182

183-
CANDLE_COLUMNS = ['Symbol', 'EventFlags', 'Index', 'Time', 'Sequence', 'Count', 'Open', 'High', 'Low', 'Close', 'Volume', 'VWap',
184-
'BidVolume', 'AskVolume', 'OpenInterest', 'ImpVolatility']
183+
CANDLE_COLUMNS = ['Symbol', 'EventFlags', 'Index', 'Time', 'Sequence', 'Count', 'Open', 'High', 'Low', 'Close',
184+
'Volume', 'VWap', 'BidVolume', 'AskVolume', 'OpenInterest', 'ImpVolatility']
185185
CandleTuple = namedtuple('Candle', ['symbol', 'event_flags', 'index', 'time', 'sequence', 'count', 'open', 'high',
186186
'low', 'close', 'volume', 'vwap', 'bid_volume', 'ask_volume', 'open_interest',
187187
'imp_volatility'])
@@ -212,10 +212,10 @@ cdef void candle_default_listener(int event_type,
212212
imp_volatility=candle[i].imp_volatility)
213213
py_data.cython_internal_update_method(candle_event)
214214

215-
ORDER_COLUMNS = ['Symbol', 'EventFlags', 'Index', 'Time', 'Nanos', 'Sequence', 'Price', 'Size', 'Count', 'Scope',
216-
'Side', 'ExchangeCode', 'MarketMaker', 'SpreadSymbol']
215+
ORDER_COLUMNS = ['Symbol', 'EventFlags', 'Index', 'Time', 'TimeNanos', 'Sequence', 'Price', 'Size', 'Count', 'Scope',
216+
'Side', 'ExchangeCode', 'Source', 'MarketMaker', 'SpreadSymbol']
217217
OrderTuple = namedtuple('Order', ['symbol', 'event_flags', 'index', 'time', 'time_nanos', 'sequence', 'price', 'size',
218-
'count', 'scope', 'side', 'exchange_code', 'market_maker', 'spread_symbol'])
218+
'count', 'scope', 'side', 'exchange_code', 'source', 'market_maker', 'spread_symbol'])
219219
cdef void order_default_listener(int event_type,
220220
dxf_const_string_t symbol_name,
221221
const dxf_event_data_t*data,
@@ -237,6 +237,7 @@ cdef void order_default_listener(int event_type,
237237
scope=order[i].scope,
238238
side=order[i].side,
239239
exchange_code=unicode_from_dxf_const_string_t(&order[i].exchange_code),
240+
source=unicode_from_dxf_const_string_t(&order[i].source[DXF_RECORD_SUFFIX_SIZE]),
240241
market_maker=unicode_from_dxf_const_string_t(order[i].market_maker),
241242
spread_symbol=unicode_from_dxf_const_string_t(order[i].spread_symbol))
242243
py_data.cython_internal_update_method(order_event)

0 commit comments

Comments
 (0)