edgartools icon indicating copy to clipboard operation
edgartools copied to clipboard

Add support for company tickers to CIK mapping - local cache for outage support

Open MonopolisticInvestor opened this issue 8 months ago • 1 comments

Feature Category

  • [X] New API functionality
  • [ ] Performance improvement
  • [ ] Developer experience improvement
  • [ ] Documentation enhancement
  • [ ] Tool/utility addition

Problem Statement

Is your feature request related to a problem? Please describe. When there's an ourtage of the SEC due to some mnaintenance work, what happens usually i sthat the main website is searhceable, butthe mapping of comapneis to CIK numbers is not possible, due to the tickers.txt file not being avaible. Iw as actully surpised that the edgartools library has an ability dow download huge amount sof filings, but not a single tickers.txt downlaod option, to enable the company lookup by tikcer symbols in cas eof an outage.

Who would benefit from this feature?

  • [ ] Beginner Python users working with SEC filings
  • [ ] Financial analysts and researchers
  • [X] Advanced developers building financial applications
  • [ ] Data scientists working with financial datasets

Proposed Solution

Describe the solution you'd like a function: from edgar import set_identity, use_local_storage, download_ticker_data

download_ticker_data() - would downlaod a ticker.txt, and in soem way map the numebrs to CIKs, so taht teh huiltin Company() function woudl ayutomatcially use this cahce, that wpoudl be stroed soemhhere, eg. EDGAR or maybe make the user show the apth to that file.

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

Use Case Example

How would you use this feature?

# Provide a code example of how you envision using this feature

import os
import pathlib
from edgar import set_identity, use_local_storage, download_ticker_data
script_dir = pathlib.Path(__file__).parent.absolute()
cache_dir = script_dir / 'edgar_cache'
os.makedirs(cache_dir, exist_ok=True)

set_identity("example user")
use_local_storage(str(cache_dir))

print(f"--- [SEC CACHE] Refreshing Ticker-to-CIK mapping ---")
try:
    download_ticker_data()
    print("--- [SEC CACHE] Success. Ticker mapping is now local. ---")
except Exception as e:
    print(f"--- [SEC CACHE] Failed to download: {e} ---")

# ... example usage of proposed feature

Implementation Considerations

Complexity Level:

  • [ ] Simple (minor API addition)
  • [X] Moderate (new functionality with existing patterns)
  • [ ] Complex (significant architectural changes)

Backwards Compatibility:

  • [ ] This feature maintains backwards compatibility
  • [ ] This feature might break existing code (please explain below)
  • [X] Unsure about compatibility impact

Additional Context

Add any other context, screenshots, or examples about the feature request here.

Related Issues/Features:


Feature requests are evaluated based on EdgarTools' core principles: Simple yet powerful, accurate financials, beginner-friendly, and joyful UX.

MonopolisticInvestor avatar Mar 16 '26 17:03 MonopolisticInvestor

Hi @MonopolisticInvestor — great news, this is already supported! EdgarTools has multiple layers of offline ticker-to-CIK resolution built in.

Already works with zero setup

EdgarTools ships a bundled company_tickers.parquet file (~10,600 exchange-listed tickers) inside the package. When you call Company("AAPL"), the library loads this bundled file first — no network call required. So for established tickers, Company() lookups already survive SEC outages with no configuration.

For full offline coverage (including recent IPOs)

If you need the absolute latest ticker data cached locally:

from edgar import set_identity, download_edgar_data, use_local_storage

set_identity("Your Name [email protected]")

# One-time download of reference data (ticker mappings)
download_edgar_data(submissions=False, facts=False, reference=True)

# Enable local storage — now all lookups use the cached data
use_local_storage()

# Works fully offline
company = Company("AAPL")

The download_edgar_data(reference=True) call downloads all four SEC ticker JSON files to your local data directory. After that, use_local_storage() tells EdgarTools to prefer local data over network calls.

Resolution waterfall

When resolving a ticker, EdgarTools tries these sources in order:

  1. Bundled parquet (always available, no network)
  2. Local downloaded data (if use_local_storage() is enabled)
  3. Live SEC API (fallback for brand-new tickers not in bundled data)

So your use case is covered — the library is resilient to SEC outages by default for common tickers, and download_edgar_data(reference=True) + use_local_storage() gives you full offline coverage.

Closing as already implemented. Let us know if you run into any issues!

dgunning avatar Mar 16 '26 23:03 dgunning