Quantitative platform in test.py 文件源码

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

项目:Quantitative-Trading-System 作者: carlche15 项目源码 文件源码
def __init__(self, ax, x, y,ttype, ith=0, formatter=fmt):
        try:
            x = np.asarray(x, dtype='float')
        except (TypeError, ValueError):
            x = np.asarray(mdates.date2num(x), dtype='float')
        y = np.asarray(y, dtype='float')
        mask = ~(np.isnan(x) | np.isnan(y))
        x = x[mask]
        y = y[mask]
        self._points = np.column_stack((x, y))
        # All plots use the same pointer now
        # if(ith==0):
        self.offsets =(-20,20)
        # else:
        #  self.offsets=(-20-10*ith,20+25*ith)

        self.type=ttype
        y = y[np.abs(y - y.mean()) <= 3 * y.std()]
        self.scale = x.ptp()
        self.scale = y.ptp() / self.scale if self.scale else 1
        self.tree = spatial.cKDTree(self.scaled(self._points))
        self.formatter = formatter
        self.ax = ax
        self.fig = ax.figure
        self.ax.xaxis.set_label_position('top')
        self.dot = ax.scatter(
            [x.min()], [y.min()], s=130, color='green', alpha=0.7)
        self.annotation = self.setup_annotation()
        plt.connect('motion_notify_event', self)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号