All Posts
ProductPoint-in-Time DataFundamentals APIBacktesting

Point-in-Time Fundamentals API for Backtesting

A point-in-time fundamentals API for backtesting: every restatement kept as a trail with SEC accession numbers, in one request, no as-of queries.

Published November 24, 20269 min readAndy Reimann
Point-in-Time Fundamentals API for Backtesting

The best API for backtesting fundamentals is a point-in-time fundamentals API. It tells you what a company's financial statements looked like on the day your backtest trades, not what they look like today. The gap between the two can be large. General Electric's revenue for fiscal year 2022 is $76.6 billion, $58.1 billion or $29.1 billion, depending on which annual report you read.

Point-in-time fundamental data is rare, and most of it has been sold as enterprise data feeds. I built StockFit so that it comes with every statement request. One response holds the current value, every restated value before it and the SEC filing behind each version. There is no as-of parameter and no second endpoint. This post shows what that looks like and how to use it.

What the best API for backtesting fundamentals must do

Historical prices are simple: a close is a close. Historical fundamentals are not, because company fundamentals change over time. For every value in a backtest, the data has to answer three questions:

  • When did it become public? A fiscal year ends on December 31 and the 10-K arrives weeks later. That filing lag is the first thing a backtest has to respect, so you need the filing date, and ideally the time.
  • What was it before? A company restates, or a later filing presents an old year again on a new basis. You need the previously reported value, not only the newest one.
  • Which filing says so? Without the source document you can't check any of it.

An API that answers only the first question stops you from reading a report before it was filed. You still read restated financials years early. An API that answers none of them gives you historical data, which is not the same as point-in-time data. The longer explanation, with lookahead bias and survivorship bias, is in why point-in-time data is essential for backtesting.

One request, every version of a number

GE filed its 10-K for fiscal year 2022 on February 10, 2023, with revenue of $76,555 million. It had completed the spin-off of GE HealthCare on January 3, 2023, and the spin-off of GE Vernova followed on April 2, 2024. After each one, the next 10-K presented 2022 again without that business. Nothing was wrong with the original filing. The same year simply has three reported values.

GE fiscal 2022 revenue: one year, three versions
The value a backtest could see on each date. Source: StockFit /api/financials/income-statement, as of 2026-11-24.
  1. $76,555M10-K filed 2023-02-10
    As first filed, with GE HealthCare and GE Vernova included
    0000040545-23-000023
  2. $58,100M10-K filed 2024-02-02
    GE HealthCare moved to discontinued operations
    0000040545-24-000027
  3. $29,139M10-K filed 2025-02-03
    GE Vernova moved to discontinued operations
    0000040545-25-000015

A database that keeps only the latest value shows $29.1 billion for a year in which the 10-K said $76.6 billion. That is 62% lower. Any growth rate or price-to-sales ratio that a backtest of 2023 builds on it is wrong, and nothing in the backtest results will tell you.

Here is the request. Fiscal 2022 is four annual periods back, which needs the Starter plan or above.

python
import os
import requests

BASE_URL = "https://api.stockfit.io/v1"
HEADERS = {"Authorization": f"Bearer {os.environ['STOCKFIT_API_KEY']}"}

periods = requests.get(
    BASE_URL + "/api/financials/income-statement",
    params={"symbol": "GE", "period": "annual", "limit": 4},
    headers=HEADERS,
    timeout=30,
).json()
fy2022 = next(p for p in periods if p["fiscalYear"] == 2022)

And this is that period in the real response, cut down to one line item:

json
{
  "period": "2022-12-31",
  "fiscalYear": 2022,
  "fiscalPeriod": "FY",
  "dateFiled": "2023-02-10",
  "acceptedAt": "2023-02-10T13:32:52Z",
  "facts": { "revenue": 29139000000 },
  "sources": {
    "0000040545-23-000023": {
      "type": "10-K", "dateFiled": "2023-02-10", "acceptedAt": "2023-02-10T13:32:52Z", "amendment": false,
      "facts": { "revenue": {} }
    },
    "0000040545-24-000027": {
      "type": "10-K", "dateFiled": "2024-02-02", "acceptedAt": "2024-02-02T11:31:30Z", "amendment": false,
      "facts": { "revenue": { "before": 76555000000 } }
    },
    "0000040545-25-000015": {
      "type": "10-K", "dateFiled": "2025-02-03", "acceptedAt": "2025-02-03T11:31:16Z", "amendment": false,
      "facts": { "revenue": { "before": 58100000000 } }
    }
  }
}

facts holds the value as of today. sources lists every filing that reported the period, oldest first, keyed by SEC accession number. An empty {} means the filing supplied the value or left it unchanged. A before means the filing changed it, and gives the value it replaced. Read from the bottom: the 2025 filing replaced $58,100 million, and the 2024 filing replaced $76,555 million.

Income statements come from /api/financials/income-statement. Balance sheets and cash flow statements have the same trail on /api/financials/balance-sheet and /api/financials/cash-flow-statement, for annual and quarterly data.

Any as-of date, no as-of requests

The self-serve point-in-time APIs I have seen work in one of two ways. Some take an as-of date as a parameter, so each request answers one date. Others return two values per line item, the original and the latest. For GE that loses the $58.1 billion in between, which was the reported value for a full year.

With the trail in the response, you pick the as-of date in your own code. Take a backtest of 500 companies over 10 years with monthly rebalancing and one statement type:

As-of parameter
60,000
requests: one per company and rebalance date
Restatement trail
500
requests: one per company, every date included

The rewind is short. Drop the period if its original filing was not public yet, undo every change that came later, and keep only the line items a filing had reported by then:

