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()
评论列表
文章目录