away2 / ChillTrade-binance

Template trading bot for futures market on binance exchange.
MIT License
3 stars 2 forks source link

binance.websockets not found. #1

Open shujaatak opened 3 years ago

shujaatak commented 3 years ago

I have installed all requirements, although this line imports binance without any issue: from binance.client import Client But this line shows error: from binance.websockets import BinanceSocketManager

It says Cannot find reference 'websockets' in '__init__.py' in pycharm and also vscode.

away2 commented 3 years ago

Hi, @shujaatak. Apparently python-binance module has changed the way to interact with websockets. You can reinstall python-binance, for example on 0.7.9, this version was tested. Another solution is to reimplement websockets interaction according to new docs https://python-binance.readthedocs.io/en/latest/websockets.html#threadedwebsocketmanager-websocket-usage

shujaatak commented 3 years ago

Going to try both solutions.

I wonder if this project really work with binance future trading.

away2 commented 3 years ago

It sure does, as an example futures_create_order() method in gwBinance.py is used to send order to binance futures. But history data loads from spot and also websockets subscribe to spot data. If necessary, it is easy to switch to futures data - python-binance has corresponding methods.