Day 117 — Neutralising a portfolio, and what it costs you
Tuesday, 1 December 2026 · Week 17 of 52 · Portfolios and risk · Study day · 65 min
Dollar neutral is not beta neutral and beta neutral is not factor neutral, and last night’s plot showed you that your existing strategy is none of the three.
What you should be able to do tonight
- Neutralise a portfolio against a set of factor exposures using a constrained optimisation, and confirm the residual exposures are zero.
- Report what neutralisation costs in expected return and what it buys in volatility, on your own strategy.
Tasks 65 min
30 min Add neutralise(weights, exposures) to qlib/portfolio.py: solve for the closest weight vector subject to zero exposure to a given set of factors, using CVXPY. Assert the resulting exposures are zero to numerical tolerance in a test.
25 min Apply it and report both sides of the trade-off: your pairs strategy neutralised against market beta, then against the four factors, then unneutralised. Report Sharpe, volatility, turnover and the factor loadings for all three. Neutralisation usually cuts return and cuts risk more, and the ratio is what decides it.
10 min Note the turnover cost: neutralisation adds trading, and that cost belongs in the comparison rather than in a footnote.
The running strategy
qlib/portfolio.py can now neutralise a weight vector against an arbitrary exposure set, with a test asserting the residual exposures are zero. The pairs strategy runs neutralised from here, and the unneutralised version stays as the comparison.
Resources
Deliverable
A tested neutralisation function in qlib/portfolio.py, and a three-way comparison of your strategy under two neutralisation regimes.
Checkpoint
Why neutralise a signal before evaluating it, and what specifically are you throwing away when you do?
Prepare for tomorrow
Ten minutes tonight so Day 118, Wednesday, 2 December 2026 starts clean. This is what the evening email sends you.
Read the linearmodels documentation page for Fama-MacBeth regressions and note what the two stages are.
Write down why the standard errors from a pooled regression would be wrong here.
You have made this argument before about clustered data.