It's common when writing algorithms using pipeline to have factors that rely on the same underlying data. We've added the ability for custom factors to define multiple outputs so that you can do all your computations requiring the same data in one factor.
Here is an example which returns the high and low prices for a 100 day window. If you clone the algorithm below, you can see the output in the logs.
class MultipleOutputs(CustomFactor):
# Define inputs and outputs.
inputs = [USEquityPricing.close]
# Specify and name the different outputs.
outputs = ['highs', 'lows']
window_length = 10
def compute(self, today, assets, out, close):
highs = np.nanmax(close, axis=0)
lows = np.nanmin(close, axis=0)
# Write the desired return values into `out.<output_name>` for each output name in `self.outputs`.
out.highs[:] = highs
out.lows[:] = lows
This is a very simple example and these factors will become powerful tools for building regression and correlation factors. Stay tuned for more in this department.