Day 327 — Reconciliation, and explaining every difference

Tuesday, 29 June 2027 · Week 47 of 52 · Production · Study day · 60 min

The intended and actual portfolios always differ, and a system that cannot explain the difference is one where a real error hides among the expected ones.

What you should be able to do tonight

  • Produce a daily reconciliation report where every difference between intended and actual positions is categorised.
  • State what you do when a difference cannot be explained.

Tasks 60 min

35 min Build the report in qlib/run/reconcile.py: intended against actual positions and cash, with each difference attributed to a known cause such as a partial fill, a rejected order, a rounding to whole shares, a corporate action, or a fee. Anything left over goes into an unexplained bucket, and that bucket being non-empty is the alert.

25 min Reconcile the cash separately, because it catches different errors: starting cash plus fills plus fees plus dividends should equal ending cash exactly. Any discrepancy here is arithmetic rather than judgement, so the tolerance is a cent rather than a percentage.

The running strategy

Daily reconciliation compares intended against actual positions and cash with every difference attributed to a named cause, and an unexplained residual raises an alert rather than being absorbed.

Resources

Deliverable

qlib/run/reconcile.py producing a daily report with categorised differences and an exact cash reconciliation.

Checkpoint

What does reconciliation compare, how often, and what do you do when it disagrees?

Prepare for tomorrow

Ten minutes tonight so Day 328, Wednesday, 30 June 2027 starts clean. This is what the evening email sends you.

Schedule the daily run to execute by itself tomorrow morning, on a cron or a scheduler, and go to bed.

Do not plan to watch it.

The point of tomorrow is what happens when you are not looking.