conor19w / Binance-Futures-Trading-Bot

A Technical Analysis Bot that trades leveraged USDT futures markets on Binance.
539 stars 177 forks source link

web socket problem #5

Closed Nai-mul closed 2 years ago

Nai-mul commented 2 years ago

Symbol: GALAUSDT Start Balance: -99 <class 'binance.exceptions.BinanceAPIException'> Bot.py 728 Error in websocket, Restarting Account Balance: 1833.02999368 Profit: 0 Task exception was never retrieved future: <Task finished name='Task-5' coro=<ThreadedApiManager.start_listener() done, defined at /home/boss/conor2/.env/lib/python3.8/site-packages/binance/threaded_stream.py:42> exception=UnboundLocalError("local variable 'Date' referenced before assignment")> Traceback (most recent call last): File "/home/boss/conor2/.env/lib/python3.8/site-packages/binance/threaded_stream.py", line 52, in start_listener callback(msg) File "Bot.py", line 556, in handle_socket_message Date = flow.dataStream(Date, datetime.utcfromtimestamp(round(float(payload['t'])/1000)), 1, 300) UnboundLocalError: local variable 'Date' referenced before assignment <class 'binance.exceptions.BinanceAPIException'> Bot.py 728 Error in websocket, Restarting Account Balance: 1833.02999368 Profit: 0 <class 'binance.exceptions.BinanceAPIException'> Bot.py 728 Error in websocket, Restarting

conor19w commented 2 years ago

Have you the latest script? Line 728 for me is the backtesting section and it doesn't use websockets

Nai-mul commented 2 years ago

hi yes i am using latetst script and i get this error when i switch on for trading = 1. backtest are going fine.

conor19w commented 2 years ago

Just comment out Date = flow.dataStream(Date, datetime.utcfromtimestamp(round(float(payload['t'])/1000)), 1, 300) or else add a global variable 'Date' in handle_socket_message(). The date isn't actually used for anything at the minute, should fix the issue