Open alexh0101 opened 2 years ago
I made my own function for the timeouts.
def get_bars(wb, stock=None, tId=None, interval='m1', count=1, extendTrading=0, timeStamp=None): # add fix try: stock = wb.get_bars(stock=stock, tId=tId, interval=interval, count=count, extendTrading=extendTrading, timeStamp=timeStamp) except TimeoutError: wb.logout() time.sleep(5) wb.login() time.sleep(5) stock = wb.get_bars(stock=stock, tId=tId, interval=interval, count=count, extendTrading=extendTrading, timeStamp=timeStamp) time.sleep(5) finally: return stock
Hope this helps
Hi there, Thanks for that. Your code is to download the historical data, but I was talking about the bars coming in via websocket.
Did you make something similar but for the websocket?
How do I get the 1 minute bars instead of the trades via the websocket, instead of the trades?
Also, I was never able to get websocket data for more than 20 minutes. Does everyone experience that same timeout of the websocket after 10-20 minutes?