edgartools icon indicating copy to clipboard operation
edgartools copied to clipboard

Question: Plans for Q4 support?

Open TristanJanicki opened this issue 1 year ago β€’ 16 comments

Are there currently any plans to support the automatic parsing of 10-K into Q4 data? AKA subtracting the sum of the previous 3 quarters values from the 10-K values for all the cumulative fields?

TristanJanicki avatar Jun 30 '25 19:06 TristanJanicki

There are no plans only possibilities 😊

Describe it a little more and I will prompt the AI

e.g. Do you want to compute based on a 10-K and the previous 3 10-Qs?

dgunning avatar Jul 01 '25 14:07 dgunning

Yes that's exactly what I was thinking. Currently writing some code to do this myself but figured it may be a useful feature to have in the library.

Should be as something like FY - (q1 + q2 + q3) for all items of periodType === instant right?

I have a "working" prototype but it seems to be getting P&L on the wrong for TSLA Q4 2024 on the cashflow statement

TristanJanicki avatar Jul 02 '25 18:07 TristanJanicki

Hey @TristanJanicki. I have also worked on adding Q4 calculations on my side. For the cash flow statement, note that numbers are usually measured over 3 months for Q1, 6 for Q2 and 9 for Q3. That might explain why you get wrong net income (top-line item on the cash flow statement).

gafzan avatar Jul 03 '25 07:07 gafzan

@gafzan thanks for the input, I did indeed find that to be the case last night when trying to code this up.

Unfortunately version 3.15.1 does not have an easy way to map the items in the financial statements to their respective durations.

If I remember correctly the older version I was on, 3.0.3 had the data more readily available and this is the version I'm running in prod.

However I had to upgrade from 3.0.3 to solve other data inconsistencies and v4 does not support my use case yet.

My method now is to match statement values (e.g. revenue of 80000) to fact values. This OFC has its flaws and I'll find out today how egregious they are. I think for most cases it works fine but I've already encountered at least one where it mapped to the wrong duration.

@dgunning if there is any possibility of adding a better mapping of durations to financial statement items in v3.15.1 I'd love to know.

Thanks again this repo is amazing

TristanJanicki avatar Jul 03 '25 16:07 TristanJanicki

Hi all,

I’ve also been prototyping on my side, and I think it’s critical to differentiate between cumulative and non-cumulative facts. For example, the formula FY – Q1 – Q2 – Q3 works for items like Revenues, but not for metrics such as Earnings Per Share, since the share count can change over time.

On my end, I’m experimenting with parsing 8-K and 8-K/A filings that include financial data in HTML tables. It’s a challenging route, but generally more reliable than inferring values from multiple filings.

@dgunning – are there any plans to support parsing of financial data from 8-K exhibits in HTML format? (see attached example).

One of the biggest hurdles here is the lack of consistency across companies in how they present financial statements in 8-Ks.

Image

99.1 Exhibit example

Thanks!

amcamc92 avatar Sep 12 '25 15:09 amcamc92

I also try to roll similar manual calculations for Q4 numbers for income statements and cashflow statements. I saw that @dgunning added TTM support recently as one of the period types, so hopefully this means that Q4 will be included/extracted/calculated as part of the core functionality soon.

kalavrcom avatar Sep 19 '25 12:09 kalavrcom

I'm also trying to grab Q4 data. However, the calculation should be... Q4 EPS = FY EPS - Nine Months Ended EPS

[Edit] Fixing my mistake in my post... Nine month data can be found in the Q3 10-Q report.

However, I'm not too sure how to extract it just yet. There doesn't seem to be a clean way w/ edgartools just yet unless I'm just ignorant.

[Edit 2] Reading helps. For those that want to get Nine Months Ended EPS data, here is an example.

filing = company.latest("10-Q")
xb = filing.xbrl()

# Facts from specific statements
income_facts = xb.query().by_statement_type("IncomeStatement")

# Complex query with multiple filters
complex_query = (xb.query()
                 .by_statement_type("IncomeStatement")
                 .by_concept("us-gaap:EarningsPerShareDiluted"))

