SEC EDGAR data source for Trail: normalized 10-K financial statements via edgartools
Project description
trail-edgar
SEC EDGAR (10-K/10-Q) data source for Trail, via edgartools.
Provides
-
Statements (annual 10-K + quarterly 10-Q):
income.*,balance.*,cash.*- revenue, cogs, operating/net income, interest, tax, EPS, balance-sheet lines (assets, liabilities, equity, receivables, inventory, payables, debt, goodwill, ...), and cash-flow lines (CFO, CFI, CFF, capex, dividends, ...). -
Meta:
meta.sector,meta.exchange,meta.is_active,meta.country(normalized to ISO3). Entity dimension is the defaultentity(no bridge field). -
Derived fields, computed when no single us-gaap tag is reliable:
Field Derivation income.gross_profitGrossProfittag, elserevenue - cogsincome.ebitdaoperating_income + depreciation_amortization(no us-gaap tag)cash.free_cash_flowcfo - abs(capex)balance.total_debtlong_term_debt + short_term_debt -
Not provided (declared unavailable, not fabricated):
price.adj_close,price.dividends,meta.market_cap- SEC filings carry no market price.income.weighted_average_shares_dilutedis provided, so a market cap can still be computed downstream once a price source is joined in.
Configure
# trail.yaml
sources:
sec:
driver: edgar
options:
identity: "Your Name your.email@example.com" # or set the EDGAR_IDENTITY env var
tickers: [AAPL, MSFT, NVDA] # or use `universe:` instead
years: [2017, 2024]
cache_dir: ".edgar-cache"
precedence:
default: [sec]
panel:
strict: true
Then:
trail catalog sec # coverage: fields this source provides
trail run model.trail --model m --config trail.yaml
Options
| Option | Type | Default | Notes |
|---|---|---|---|
identity |
str |
- (required) | SEC fair-access identity, e.g. "Your Name your.email@example.com". Falls back to the EDGAR_IDENTITY env var. Neither set -> E-EDGAR-IDENTITY. |
tickers |
list[str] |
[] |
Explicit fetch universe. Takes precedence over universe; a caller-supplied entity list (e.g. a model's own universe) overrides both at load time. |
universe |
str |
None |
Named universe, resolved via edgartools' curated helpers, used only when tickers is empty: faang, tech_giants, dow. Unknown name -> E-EDGAR-UNIVERSE. There is no live index-membership feed, so broader index coverage (e.g. the full S&P 500) needs an explicit tickers list. |
years |
[lo, hi] |
None |
Inclusive fiscal-year bound to fetch. A model's own periods(...) range, when present, overrides this. |
periods |
int |
8 |
Fallback count of most-recent annual periods to fetch when neither years nor a model periods(...) range narrows the fetch. |
cache_dir |
str |
None |
Sets EDGAR_LOCAL_DATA_DIR (via setdefault, so the first EdgarSource constructed in a process wins) for edgartools' local filing cache. |
pit |
str |
unset | pit: naive disables point-in-time for this source only - a per-source override of the global panel.pit setting, read by Trail's runtime rather than by EdgarSource itself. |
For quarterly loads (frequency: quarterly), whichever annual period count is resolved above is
fetched in quarters instead (4x).
SEC fair access requires identity on every request; edgartools throttles to the SEC rate limit
and caches filings locally (under cache_dir when set).
Point-in-time
Statement fields (income.*, balance.*, cash.*) carry a __date:filing_date coordinate: the
earliest 10-K/10-Q filing date for each fiscal period, read from company.facts (already fetched
by the statement calls, so this costs no extra network round-trip). A fiscal period can appear in
more than one filing - a later 10-K's comparative column repeats a prior period under a later
filing date - so the earliest date is kept, recovering the period's original disclosure rather
than a restatement/comparative date.
meta.* fields (sector, exchange, country, is_active) are naive - current attributes broadcast
onto every period, not filing-dated.
options.pit: naive (or a global panel.pit: naive) disables the coordinate for this source;
every field then places at its period-end instead.
Notes
- Non-December fiscal years are approximated: period
timevalues snap to calendar quarter/year ends (Mar 31 / Jun 30 / Sep 30 / Dec 31), not a company's actual fiscal period end - canonical fiscal-calendar alignment is a later phase. - The earliest-filing heuristic depends on the raw
FinancialFact.fiscal_year/fiscal_periodmatching the period keys parsed from the statement frames' column labels - two independent reads of the same edgartools data - so a period only gets a filing date when both agree on the key; otherwise alignment falls back to period-end. - Structurally absent lines (e.g. inventory for a bank) come through as null rather than errors.
capexanddividends_paidare reported as positive outflow magnitudes in some filings; both are normalized withabs().meta.is_activeis a constantTruefor any company the source can fetch - there is no delisted/inactive detection; it exists for schema parity with other sources.- Concept resolution takes the first us-gaap tag present from an ordered priority list per field
(see
trail_edgar/mapping.py), verified against live filings; a niche tag not on the list surfaces as null.
License
MIT.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file trail_edgar-0.5.0.tar.gz.
File metadata
- Download URL: trail_edgar-0.5.0.tar.gz
- Upload date:
- Size: 97.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9dc1573d8c1996e0755c1aeb785be6c146ad6add294ebe5dffbc0bcc732e9997
|
|
| MD5 |
4096f54b6f4464a5c7e455cc2edbe27d
|
|
| BLAKE2b-256 |
4f5d66e4afdae5cc2a8f23a3b8ad6f776930b955f3493f54a78140a47854ca3b
|
Provenance
The following attestation bundles were made for trail_edgar-0.5.0.tar.gz:
Publisher:
release.yml on trail-language/trail-edgar
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
trail_edgar-0.5.0.tar.gz -
Subject digest:
9dc1573d8c1996e0755c1aeb785be6c146ad6add294ebe5dffbc0bcc732e9997 - Sigstore transparency entry: 2214733476
- Sigstore integration time:
-
Permalink:
trail-language/trail-edgar@bdd58f3585ed66b514378d79e6b929ee03fe5469 -
Branch / Tag:
refs/tags/v0.5.0 - Owner: https://github.com/trail-language
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@bdd58f3585ed66b514378d79e6b929ee03fe5469 -
Trigger Event:
push
-
Statement type:
File details
Details for the file trail_edgar-0.5.0-py3-none-any.whl.
File metadata
- Download URL: trail_edgar-0.5.0-py3-none-any.whl
- Upload date:
- Size: 17.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3444f3833ccb57be8d70bbeb38975b2f57b868a1356083dc30a92e667c2129a7
|
|
| MD5 |
4a5a8b6036ac9865bf6ff72fcc10317c
|
|
| BLAKE2b-256 |
dec078d5f051d4860625dd638f3769d0782e9e045d3cca68c42202e739920748
|
Provenance
The following attestation bundles were made for trail_edgar-0.5.0-py3-none-any.whl:
Publisher:
release.yml on trail-language/trail-edgar
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
trail_edgar-0.5.0-py3-none-any.whl -
Subject digest:
3444f3833ccb57be8d70bbeb38975b2f57b868a1356083dc30a92e667c2129a7 - Sigstore transparency entry: 2214733563
- Sigstore integration time:
-
Permalink:
trail-language/trail-edgar@bdd58f3585ed66b514378d79e6b929ee03fe5469 -
Branch / Tag:
refs/tags/v0.5.0 - Owner: https://github.com/trail-language
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@bdd58f3585ed66b514378d79e6b929ee03fe5469 -
Trigger Event:
push
-
Statement type: