From c4900af08887fb434f8c5f189d1a696a3aaae2a1 Mon Sep 17 00:00:00 2001 From: fredfortier Date: Tue, 5 Sep 2017 00:58:11 -0400 Subject: [PATCH] Minor fix in the graph logic --- catalyst/exchange/live_graph_clock.py | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/catalyst/exchange/live_graph_clock.py b/catalyst/exchange/live_graph_clock.py index 589446ff..1dfa7cb2 100644 --- a/catalyst/exchange/live_graph_clock.py +++ b/catalyst/exchange/live_graph_clock.py @@ -11,20 +11,15 @@ # See the License for the specific language governing permissions and # limitations under the License. -from time import sleep - -import numpy as np -from matplotlib import pyplot as plt -from matplotlib import style +import matplotlib.dates as mdates import pandas as pd from catalyst.gens.sim_engine import ( BAR, - SESSION_START, - MINUTE_END, - SESSION_END + SESSION_START ) from logbook import Logger -import matplotlib.dates as mdates +from matplotlib import pyplot as plt +from matplotlib import style log = Logger('LiveGraphClock') @@ -164,11 +159,14 @@ class LiveGraphClock(object): self._last_emit = current_minute yield current_minute, BAR - self.draw_pnl() - self.draw_custom_signals() - self.draw_exposure() + try: + self.draw_pnl() + self.draw_custom_signals() + self.draw_exposure() - plt.draw() + plt.draw() + except Exception as e: + log.warn('Unable to update the graph: {}'.format(e)) else: # I can't use the "animate" reactive approach here because