The sleep time in the Polling class I made variable:
swigify_ib.i:
%pythoncode %{
import threading
import time
class TWSPoller(threading.Thread):
'''Polls TWS every second for any outstanding messages'''
def __init__(self, tws):
super(TWSPoller, self).__init__()
self.daemon = True
self._tws = tws
self.stop_polling = False
self.sleep_time = 1 # <-------
def run(self):
'''Continually poll TWS until the stop flag is set'''
while not self.stop_polling:
try:
self._tws.checkMessages()
except:
if self.stop_polling:
break
else:
raise
time.sleep(self.sleep_time) # <-------
%}
I tend to use a smaller sleep time. So now I am able to change the
sleep_time after the connection with: tws.poller.sleep_time = 0.2
Email correspondance with @olafsep01
The sleep time in the Polling class I made variable: swigify_ib.i:
I tend to use a smaller sleep time. So now I am able to change the sleep_time after the connection with: tws.poller.sleep_time = 0.2