Building the normalized volume features from raw data — what I got wrong
Tried to build the volume ratio and turnover measures people described here. Both were harder than expected and I got them wrong in instructive ways.
Volume ratio. My first version compared current volume to the average over recent full days. That's wrong. It says "it's the open, so volume is high" every single morning. The denominator has to be the average at the same point in the session, otherwise the measure just rediscovers the intraday volume curve.
Turnover. I divided by shares outstanding rather than shares actually available to trade. For most names the difference is modest; for anything with a large locked-up or insider-held portion it's enormous, and those are exactly the names where the measure would have been most informative.
Both mistakes have the same shape: I normalized by something convenient rather than something correct, and got a number that looked reasonable and meant something different from what I intended.
Posting the errors because the concepts were shared here and the implementation details weren't obvious to me.