I tested the update V3.04 and we still have issues, probably makes it worse
When shutting down program and making call to self.fyers.close_connection() fyers_apiv3\FyersWebsocket\order_ws.py line #291self.fyers.close_connection() #Getting the following exception if self.fyers: self.fyers.close_connection() File "C:\Python\Python39-32\lib\site-packages\fyers_apiv3\FyersWebsocket\order_ws.py", line 428, in close_connection self.__on_close(None) File "C:\Python\Python39-32\lib\site-packages\fyers_apiv3\FyersWebsocket\order_ws.py", line 291, in __on_close time.sleep(self.reconnect_delay) AttributeError: 'FyersOrderSocket' object has no attribute 'reconnect_delay'
Another variable not defined that throws Exception fyers_apiv3\FyersWebsocket\order_ws.py #line number 284 and 296 --> variable not defined ----> self.data_logger.debug if self.write_to_file: self.data_logger.debug( f"Response:{f'Attempting reconnect {self.reconnect_attempts} of {self.max_reconnect_attempts}...'}"
Major issue: When we call fyers close_connection func instead of disconnecting it is trying to reconnect
temporary fix is to disable restart and large arbitrary reconnect_attempt
def close_connection(self):
"""
Closes the WebSocket connection
"""
if self.__ws_object is not None:
self.restart_flag = 0
self.reconnect_attempts = 100
## rest of the code
out of 4 posts, 2 are pending review but point 3 is creating a deadlock because auto reconnect is being triggered when trying to disconnect or close the socket.
and because the timer sleep variable is not defined, auto reconnect is not waiting at all and attempting to connect back to back
point #1 post missed for Exception in Order socket
if self.fyers: self.fyers.close_connection()
File "C:\Python\Python39-32\lib\site-packages\fyers_apiv3\FyersWebsocket\order_ws.py", line 428, in close_connection
self.__on_close(None)
File "C:\Python\Python39-32\lib\site-packages\fyers_apiv3\FyersWebsocket\order_ws.py", line 291, in __on_close
time.sleep(self.reconnect_delay)
AttributeError: 'FyersOrderSocket' object has no attribute 'reconnect_delay'