Packages
Open-source Python infrastructure for financial disclosure data, built as one stack with a hard boundary between its layers: the acquisition library talks to the SEC and returns typed objects, and the representation library reads those objects and performs no network I/O of its own. Each package is independently useful and has its own repository, documentation, and release cycle.
| Layer | Project | Python | Status |
|---|---|---|---|
| Acquisition | edgar-sec — SEC EDGAR REST API client |
3.9+ | Released |
| Representation | toros — point-in-time financial statements |
3.12+ | Pre-alpha |
edgar-sec
A feature-rich Python package for interacting with the US Securities and Exchange Commission API: EDGAR.
edgar-sec is a fully typed Python SDK for the SEC EDGAR REST API. It covers submissions, company concepts, company facts, frames, and CIK/ticker resolution through a small public front door, and returns every response as a typed dataclass rather than a raw dict. Synchronous and asynchronous clients are kept in strict parity, a built-in rate limiter respects EDGAR’s fair-access rules, and local caching is optional.
It is the acquisition layer of the stack: toros builds its fact table from the CompanyFacts object that edgar-sec returns.
pip install edgar-sec
import edgar_sec as ed
edgar = ed.EdgarAPI()
cik = ed.EdgarHelpers.get_cik(ticker="AAPL")
submissions = edgar.get_submissions(ticker="AAPL")
facts = edgar.get_company_facts(ticker="AAPL")
The async client is the same surface behind one attribute:
edgar = ed.EdgarAPI().Async
facts = await edgar.get_company_facts(ticker="AAPL")
Docs · PyPI · conda-forge · GitHub
toros
Point-in-time financial statements for Python: every XBRL fact on one concept × period × vintage cube, with the tag lineage that produced it.
Pre-alpha. toros 0.0.1 on PyPI reserves the name and contains no code. What follows describes the design the first alpha is being built to; nothing below is importable yet.
toros is a typed representation layer for XBRL financial data. It takes what a company reported to the SEC and returns one object: a cube indexed by concept, period, and vintage, in which every cell is a fact record (value, units, as-filed tag, accession, form, filing date) rather than a bare number. A financial statement is a slice of the cube, a line item is a time series through it, and a restatement is a second vintage of a cell that already existed.
Two problems make that harder than a pivot. Tags do not live forever: the us-gaap taxonomy deprecates, splits, and merges elements from one annual release to the next, so a single economic line item is spread across several tags over a filer’s history. And the same period is reported more than once, sometimes with a different value. toros resolves the first with a versioned concept map and keeps the second as an axis.
| Commitment | What it means |
|---|---|
| The fact table is the record; the cube is a view | One row per reported fact, with the three-dimensional view materialized on demand. Any cell traces back to exactly one row, or to the rows it was derived from |
| Vintage is an axis, never an overwrite | A value reported again in a later filing adds a coordinate. “Latest”, “as first reported”, and “as of a date” are selections the caller declares |
| Every number names the tag and the filing that produced it | Resolution to a canonical concept runs through a versioned map and an ordered conflict policy, both readable as data. Where the policy cannot rank two facts, toros raises instead of choosing |
The target API, from the repository README:
import edgar_sec as ed
from toros.cube import FactCube
edgar = ed.EdgarAPI()
facts = edgar.get_company_facts(ticker="AAPL")
cube = FactCube.from_company_facts(facts)
revenue = cube.series("Revenue", frequency="quarterly") # latest vintage of every period
revenue.lineage() # as-filed tag, accession and form behind each value
then = cube.as_of("2018-11-05") # only filings on file that day
The first alpha builds on the SEC’s companyfacts endpoint, which fixes its scope: facts tagged in a standard taxonomy and reported for the entity as a whole. Segment and other dimensional facts, company extension tags, and the decimals attribute are out of scope until toros can read instance documents directly.
Downstream
| Package | Maintainer | Relation to the stack |
|---|---|---|
cultivars-data |
Nikhil Sunder | Data layer of cultivars; installs toros and edgar-sec alongside fedfred |