alphatrade
alphatrade copied to clipboard
Error: __on_close_callback() takes from 1 to 2 positional arguments but 4 were give
Getting below issue very frequently after some time of running program.
ERROR:websocket:error from callback <bound method AlphaTrade.__on_close_callback of <alphatrade.alphatrade.AlphaTrade object at 0x0000025FC445FF70>>: __on_close_callback() takes from 1 to 2 positional arguments but 4 were given
Generally happens on calling following function: sas.subscribe(optionType, LiveFeedType.COMPACT)
Trace logs are as follows: ERROR:websocket:error from callback <bound method AlphaTrade.__on_close_callback of <alphatrade.alphatrade.AlphaTrade object at 0x0000025FC445FF70>>: __on_close_callback() takes from 1 to 2 positional arguments but 4 were given
Traceback (most recent call last):
File "d:\alokguptaxggn\python_sandbox\python_stories\python_stories\01-Development\algoTrade\63AlgoTrade-MIS-4-RSI-56.py", line 238, in
File "C:\Users\alokg\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\websocket_core.py", line 283, in send
return self.send_frame(frame File "C:\Users\alokg\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\websocket_core.py", line 311, in send_frame
l = self._send(data)
File "C:\Users\alokg\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\websocket_core.py", line 525, in _send
return send(self.sock, data) File "C:\Users\alokg\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\websocket_socket.py", line 146, in send
raise WebSocketConnectionClosedException("socket is already closed.")
websocket._exceptions.WebSocketConnectionClosedException: socket is already closed.
Is it possible for your to share the code? using code formatting. I will check it out
Is it possible for your to share the code? using code formatting. I will check it out
Hi @algo2t, I am also receiving this error quite often. It happens sporadically.
2022-08-23 12:52:01,310 - ERROR - algo_test.py:292 - Error in subscribing to main instrument : EOF occurred in violation of protocol (_ssl.c:2384)
This happens when I try to subscribe to Nifty feed. Probably it could be for any instrument and not just for Nifty.
try:
x = sas.get_instrument_by_symbol('NSE', 'Nifty 50')
sas.subscribe(x, LiveFeedType.COMPACT)
subscribed = len(sas._AlphaTrade__subscribers)
sleep(1)
except Exception as e:
logging.error('Error in subscribing to main instrument : ' + str(e))
Does it has something to do with insufficient memory (RAM)? or anything else? Kindly help.