forked from Awethon/open-api-python-client
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstreaming.py
More file actions
15 lines (11 loc) · 681 Bytes
/
streaming.py
File metadata and controls
15 lines (11 loc) · 681 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
from openapi_client.openapi_streaming import run_stream_consumer
from openapi_client.openapi_streaming import print_event
token = "YOUR TOKEN"
candle_subs = [{'figi': 'BBG000B9XRY4', 'interval': '1min'}, {'figi': 'BBG009S39JX6', 'interval': '1min'}]
orderbook_subs = [{'figi': 'BBG0013HGFT4', 'depth': 1}, {'figi': 'BBG009S39JX6', 'depth': 3}]
instrument_info_subs = [{'figi': 'BBG000B9XRY4'}, {'figi': 'BBG009S39JX6'}]
run_stream_consumer(token,
candle_subs, orderbook_subs, instrument_info_subs,
on_candle_event=print_event,
on_orderbook_event=print_event,
on_instrument_info_event=print_event)