22_custom_factors.py 文件源码

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

项目:quantopian_commands 作者: nmasamba 项目源码 文件源码
def compute(self, today, asset_ids, out, values):
        # *inputs are M x N numpy arrays, where M is the window_length and N is the number of securities
        # out is an empty array of length N. out will be the output of our custom factor each day. The job of compute is to write output values into out.
        # asset_ids will be an integer array of length N containing security ids corresponding to the columns in our *inputs arrays.
        # today will be a pandas Timestamp representing the day for which compute is being called.
        # Calculates the column-wise standard deviation, ignoring NaNs
        out[:] = numpy.nanstd(values, axis=0)

# instantiate custom factor in make_pipeline()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号