Thanks both for the answers. I'm going to unpack this and play it back, as there's a lot of information in there.
Jonathan: First, I had always assumed sector neutrality was to avoid over-exposure to sector specific events, such as a cartel changing oil prices unexpectedly, causing companies in the energy sector to jump. But here you are relating it to breadth of the strategy, as in your blog post. Can you explain the "overwhelm any stock-specific alpha" part in more detail?
Second point is the assumption of beta of 1. This explains why it's so easy to make things dollar neutral using the Optimizer API, but there's no native support for calculating the sector beta of each stock. I'm guessing the performance gain from calculating another parameter (sector beta), and choosing a meta-parameter (look-back window length for the beta), in order to remove the exact beta from stock, is minimal. Assuming a beta of 1 is more or less the same as removing the cross sectional mean return within each sector (using
Factor.demean(groupby=Sector()). This will over-adjust some stocks, and under-adjust others, but I guess the errors are noise, which is likely to cancel out?
Third point is to take the sector risk out at the alpha modelling stage. This hadn't occured to me before, and is a great insight. I don't believe Pipeline natively supports removing the cross-sectional mean return from a time series of prices and/or returns, but I'm sure this is straightforward to implement in a
CustomFactor with numpy/pandas. I will post some code here.