python
def public_at(entry, fallback=None):
    if entry.get("acceptedAt"):
        return entry["acceptedAt"]
    if entry.get("dateFiled"):
        return entry["dateFiled"] + "T23:59:59Z"
    return fallback


def as_known_on(period, as_of):
    """The filed values of one period as they stood at as_of, or None if it was not public yet."""
    released = public_at(period)
    if released > as_of:
        return None
    facts = dict(period["facts"])
    known = set()
    filings = sorted(period["sources"].values(), key=lambda f: public_at(f, released), reverse=True)
    for filing in filings:
        if public_at(filing, released) > as_of:
            for name, change in filing["facts"].items():
                if "before" in change:
                    facts[name] = change["before"]
        else:
            known.update(filing["facts"])
    return {name: facts[name] for name in known if name in facts}


for as_of in ("2023-06-30T20:00:00Z", "2024-06-28T20:00:00Z", "2025-06-30T20:00:00Z"):
    print(as_of[:10], as_known_on(fy2022, as_of)["revenue"])

# 2023-06-30 76555000000
# 2024-06-28 58100000000
# 2025-06-30 29139000000

Three things to know when you use it:

  • The function returns filed values only. Fields listed in the period's derived array (for GE: operating income, EBIT and EBITDA, among others) are calculated by StockFit from the current values, so calculate them again after a rewind.
  • EPS and share counts are adjusted for stock splits by default. Pass splitAdjust=false when you rewind per-share values, and read how to adjust historical EPS for stock splits first.
  • Quarterly data works the same way. Companies file no fourth quarter, so Q4 is derived from the 10-K, as described in how to calculate Q4 earnings.

For a longer walkthrough of the same idea in JavaScript, see stock backtesting without look-ahead bias.

Reconcile and audit from the same response

The trail is useful outside a backtest too. If a number in your own database no longer matches the API, the before values show which filing changed it and by how much, so you can reconcile the two without opening a single PDF. Add includeSourceDetails=true and every entry also names the XBRL concept the value was read from and the unit as filed:

json
"0000040545-26-000008": {
  "type": "10-K", "dateFiled": "2026-01-29", "acceptedAt": "2026-01-29T11:32:04Z", "amendment": false,
  "facts": {
    "revenue": { "concept": "us-gaap:Revenues", "unit": "USD" },
    "netIncome": { "concept": "us-gaap:NetIncomeLoss", "unit": "USD" }
  }
}

To audit a value, take its accession number to /api/filings/search-by-accession-number. It returns the filing with the link to the document on SEC EDGAR. The first key in the GE example is 0000040545-23-000023, and this is the 10-K it points to. You can look up any accession number yourself in the SEC filings search.

acceptedAt is the second SEC EDGAR accepted the filing, in UTC. GE's 10-K was accepted at 13:32:52 UTC, which is 8:32 a.m. in New York, before the market opened. A backtest that trades at the open could use it that same day. A filing date alone can't tell you that.

Why point-in-time fundamental data is rare

Most data pipelines store one row per company and fiscal period. When a company restates, the row is updated. Amendments and reclassifications overwrite the historical record the same way, and once that has happened, the earlier value can't be recovered from that database. This is how restatements silently end up in backtests.

Keeping the history means storing every value from every filing and working out the statement when it is requested. That is how StockFit is built: each value from each filing is stored with its accession number, and the trail is put together on request. It is why the trail is on every plan and costs no extra call. Outside of enterprise data feeds I know only a few APIs that offer point-in-time fundamentals at all.

What it covers, so you know before you build on it:

  • Companies that file with the SEC. The statements are built from the periodic reports: 10-K, 10-Q, 20-F, 40-F and their amendments. Figures a company first recasts in an 8-K enter the trail with the next periodic report that carries them.
  • Historical depth depends on the plan. The Free plan returns the latest fiscal year and the last four quarters, with the full trail. The Starter plan reaches 10 years of historical data, and the Pro plan returns up to 80 periods per request.
  • Point in time fixes the numbers, not the universe. A backtest also needs the companies that no longer trade, which is covered under survivorship bias in financial data.

If you do quantitative research on fundamentals, the StockFit fundamentals API for quants page lists the rest of the data. To see the trail on a company you know, and request its latest year. StockFit provides data, not investment advice.

FAQ

Q.What is the best API for backtesting fundamentals?
One that is point in time. For every value it has to tell you when the filing became public, what the value was before each restatement, and which SEC filing each version comes from. Without those three you test on numbers nobody had on the test date. StockFit returns all three in the statement response itself.
Q.What is a point-in-time fundamentals API?
An API that can answer what a financial statement looked like on a past date, not only what it looks like today. It keeps the originally filed value next to every later restatement and stamps each version with the date and time it became public.
Q.How do I get originally reported financials instead of restated ones?
Request the statement and read the sources map of the period. Every filing that changed a value carries a before entry with the value it replaced, so the first before in the chain is the originally reported figure. For GE fiscal 2022 revenue that is $76,555 million, against $29,139 million served today.
Q.Do I need an as-of date parameter for point-in-time data?
Not with a restatement trail. The response already holds every version with its acceptance time, so you rewind it to any date in your own code. One request per company covers every rebalance date, where an as-of parameter needs one request per company and date.
Q.How do I see what a restatement changed?
Each filing in the sources map lists the line items it changed, with the previous value as before. A line item the filing did not change is either absent or an empty object. Add includeSourceDetails=true to also get the XBRL concept and the unit as filed.
Q.Is point-in-time fundamental data available on a free plan?
Yes. The restatement trail is part of the income statement, balance sheet and cash flow statement responses on every StockFit plan. The Free plan returns the latest fiscal year and the last four quarters, the Starter plan reaches 10 years, and the Pro plan returns up to 80 periods per request.

Ready to build?

Free API key, no credit card.