test_algorithm.py 文件源码

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

项目:catalyst 作者: enigmampc 项目源码 文件源码
def test_run_twice(self):
        algo1 = TestRegisterTransformAlgorithm(
            sim_params=self.sim_params,
            sids=[0, 1],
            env=self.env,
        )

        res1 = algo1.run(self.data_portal)

        # Create a new trading algorithm, which will
        # use the newly instantiated environment.
        algo2 = TestRegisterTransformAlgorithm(
            sim_params=self.sim_params,
            sids=[0, 1],
            env=self.env,
        )

        res2 = algo2.run(self.data_portal)

        # There are some np.NaN values in the first row because there is not
        # enough data to calculate the metric, e.g. beta.
        res1 = res1.fillna(value=0)
        res2 = res2.fillna(value=0)

        np.testing.assert_array_equal(res1, res2)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号