In the following example:
class PriceRange(CustomFactor):
"""
Computes the difference between the highest high and the lowest
low of each over an arbitrary input range.
"""
inputs = [USEquityPricing.high, USEquityPricing.low]
window_length = 252
def compute(self, today, assets, out, highs, lows):
out[:] = np.nanmax(highs, axis=0) - np.nanmin(lows, axis=0)
The inputs are ndarray objects, without the corresponding datetime index. How can we pass in the corresponding datetime index at the same time? Or is there a way to reconstruct the correct datetime index inside the compute method?
I would like to reconstruct the dataframe inside the compute method so as to do weekday resampling.
Thanks a lot for helping!