Day 110 — One covariance interface, four estimators behind it
Tuesday, 24 November 2026 · Week 16 of 52 · Portfolios and risk · Study day · 60 min
The estimator choice should be a configuration line rather than a rewrite, because milestone 4 compares four of them and phase 6 will want to change it again.
What you should be able to do tonight
- Return a covariance estimate from one function with the estimator selectable, all guaranteed positive definite.
- Show the four estimators’ predicted-versus-realised risk on the same rolling out-of-sample test.
Tasks 60 min
35 min Write qlib/risk.py with covariance(returns, method) supporting sample, clipped, Ledoit-Wolf and single-factor, each returning a positive definite matrix. Add a test asserting positive definiteness and symmetry for every method on every rolling window of your sample.
25 min Produce the comparison figure milestone 4 needs: for each estimator, out-of-sample realised risk of the minimum-variance portfolio against the risk it predicted, with equal weighting marked as the horizontal reference. Save it into reports/milestone-04-risk-model.md.
The running strategy
qlib/risk.py gives the project one covariance interface with four estimators behind it, tested for positive definiteness on every window. The portfolio construction code no longer knows or cares which estimator is in use.
Resources
Deliverable
qlib/risk.py with four tested covariance estimators, and the predicted-against-realised risk figure in the milestone report.
Checkpoint
Your Ledoit-Wolf estimate fails positive definiteness on one window. What happened, and what does your code do about it?
Prepare for tomorrow
Ten minutes tonight so Day 111, Wednesday, 25 November 2026 starts clean. This is what the evening email sends you.
Regress your 200 names’ daily returns on the market return and keep the residuals.
Compute the correlation matrix of those residuals and look at its largest off-diagonal entries.
Note which pairs they are. They will not be random.