query = complex_query.to_dataframe('label', 'numeric_value', 'period_start', 'period_end')
print (query)

Anyway, it would be nice to not have to do this manually but this should push folks in the right direction for now. :)

r4 avatar Nov 13 '25 22:11 r4

@r4 you should make sure to check the duration of the facts returned by that query because not every document returns 9months some have 6 and 3 or just 3 or just 9

TristanJanicki avatar Nov 14 '25 18:11 TristanJanicki

Thanks @TristanJanicki. I'm considering a few ways to do this. Since I'm already grabbing the other quarters, the easiest seems to determine where the 6 month gap is between quarterly reports. Should be easy when just comparing dates. That should tell me which is Q3. Then I can filter the dataframe example above on most recent 'period_end' and grab the max 'numeric_value' as Nine Months Ended EPS will always be greater than Q3 EPS.

I'll write up some code eventually but that's the general idea.

r4 avatar Nov 14 '25 21:11 r4

Just curious, what's your use case? I was building SEC data tools into an LLM

TristanJanicki avatar Nov 14 '25 21:11 TristanJanicki

Long term, I'm creating my own stock information/trading platform. Short term, I'd rather not pay others for publicly available information (SEC data).

Anyway, I'm after Yearly and Quarterly EPS and Revenue Growth for now. I plan to dump it into a FastAPI so I can look this up on demand per ticker.

r4 avatar Nov 14 '25 21:11 r4

I have been doing some Q4 calcuations for quarters and I like that - you can try to do it all via subtracting - you will need to see the preiod reporting - whether it';s three months ended, nine months, etc, and based on that, you can subtract the cash flow statemnet data from each other - it's possible.

MonopolisticInvestor avatar Nov 28 '25 07:11 MonopolisticInvestor

Summary

Thank you for this feature request and the great discussion! This is a valuable enhancement that aligns with EdgarTools' mission of making financial data elegantly accessible.

Current State

EdgarTools does not currently support automatic Q4 derivation. You currently need to:

  1. Fetch the 10-K (annual) and three 10-Qs manually
  2. Query XBRL facts for the appropriate durations (3-month, 9-month, 12-month)
  3. Calculate Q4 values by subtraction

Complexity

As this discussion reveals, Q4 derivation is more nuanced than simple subtraction:

Key Challenges:

  1. Duration mapping: 10-Qs contain both 3-month (quarterly) and cumulative (6-month, 9-month) facts
  2. Cumulative vs. instant: Income/Cash Flow are cumulative (subtract), Balance Sheet is instant (snapshot)
  3. Non-additive metrics: EPS, shares outstanding can't be derived by subtraction due to time-varying denominators
  4. Multi-filing coordination: Requires fetching and aligning 4 different filings

As @amcamc92 noted, an alternative approach is parsing 8-K exhibits with financial tables, which are often more reliable.

Priority & Timeline

Priority: MEDIUM (Priority Score: 11.25)

  • User Value: HIGH (7+ users requesting, building workarounds)
  • Urgency: MEDIUM (Enhancement, not blocking)
  • Feasibility: MODERATE (Complex multi-filing integration)
  • Effort: 4-5 days (L-size)

Target Release: v4.31.0 or v4.32.0 (Q1 2025)

