Closed gfox72 closed 4 years ago
I cant copy and run the code, because you dont format the code as a code block.
You can also upload the script that cause this error! then I just need to download and run it ... (just drag and drop the file to the text area while creating a new comment.)
Did you try to run https://github.com/oliver-zehentleitner/unicorn-binance-websocket-api/blob/master/example_binance_futures.py ?
Are you using the latest version of this lib?
Thx Oliver, the example_binance_futures.py throws me the same problem, streams crash although here with this example I have feedback on 'error: 2' (while with mine I had reference of crash because 'string indices must be integers'. As you can tell from the screenshot below running the example, I'm at 1.16.5
oh, 1.16.5 is not released, you are on the dev-stage i coded yesturday and its not working.... just download the example file without the repository and run it again, then it will use the installed PIP package instead.
Whats your result now?
glad we zoomed in on the problem, strangly, I only copy/pasted the example so I'm quite sure my local setup has the 1.16.5 after doing a pip3 install unicorn-binance-websocket-api -U yesterdayevening ...
got it fixed. You will have noticed already I'm by far not the matter-expert here so may be understanding incorrectly how pip works but I just did a pip3 uninstall unicorn-binance-websocket-api, then a pip3 install unicorn-binance-websocket-api and I got 1.16.5 installed again, I needed to do the uninstall but then the install with ==1.16.4 and that got me on the current released version.
thanks for the report!
1.16.5 should not be available - maybe I did something wrong yesturday, I will check it out later!
important is to use "--upgrade" with pip, otherwise it often does nothing... https://github.com/oliver-zehentleitner/unicorn-binance-websocket-api#a-wheel-of-the-latest-release-with-pip-from-pypi
Hi there, maybe someone can help me with this, pulled websocket example from this github but my streams seem to crash based on something I don't control from my code:
from unicorn_binance_websocket_api.unicorn_binance_websocket_api_manager import BinanceWebSocketApiManager
import time import threading
def print_stream_data_from_stream_buffer(binance_websocket_api_manager): while True: if binance_websocket_api_manager.is_manager_stopping(): exit(0) oldest_stream_data_from_stream_buffer = binance_websocket_api_manager.pop_stream_data_from_stream_buffer() if oldest_stream_data_from_stream_buffer is False: time.sleep(0.01)
binance_websocket_api_manager = BinanceWebSocketApiManager(exchange="binance.com-futures")
worker_thread = threading.Thread(target=print_stream_data_from_stream_buffer, args=(binance_websocket_api_manager,)) worker_thread.start()
markets = {'btcusdt', 'bchusdt', 'ethusdt'} channels = {'markPrice', 'kline_1m'}
stream_id = binance_websocket_api_manager.create_stream(channels, markets) binance_websocket_api_manager.subscribe_to_stream(stream_id, markets=markets)
while True: binance_websocket_api_manager.print_stream_info(stream_id) time.sleep(1)
This gives me:
====================== unicorn-binance-websocket-api_1.16.5-python_3.7.3 ====================== exchange: binance.com-futures stream_id: 883863a7-f188-4027-a99d-0aefc2d27b7b channels (2): ['markPrice', 'kline_1m'] markets (3): ['btcusdt', 'bchusdt', 'ethusdt'] subscriptions: 6 payload: [{'method': 'SUBSCRIBE', 'params': ['ethusdt@markPrice', 'ethusdt@kline_1m', 'btcusdt@kline_1m', 'bchusdt@markPrice', 'bchusdt@kline_1m', 'btcusdt@markPrice'], 'id': 6}] status: crashed - string indices must be integers