live_graph_clock.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:catalyst 作者: enigmampc 项目源码 文件源码
def __init__(self, sessions, context, time_skew=pd.Timedelta('0s')):

        global mdates, plt  # TODO: Could be cleaner
        import matplotlib.dates as mdates
        from matplotlib import pyplot as plt
        from matplotlib import style

        self.sessions = sessions
        self.time_skew = time_skew
        self._last_emit = None
        self._before_trading_start_bar_yielded = True
        self.context = context
        self.fmt = mdates.DateFormatter('%Y-%m-%d %H:%M')

        style.use('dark_background')

        fig = plt.figure()
        fig.canvas.set_window_title('Enigma Catalyst: {}'.format(
            self.context.algo_namespace))

        self.ax_pnl = fig.add_subplot(311)

        self.ax_custom_signals = fig.add_subplot(312, sharex=self.ax_pnl)

        self.ax_exposure = fig.add_subplot(313, sharex=self.ax_pnl)

        if len(context.minute_stats) > 0:
            self.draw_pnl()
            self.draw_custom_signals()
            self.draw_exposure()

        # rotates and right aligns the x labels, and moves the bottom of the
        # axes up to make room for them
        fig.autofmt_xdate()
        fig.subplots_adjust(hspace=0.5)

        plt.tight_layout()
        plt.ion()
        plt.show()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号