If you backtest with today's fundamentals, you are cheating yourself. The Revenue figure you pull for Q4 2019 was probably restated in 2021, and the restated number was not knowable on the day you would have traded. That gap is lookahead bias, and it is why "point-in-time" (PIT) fundamentals exist: a dataset that answers what did filers report, and when did the market first see it?

The good news: the raw material is free and public. The SEC's EDGAR system publishes structured XBRL financials for every US filer, and with enough patience you can assemble a real PIT database yourself. The honest news: a few steps are fiddly enough that most DIY builds ship a subtle bug. This guide teaches the whole pipeline — our full methodology is public on GitHub — then weighs the cost fairly so you can decide whether to build or buy.

The build: EDGAR companyfacts, step by step

1. Pull companyfacts. EDGAR exposes a per-company JSON blob at data.sec.gov/api/xbrl/companyfacts/CIK{10-digit}.json. It contains every XBRL fact the company has ever tagged, grouped by taxonomy (us-gaap, dei) and concept, each with an array of reported values. This is your source of truth. Respect the SEC's fair-access rules (declare a User-Agent, throttle to ~10 requests/sec).