dgunning / edgartools

Navigate SEC Edgar data in Python
MIT License
522 stars 104 forks source link

XBRL object does not contain some breakdown data shown in SEC filings #120

Closed unparadise closed 2 weeks ago

unparadise commented 1 month ago

Thank you for the great tool! I have been seeing the incomplete data issue in the non-xbrl approach and have reported it in the forum before. Now I am trying the xbrl approach hoping that it will produce a complete set of data that match those on sec.gov website. But I ran into the same issue which I will explain below.

Using aapl's most recent (2023) income statement as an example.

Below is my code to retrieve the income statement data using XBRL() approach.

from edgar import *

set_identity("test test@contoso.com")

filings = Company("AAPL").get_filings(form="10-K").latest(1)
filings_xbrl = filings.xbrl()

# Object returned from the get_statement()function is of type <class 'edgar.xbrl.xbrldata.Statement'>
income_statement_df = filings_xbrl.get_statement('CONSOLIDATEDSTATEMENTSOFOPERATIONS').get_dataframe()
print(income_statement_df)

The output from running the code contains the total net sales and cost of sales but not the breakdowns (Products and Services) as shown on the SEC.gov website.

                                  2023
Net sales                      383,285
Cost of sales                 -214,137

Below is a screenshot of the document on sec.gov. Screenshot_5-10-2024_174441_www sec gov

Is there plan to fix this issue?

dgunning commented 1 month ago

I will look into this sometime this week and estimate what it would take to implement this.

The proximate cause is that the AAPL product and services breakdown is reported using AAPL's custom namespace.

Will update after investigating

dgunning commented 1 month ago

Correction, the apple product and services are in the SEC reporting taxonomy namespace, so it should be available. Will keep looking

dgunning commented 1 month ago

The breakdowns are available in the latest releases 3.0.x (latest is 3.0.3).

However while reporting this I noticed another issue where the breakdown appears twice. Sorry about that - it's very complex code. Will take a look and fix this week

Breakdown
unparadise commented 2 weeks ago

dgunning, thank you very much for keep improving the code! Will upgrade the library and test.