Monitor and Reconnect connection status
masterUse .check_connect() to detect if the WebSocket connection has closed. If it returns False, you should attempt to reconnect by calling .connect() again.
from iqoptionapi.stable_api import IQ_Option
iqoption = IQ_Option("email", "password")
check, reason = iqoption.connect()
if check:
while True:
if iqoption.check_connect() == False:
print("try reconnect")
check, reason = iqoption.connect()
if check:
print("Reconnect successfully")