Day 143 — The fill model is where optimism hides
Sunday, 27 December 2026 · Week 21 of 52 · The research harness · Study day · 60 min
Every result you have reported so far assumed you traded at a printed close, and the fill model is the component that decides how large a lie that is.
What you should be able to do tonight
- Implement a fill model with a stated price convention and a participation constraint, and say what each assumes.
- Report the difference in your strategy’s Sharpe between three fill conventions.
Tasks 60 min
35 min Write qlib/backtest/fills.py with three models behind one interface: fill at the close, fill at the close plus half the spread in the direction you traded, and fill at a volume-weighted price with a participation cap that rejects the excess. The third one produces partial fills, which the portfolio has to handle.
25 min Run the trend follower and the pairs strategy under all three and report the Sharpe under each. Then find the participation rate at which the pairs strategy’s fills start being rejected, and note what that says about its capacity before you have any impact model at all.
The running strategy
The engine has a pluggable fill model with three conventions and partial fills, so the price a backtest assumes is a stated configuration rather than a hidden default.
Resources
Deliverable
qlib/backtest/fills.py with three models, and both strategies’ Sharpe reported under each.
Checkpoint
Your backtest fills at the mid. Name three reasons that is wrong, ordered by how much each costs you.
Prepare for tomorrow
Ten minutes tonight so Day 144, Monday, 28 December 2026 starts clean. This is what the evening email sends you.
List the states an order can be in between submission and settlement. There are more than you think.
For each state, write what could go wrong and what the engine should do about it.
This is the design for tomorrow, so it is worth ten real minutes.