Skip to content

Instantly share code, notes, and snippets.

'''
I understand your concerns. Here's an updated version of the requirements list to address the connection issue:
The script starts by attempting to connect to the IB Gateway.
If the connection is unsuccessful, the script will retry multiple times (e.g., every 30 seconds) for a specified duration (e.g., 3 minutes) before notifying the user via Telegram.
During the entire time the script is running, it should continuously check the connection to the IB Gateway.
If the connection is lost at any point, the script should try to reconnect multiple times (e.g., 5 times) and then notify the user if it is unable to reconnect.
Every day at 3:30 AM New York time, the script checks a Telegram channel for a specific message ("I'm here") sent between 1:00 AM and 3:30 AM.
If the message is not found, the script sends a signal to the IB Gateway to cancel all active orders.