Hi,
Is there a way to get the Returns() from individual alpha factors in the IDE over a specified (rolling) window period, ideally when using the Optimize API ( with opt.MaximizeAlpha objective) or if not, returns of the top and bottom quantiles/deciles of a factor?
Any kind python black-belt who knows if this is possible, maybe using the class object (with CustomFactor?), passing in the factor (or the top and bottom quantiles of the factor) and the desired window length? I've tried searching the forum for this, but couldn't find anything, and I'm pretty hopeless with python. Something like the below maybe?
class AlphaFactorReturns(CustomFactor, alpha_factor, window):
returns = Returns(window_length=63)
top_quantile = alpha_factor.deciles(9)
bottom_quantile = alpha_factor.deciles(0)
inputs = [returns, top_quantile, bottom_quantile, window]
window_length = 63 [or window]??
def compute(self, today, assets, out, returns, top_quantile, bottom_quantile):
out[:] = Returns(top_quantile) - Returns(bottom_quantile)
I'd really appreciate any help with this from anyone. Thank you.
Joakim