Python for Market Data, lesson 7
Point-in-time joins
Using only what was known at the time, so no look-ahead.
You can join tables by date and rank stocks across each day.
Part 1. When did you know it?
A simulated company's quarter ended on 31 March 2026. Its earnings came out on 28 April, after the close. Join them to daily prices and see when your table first knows them.
The quarter end is the date the numbers describe. The release is the date anyone could read them. Joined on the quarter end, the table knew the good news four weeks early, and a rule reading that table bought before the jump.
Look-ahead bias and point in time
Look-ahead bias is a test using information before it was available. A point-in-time table stores each value with the date it became known, so a join can ask: what did we know on this day?
Your turn
An as-of join picks, for each day, the latest report published on or before that day. Reports came out on 3 February and 28 April. Which one does 27 April get?
Part 2. Read it in plain words
Keep going with Pro
You've done the first part. Pro opens the rest of this lesson, and every other one.
- Read it in plain words
- Find the leak
- Worked: earnings for every stock, as of each day
- The same thing, for real
Python for Market Data overviewSpotted a mistake? Tell us.