Day 23 — The store, part three: the test that makes as-of true

Saturday, 29 August 2026 · Week 4 of 52 · Markets · Study day · 55 min

A point-in-time claim you have not tested is a comment, and comments do not stop you from reading the future.

What you should be able to do tonight

  • Write a test that fails if any query returns a row whose ingested_at is after the as-of date.
  • Say what your store would have returned on 12 March 2019, and demonstrate it rather than assert it.

Tasks 55 min

35 min Add as_of to the store’s query interface, defaulting to now, and make every read filter on ingested_at less than or equal to it. Then write tests/test_asof.py with two tests: one that inserts a row with a future ingested_at and asserts it is invisible, and one that reproduces the store’s state on a past date and asserts a known row count.

20 min Write qlib/ingest.py’s rebuild path: drop, recreate, ingest, verify row counts, in one command. Time it and put the number in the README. A store you are afraid to rebuild is a store you will stop trusting.

The running strategy

The as-of semantics are now enforced by two tests rather than by intention. This is the first instance of the pattern that week 23 generalises: leakage is prevented by construction and asserted by a test, never by remembering to be careful.

Resources

Deliverable

tests/test_asof.py passing, and a one-command rebuild whose runtime is recorded in the work repo README.

Checkpoint

Describe the test that would fail if someone added a query path that ignored as_of. If your suite does not have one, you have not finished.

Prepare for tomorrow

Ten minutes tonight so Day 24, Sunday, 30 August 2026 starts clean. This is what the evening email sends you.

Download the Ken French monthly market, size and value factor returns and save them. They are the input for the next four days.

Open AQR’s datasets page and note which series are free. You will use Betting Against Beta and time-series momentum in phase 6.

Read the first two paragraphs of the free chapter 1 of Ilmanen’s Investing Amid Low Expected Returns so tomorrow starts warm.