Two questions, two values
| Your question | Value to use | Typical use |
|---|---|---|
| What could an investor have known on date X? | The first filed value, replaced by any revision filed on or before X | Backtests, event studies |
| What does the company now say happened in that period? | The latest filed value | Long-run trends, today's models |
Mixing the two is a common source of look-ahead bias. A backtest that reads the latest values gives itself corrections that arrived months or years after the trade date.
Where the versions come from
The same period's number can appear in several filings. The first 10-Q or 10-K for the period reports it. Later reports repeat it as a comparison. When a company finds an error, a later filing carries the corrected figure.
The SEC's XBRL APIs on data.sec.gov keep every appearance as its own row, with the filing's accession number (accn), form and filed date. No API key is needed.
Most rows are repeats. Apple's fiscal 2024 revenue, $391,035 million, appears in its 10-Ks filed on 1 November 2024, 31 October 2025 and 3 November 2026, with the same value each time.
A real restatement: Kraft Heinz
On 6 May 2019 Kraft Heinz filed an 8-K under Item 4.02, the item for non-reliance on earlier financial statements. It said its statements for fiscal 2016 and 2017, and for the quarters and year-to-date periods through 29 September 2018, should no longer be relied upon. It filed the restated figures in its fiscal 2018 10-K on 7 June 2019. The SEC later said the restatement corrected a total of $208 million in improperly recognised cost savings.
Here is what the company's NetIncomeLoss rows on data.sec.gov show for three of those periods (in millions of dollars):
| Period | Original value | First filed | Restated value | Restated in filing of |
|---|---|---|---|---|
| Fiscal 2016 (to 2016-12-31) | 3,632 | 2017-02-23 (10-K) | 3,596 | 2019-06-07 (10-K) |
| Fiscal 2017 (to 2017-12-30) | 10,999 | 2018-02-16 (10-K) | 10,941 | 2019-06-07 (10-K) |
| Q3 2018 (2018-07-01 to 2018-09-29) | 630 | 2018-11-02 (10-Q) | 619 | 2019-06-07 (10-K) |
Three details in these rows matter for your code. The fiscal 2016 figure was repeated unchanged in the 10-K filed on 16 February 2018 before it changed, so a repeat can come before a restatement. The correction arrived in a normal 10-K. And a backtest dated between 16 February 2018 and 7 June 2019 must use $10,999 million for fiscal 2017, since nobody outside the company had the revised figure yet.
Across the whole concept, 13 Kraft Heinz periods changed value in the 7 June 2019 filing, from fiscal 2016 through the third quarter of 2018.
How to tell a repeat from a restatement
Group the rows for one concept by exact period (start and end), sort each group by filed, and compare values. This script runs against the public SEC endpoint and prints every Kraft Heinz period whose net income changed:
import gzip
import json
import urllib.request
from collections import defaultdict
HEADERS = {"User-Agent": "Your Name your.email@example.com", "Accept-Encoding": "gzip"}
def get_json(url):
req = urllib.request.Request(url, headers=HEADERS)
with urllib.request.urlopen(req, timeout=30) as resp:
body = resp.read()
if resp.headers.get("Content-Encoding") == "gzip":
body = gzip.decompress(body)
return json.loads(body)
url = "https://data.sec.gov/api/xbrl/companyconcept/CIK0001637459/us-gaap/NetIncomeLoss.json"
rows = get_json(url)["units"]["USD"]
by_period = defaultdict(list)
for row in rows:
by_period[(row.get("start"), row["end"])].append(row)
for period, versions in sorted(by_period.items()):
versions.sort(key=lambda r: r["filed"])
original = versions[0]
changed = [r for r in versions if r["val"] != original["val"]]
if changed:
first_change = changed[0]
print(period, original["val"], original["filed"], "->", first_change["val"], first_change["filed"])
Replace the placeholder User-Agent with your own name and email, as the SEC asks.
What to ask of any dataset
If you show historical financials to users, decide which version you display and say so. If you test strategies, you need every version with its filed date, so you can rebuild what was known on each day. Before you rely on a source, check whether it keeps the original value or overwrites it with the latest.
Younesa is building US company data from SEC filings.