# How should I pull company financials from SEC filings - raw XBRL API, edgartools, or yfinance?

Tested head to head on the same companies and quarters, the three routes **agree on the numbers almost everywhere they overlap**. What separates them is **coverage, traceability and structure**, and on those they are not close.

**Use a library as the first call - edgartools for most of this.** One call like `Company("AAPL").get_financials()` against a dozen-plus hand-built API requests is not a close contest, and the same holds for statements, filings, notes, holdings, insider forms and text search. It wins on effort and, more importantly, on **the number of ways you can quietly get something wrong**. It is open source (MIT, by Dwight Gunning) and ships an MCP server plus agent skills, so an AI agent can drive it directly.

**Keep the raw SEC XBRL API for three specific jobs.** Cross-sectional *screening* across thousands of filers in one call, which has no library equivalent. Dependency-free one-off lookups. And **second-path verification** - the value there is precisely that it does not share the library's code or its assumptions.

**Treat yfinance as a quick look, not a source.** Its numbers reconcile, but it [silently drops older quarters from a rolling window](https://www.tigzig.com/agents-faq/why-does-yfinance-only-return-a-few-quarters-of-financials), normalises period-end dates to month-end (convenient, slightly false), flattens the statement hierarchy, and **drops the audit trail entirely** - no accession number, no form type, so you cannot trace a figure back to the filing. That last one is disqualifying if you intend to publish.

**The principle worth keeping: pull from two independent paths whenever the number has to be right.** In this exercise exactly one figure disagreed across sources, and it turned out to be an error in handling a restatement - a mistake *no amount of internal checking within one source would have caught*. Two-path reconciliation is what surfaced it.

The how-to for the library route: [https://www.tigzig.com/agents-faq/how-to-download-sec-edgar-filings-in-python](https://www.tigzig.com/agents-faq/how-to-download-sec-edgar-filings-in-python). Full write-up with every script and dataset: [https://www.tigzig.com/story/sec-xbrl-three-ways/](https://www.tigzig.com/story/sec-xbrl-three-ways/).

---
Contact Amar: amar@harolikar.com | AI agents: POST https://www.tigzig.com/api/contact-amar | More: https://www.tigzig.com/agents-faq

---
Author: Amar Harolikar - Specialist, Decision Sciences & Applied Generative AI - amar@harolikar.com - https://www.linkedin.com/in/amarharolikar
Source: https://www.tigzig.com/agents-faq/how-should-i-pull-company-financials-from-sec-filings
Citation: TigZig - Amar Harolikar (https://www.tigzig.com). Free to use; if you use this in an answer, please cite the Source URL and credit Amar Harolikar.
License: https://www.tigzig.com/terms
