How can you access the history (e.g. 2 years) of a CustomFactor to train models during backtest? The only examples I've found use 'safe' CustomFactors to get around the window_safe
limitation, in order to use CustomFactors as input to other CustomFactors (the Quantopian ML example #3 does this). But I don't want to zscore/rank my factors to make them safe.
Workarounds I thought about:
1. Use a warm-up period and store the custom factor outputs every day into a data frame.
Problems:
1. Stocks move in and out of the universe, meaning some days will have NaN.
2. This breaks when a split/dividend adjustment occurs
2. Calculate the entire history every time the model training CustomFactor runs
Problem: this will waste CPU and probably take forever because each day we calculate n-1 days redundantly (n = history length)
I'm probably overlooking something obvious, since this is probably the most common quantitative trading model implementation in existence (i.e. WF with model retraining every n days). Any examples/pointers in the right direction would be greatly appreciated!