Skip to content

Commit 860bd56

Browse files
committed
[EN-1454] Candle listener extended
1 parent aa9d71e commit 860bd56

File tree

2 files changed

+30
-3
lines changed

2 files changed

+30
-3
lines changed

dxfeed/core/listeners/listener.pyx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ cdef void time_and_sale_default_listener(int event_type,
158158
tns[i].is_spread_leg,
159159
tns[i].scope])
160160

161-
CANDLE_COLUMNS = ['Symbol', 'Index', 'Time', 'Sequence', 'Count', 'Open', 'High', 'Low', 'Close', 'Volume', 'VWap',
161+
CANDLE_COLUMNS = ['Symbol', 'EventFlags', 'Index', 'Time', 'Sequence', 'Count', 'Open', 'High', 'Low', 'Close', 'Volume', 'VWap',
162162
'BidVolume', 'AskVolume', 'OpenInterest', 'ImpVolatility']
163163
cdef void candle_default_listener(int event_type,
164164
dxf_const_string_t symbol_name,
@@ -170,6 +170,7 @@ cdef void candle_default_listener(int event_type,
170170
py_data = <EventHandler> user_data
171171
for i in range(data_count):
172172
py_data.__update([unicode_from_dxf_const_string_t(symbol_name),
173+
candle[i].event_flags,
173174
candle[i].index,
174175
candle[i].time,
175176
candle[i].sequence,

examples/AllSubscriptionsExample.ipynb

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
"outputs": [],
4848
"source": [
4949
"symbols = ['AAPL', 'MSFT']\n",
50-
"datetime = datetime.now() - relativedelta(minutes=15)\n",
50+
"date_time = datetime.now() - relativedelta(minutes=15)\n",
5151
"endpoint = dx.Endpoint('demo.dxfeed.com:7300')"
5252
]
5353
},
@@ -169,7 +169,7 @@
169169
"metadata": {},
170170
"outputs": [],
171171
"source": [
172-
"tns_sub = endpoint.create_subscription('Summary').add_symbols(symbols)"
172+
"tns_sub = endpoint.create_subscription('TimeAndSale').add_symbols(symbols)"
173173
]
174174
},
175175
{
@@ -181,6 +181,32 @@
181181
"tns_sub.get_event_handler().get_dataframe().head(3)"
182182
]
183183
},
184+
{
185+
"cell_type": "markdown",
186+
"metadata": {},
187+
"source": [
188+
"### Candle\n",
189+
"Details: https://kb.dxfeed.com/display/DS/Charting+Overview#ChartingOverview-Candletypes"
190+
]
191+
},
192+
{
193+
"cell_type": "code",
194+
"execution_count": null,
195+
"metadata": {},
196+
"outputs": [],
197+
"source": [
198+
"candle_sub = endpoint.create_subscription('Candle', date_time=date_time).add_symbols(symbols)"
199+
]
200+
},
201+
{
202+
"cell_type": "code",
203+
"execution_count": null,
204+
"metadata": {},
205+
"outputs": [],
206+
"source": [
207+
"candle_sub.get_event_handler().get_dataframe().head(3)"
208+
]
209+
},
184210
{
185211
"cell_type": "markdown",
186212
"metadata": {},

0 commit comments

Comments
 (0)