Building the honest pipeline
In this capstone you build a monthly stock model from raw prices to a verdict, and every step is chosen to avoid fooling yourself. You turn daily closes into month-end prices, build three features that use only the past (momentum, last month's return and volatility) and a label that looks three months ahead, and standardise features and labels inside each month so the model learns to rank stocks, not to time the market. Then you cut time into purged and embargoed walk-forward folds, fit a scikit-learn Ridge model on each fold's past, score every test month with the information coefficient, and finally shuffle one feature at a time to see which one the model really uses.
ICₜ=ρ(rank(pₜ), rank(yₜ)), train: j<a-H-e, Iⱼ=IC-ICⱼ
What the real data saysOn the 54 full-history stocks, from 2000, a monthly model with a 3-month label and an embargo of 3 months is tested on 257 months in 10 walk-forward blocks. The mean information coefficient is 0.033 with a t-statistic of 2.45, and 56% of the months are positive. Shuffling volatility inside each test month removes the whole signal (importance 0.033), while shuffling momentum or last month's return changes nothing (about -0.003). The model rests on one feature. A random forest on the same panel scores 0.102 in sample and -0.008 in walk-forward tests, and the ridge penalty does not matter: the IC is 0.033 for every α from 0.01 to 10⁴. Dropping the embargo changes the IC by 0.0001, because three-month labels overlap only a little.
- Rank inside each month: standardise features and labels within a month so the model ranks stocks.
- Purge, embargo, then score: fit on the past of each fold only and score each test month by its IC.
- Ask what the model used: a permutation test shows whether the signal is one feature or many.
Simplifications to rememberThe sample holds only large companies that survived the whole period, so it is survivor-biased and its signal may be overstated. There are no trading costs, no portfolio construction and a single linear model. An IC of 0.033 is a statistical result and not a strategy, and one feature carrying all of it is a reason for caution.
Lab · what's graded
- Month-end prices10 pts
- The feature and label panel20 pts
- Standardise inside each month10 pts
- Demean the label5 pts
- Purged walk-forward folds15 pts
- The rank correlation of a month5 pts
- Score a Ridge model month by month15 pts
- Which feature does the model use10 pts
- The whole study10 pts