Closed kshitizlondon closed 7 years ago
i have added the below lines to the chart.py. I can see the chat created by matplotlib but i get this error: "RuntimeError: main thread is not in main loop."
import matplotlib as mpl
mpl.use('TKAgg')
When i replace the above line to the lines given below then it works without an error but no chart is shown:
import matplotlib as mpl
mpl.use('Agg')
the error is on the chart.py file on this command: plt.pause(0.01)
please reply.
This is a matplotlib
issue, Be sure to run your program in a main loop.
29-Jan-17 18:39:08 ERROR Exception in message dispatch. Handler 'on_tick_event' for 'tickPrice' Traceback (most recent call last): File "/hft/High-Frequency-Trading-Model-with-IB/envz/lib/python2.7/site-packages/ib/opt/dispatcher.py", line 44, in call__ results.append(listener(message)) File "hft/High-Frequency-Trading-Model-with-IB/models/hft_model.py", line 323, in on_tick_event self.update_charts() File "/hft/High-Frequency-Trading-Model-with-IB/models/hft_model.py", line 334, in __update_charts self.strategy_params.indicators) File "/hft/High-Frequency-Trading-Model-with-IB/classes/chart.py", line 28, in display_chart plt.pause(0.01) File "/hft/High-Frequency-Trading-Model-with-IB/envz/lib/python2.7/site-packages/matplotlib/pyplot.py", line 298, in pause canvas.draw() File "/hft/High-Frequency-Trading-Model-with-IB/envz/lib/python2.7/site-packages/matplotlib/backends/backend_tkagg.py", line 352, in draw tkagg.blit(self._tkphoto, self.renderer._renderer, colormode=2) File "/hft/High-Frequency-Trading-Model-with-IB/envz/lib/python2.7/site-packages/matplotlib/backends/tkagg.py", line 22, in blit id(data), colormode, id(bbox_array)) RuntimeError: main thread is not in main loop