This feature is being added to our roadmap for consideration. Given the complexity, we'll likely implement in phases:

  • Phase 1: Basic Q4 derivation for cumulative facts (Income Statement, Cash Flow)
  • Phase 2: Advanced handling (EPS, per-share metrics, validation)
  • Phase 3: 8-K exhibit parsing integration (if Issue #336 proceeds)

Design Questions for Community

Before implementing, we'd like feedback:

  1. API Design: How should users request Q4 data?

    # Option A: Explicit method
    xbrl.get_quarterly_statement(quarter='Q4', derive=True)
    
    # Option B: Automatic when Q4 period requested
    xbrl.statements.income.filter(period='Q4')  # Auto-derives if 10-K available
    
  2. Validation: Should we validate Q1+Q2+Q3+Q4 = FY and warn on mismatches?

  3. 8-K vs. 10-K: Should we prefer 8-K exhibits when available (more reliable but less consistent)?

  4. Error handling: What should happen when Q1/Q2/Q3 data is missing?

Next Steps

  1. βœ… Created Beads issue for tracking: edgartools-5dn
  2. βœ… Added to roadmap under "Under Consideration for v4.31.0+"
  3. πŸ“‹ Will create GitHub Discussion to gather community design input
  4. πŸ”„ Implementation timeline depends on community priorities and design consensus

Workaround (Current)

For now, the community-developed approach works well:

from edgar import Company

company = Company("TSLA")
annual_10k = company.latest("10-K")
q1_10q = company.get_filings(form="10-Q").filter(fiscal_period="Q1")[0]
q2_10q = company.get_filings(form="10-Q").filter(fiscal_period="Q2")[0]
q3_10q = company.get_filings(form="10-Q").filter(fiscal_period="Q3")[0]

# Query for 9-month cumulative data from Q3 10-Q
xb = q3_10q.xbrl()
nine_month_facts = (xb.query()
                   .by_statement_type("IncomeStatement")
                   .by_concept("us-gaap:EarningsPerShareDiluted")
                   .to_dataframe('label', 'numeric_value', 'period_start', 'period_end'))

# Filter for 9-month duration (check period_end - period_start)
# Q4 = Annual - Nine Months

Thank you for bringing this to our attention! We'll keep this issue updated as design and implementation progress.

dgunning avatar Nov 28 '25 13:11 dgunning

Update on Q4 support:

Q4 derivation is now implemented internally in the edgar.ttm module. The TTMCalculator._derive_q4_from_fy() method computes Q4 = FY βˆ’ YTD9M for additive concepts (revenue, net income, operating cash flow, etc.), handling the nuances discussed in this thread β€” cumulative vs discrete periods, non-additive metrics like EPS, and data quality checks.

This powers the TTM methods on Company:

from edgar import Company
c = Company("AAPL")
ttm = c.get_ttm_revenue()
# TTMMetric(value=435,617,000,000, periods=[Q2 2025, Q3 2025, Q4 2025, Q1 2026])
#                                                            ^^^^^^^ derived

What's not yet available: a complete Q4 financial statement as a rendered table. The derivation works concept-by-concept for TTM, but there's no way to get a full Q4 income statement or cash flow statement as a standalone Statement object β€” e.g., company.get_quarterly_financials(period="Q4") doesn't exist yet.

The building blocks are in place (_derive_q4_from_fy, _derive_q3_from_ytd9, _derive_q2_from_ytd6), so assembling them into a full derived quarterly statement is the remaining step.

dgunning avatar Mar 11 '26 09:03 dgunning

Hi @TristanJanicki β€” yes, this is fully supported! EdgarTools has a dedicated TTM (Trailing Twelve Months) package that automatically derives Q4 data from annual filings.

How it works

The edgar.ttm module derives Q4 values using two strategies:

  1. FY βˆ’ YTD_9M (preferred) β€” subtracts the 9-month cumulative value from the full-year value
  2. FY βˆ’ (Q1 + Q2 + Q3) (fallback) β€” when 9-month YTD data isn't available

It also handles special cases like EPS where share count volatility matters.

Usage

from edgar import Company

company = Company("AAPL")

# Get TTM revenue (automatically derives Q4 if needed)
ttm_revenue = company.get_ttm_revenue()
print(f"TTM Revenue: ${ttm_revenue.value / 1e9:.1f}B")

# The result tells you if Q4 was derived
print(f"Q4 was calculated: {ttm_revenue.has_calculated_q4}")

Direct TTM calculator access

from edgar.ttm import TTMCalculator

company = Company("MSFT")
facts = company.get_facts()

calculator = TTMCalculator(facts)
ttm = calculator.calculate("us-gaap:Revenues")

This has been available since v5.x. Closing as supported β€” feel free to reopen if you have follow-up questions!

dgunning avatar Mar 17 '26 21:03 dgunning

Closing β€” Q4 derivation is supported via the TTM module as described above. Reopen if you have follow-up questions.

dgunning avatar Mar 18 '26 23:03 dgunning