Use 8-K Parsing to Fill the Q4 Data Gap Before the 10-Q
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. Yes. Currently, EdgarTools excels at extracting structured XBRL data from 10-K and 10-Q filings. However, a significant amount of critical and timely financial data is first released in 8-K filings, often weeks before the formal 10-Q is available. This data is typically presented in HTML tables within the filing's exhibits (like EX-99.1).
Without a robust way to parse these HTML tables, users miss out on the most recent earnings data, creating a critical time gap in their analysis. Manually parsing this unstructured data is tedious, error-prone, and requires a new custom script for almost every company due to inconsistent formatting. This limits the ability to perform large-scale, timely financial analysis directly from SEC filings.
Who would benefit from this feature?
- [ ] Beginner Python users working with SEC filings
- [X] Financial analysts and researchers
- [X] Advanced developers building financial applications
- [X] Data scientists working with financial datasets
Proposed Solution
Describe the solution you'd like I propose the addition of a powerful, heuristic-based HTML table parser as a new tool within the edgar library. This tool would be specifically designed to identify and extract structured financial data from the unstructured HTML tables found in 8-K exhibits.
The core of this feature would be a high-level function, perhaps on the Filing object, that automates a multi-stage parsing pipeline:
- Table Extraction: Extract all
elements from the filing's HTML content.
- Heuristic Filtering: Intelligently identify which tables are likely to contain financial statements (e.g., based on size, keywords, or structure), filtering out irrelevant layout tables.
- Header Normalization: Merge complex, multi-row headers into a single, clean header row. This step should also parse and standardize date columns (e.g., converting "Q1 2024", "Three Months Ended March 31, 2024" into a canonical format like 2024-03-31|3).
- Scale Detection: Scan the document's text for footnotes like (in thousands) or (in millions, except per share) to determine the correct multipliers for financial values.
- Row Categorization & Scaling: Distinguish between rows containing monetary amounts, share counts, and per-share values to apply the correct scale multipliers. Per-share values should never be scaled.
- Robust Numeric Parsing: Clean and convert values to numbers, correctly handling financial notation like (1,234.56) for negative numbers, currency symbols, and commas.
- Financial Concept Detection: Use regex and keyword matching to identify and tag rows with standard financial concepts (e.g., 'Revenues', 'EarningsPerShareDiluted').
- Standardized Output: Convert the cleaned table into a standardized DataFrame format that mirrors the structure of existing XBRL facts (with columns like concept, numeric_value, period_start, period_end, data_quality, confidence_score).
This approach would transform unstructured HTML tables into clean, analysis-ready data that can be seamlessly integrated with the existing XBRL data pipeline.
Describe alternatives you've considered
- Ignoring 8-K filings: This is the current state and results in a significant data timeliness gap.
- Manual Parsing: This is what users are forced to do now. It's not scalable, is extremely brittle, and requires constant maintenance as companies change their reporting formats.
- Using Third-Party Data Providers: This is expensive and defeats the purpose of using a direct-from-the-SEC tool like EdgarTools.
Use Case Example
How would you use this feature?
# Provide a code example of how you envision using this feature from edgar import Company company = Company("AAPL") # Get the latest 8-K filing (typically an earnings release) latest_8k = company.get_filings(form='8-K')[0] # The new feature: extract structured financial facts from HTML exhibits # It returns a DataFrame in the same standardized format as XBRL facts. facts_from_8k = latest_8k.html.extract_financials() if facts_from_8k is not None and not facts_from_8k.empty: # Now you can work with the most timely data latest_revenue = facts_from_8k[facts_from_8k['concept'] == 'Revenues'] print("Latest Quarterly Revenue from 8-K:") print(latest_revenue[['period_end', 'numeric_value']].head())Implementation Considerations
Complexity Level:
- [ ] Simple (minor API addition)
- [ ] Moderate (new functionality with existing patterns)
- [X] Complex (significant architectural changes)
Reasoning: This is complex because it requires building a robust, heuristic-based parsing engine that can handle the wide variety of inconsistent HTML formats used by different companies. It's less about a single algorithm and more about an entire data cleaning pipeline.
Backwards Compatibility:
- [X] This feature maintains backwards compatibility
- [ ] This feature might break existing code (please explain below)
- [ ] Unsure about compatibility impact
Additional Context
The primary value of this feature is timeliness. Companies often release their quarterly results in an 8-K filing 2-4 weeks before they submit the full, XBRL-tagged 10-Q. For analysts and algorithms that rely on the most current data, this time lag is a major disadvantage. By providing a reliable way to parse 8-K exhibits, EdgarTools would bridge this gap and become an even more indispensable tool for financial analysis.
This feature is a natural complement to the existing XBRL functionality, creating a more complete and powerful data extraction ecosystem.
Related Issues/Features:
This is directly related to Issue #335 .
Feature requests are evaluated based on EdgarTools' core principles: Simple yet powerful, accurate financials, beginner-friendly, and joyful UX.
Thank you for this detailed feature request! This is an interesting and ambitious proposal. We're currently researching the technical feasibility and strategic fit with EdgarTools' mission. Will respond with a comprehensive analysis shortly.
Thanks, @dgunning. Looking forward to it.
this feature will be super useful.
Thank you @dgunning for the implementation in v5.12.0.
I'll close this one!