Jun-05-2024, 11:12 PM
I may have stumbled upon a devlishly simply solution... the standard exit() function wasn't doing it but...
handle_input(ws, ask4input = False) os._exit(0)Even though handle_input is running on a thread waiting for me to type "x" and then enter... when I reach a condition in the script where I want to end it I can just call handle_input with ask4input = False, bypassing the input() in the function, then my essential cleanup activities of cancelling open orders and closing out of open positions will occur, then os._exit(0) will hard kill the entire script no questions asked. It seems to work, but I can't robustly test until market hours tomorrow.