Day 153 — The cost model, with the components separated

Wednesday, 6 January 2027 · Week 22 of 52 · The research harness · Study day · 60 min

A single cost number cannot be improved because you cannot tell which part of it is wrong, and separating the components is what lets phase 9 replace one of them without touching the others.

What you should be able to do tonight

  • Return a cost breakdown by component from the engine rather than a single number.
  • State which components are measured, which estimated and which assumed, for your own book.

Tasks 60 min

35 min Restructure qlib/costs.py so each component is a separate function behind a common interface, and the engine records the breakdown per fill into fills.parquet: half-spread, impact, commission, borrow, financing. The result object then reports the annual total by component.

25 min Produce the attribution table for both strategies: cost in basis points a year per component, with a column stating whether each is measured, estimated or assumed. That last column is the honest part and it is what makes the milestone credible.

The running strategy

Costs are recorded per fill and per component in fills.parquet, so the strategy’s cost can be attributed rather than only totalled. Phase 9 replaces the impact component with a fitted one and nothing else changes.

Resources

Deliverable

A per-component cost breakdown in the result object, with the measured-estimated-assumed attribution table for both strategies.

Checkpoint

Of your five cost components, which are you actually measuring, and what would it take to measure a second one?

Prepare for tomorrow

Ten minutes tonight so Day 154, Thursday, 7 January 2027 starts clean. This is what the evening email sends you.

Reread the taxonomy from day 134 and mark which entries your engine now makes impossible rather than unlikely.

The unmarked ones are next week’s test list.

Check the arithmetic drill times.