Closed slipp1 closed 3 years ago
Hm.
Something similar I am doing here: https://github.com/oliver-zehentleitner/unicorn-binance-websocket-api/blob/master/example_stream_everything.py#L73
But I think we need to extend to code to be able to do what you want: create_payload() in the section for centralized exchanges (cex): https://github.com/oliver-zehentleitner/unicorn-binance-websocket-api/blob/master/unicorn_binance_websocket_api/unicorn_binance_websocket_api_manager.py#L695
Thanks for the quick reply! I got it working by adding @1s after each case of @arr in unicorn_binance_websocket_api_manager.py.
However, Im pretty sure that's not the proper way to do it, since it will create problems with other streams. But it's a work around in my case for now. Thank you so much.
Really? Thats great!
I think its good if you make dedicated streams. If you mix different kinds of streams they start much more than if you make dedicated streams by stream type.
i am also experiencing the same problem. I am unable to subscribe to !markPrice@arr@1s
Try this:
binance_websocket_api_manager.create_stream(["!markPrice"], "arr@1s", stream_label="!markPrice@arr@1s")
as example, i am subscribing like so:
self.__futures_socket.create_stream(["!markPrice"], "arr@1s", stream_label="!markPrice@arr@1s")
starting a thread like so:
self.__futures_socket_worker_thread = Thread(target=self.__futures_socket_thread)
thread reading the buffer like so:
def __futures_socket_thread(self):
while not self.__futures_socket.is_manager_stopping():
oldest_stream_data_from_stream_buffer = self.__futures_socket.pop_stream_data_from_stream_buffer()
if oldest_stream_data_from_stream_buffer is False:
self.__exit.wait(0.01)
continue
buffer = json.loads(oldest_stream_data_from_stream_buffer)
if 'stream' in buffer and buffer['stream'] == '!markPrice@arr':
print(time.time())
for data in buffer['data']:
self.__mark_price_callback(data)
elif 'e' not in buffer and 'u' in buffer:
self.__future_price_callback(buffer)
i get a print out of:
...
1599950172.358498
1599950175.1926148
1599950178.342974
1599950181.542018
1599950184.241941
...
printing time every 3s
using v1.16.9
i would like request reopening this issue
Is very possible that, the lib replace arr@1s
with arr
.
Please create the stream and then use get_stream_subscriptions(stream_id) - this will return, the subscription accepted by binance... Please post me that result!
This is how I got it working on my end:
I have got no issues so far.
It will be supported with the next release!
binance_websocket_api_manager.create_stream(["!markPrice"], "arr@1s", stream_label="!markPrice@arr@1s") this stream takes price information from all coins, how to make it work for only one coin?
Hi, Im trying to subscribe to this stream: !markPrice@arr@1s and I can't figure out a way. https://binance-docs.github.io/apidocs/futures/en/#mark-price-stream-for-all-market
This works, but it updates every 3seconds: binance_websocket_api_manager.create_stream(['arr'], ['!markPrice'])
Also, specifying the market it works in both cases (3seconds and 1second): binance_websocket_api_manager.create_stream(['markPrice'], ['btcusdt', 'ethusdt'] binance_websocket_api_manager.create_stream(['markPrice@1s'], ['btcusdt', 'ethusdt']
I've tried a lot of combinations including the @1s after the 'arr' parameter but haven't got it working.
Any help appreciated, for the time being Im specifying each symbol, but the 'arr' stream would be way easier for my code. Thanks.