edgartools icon indicating copy to clipboard operation
edgartools copied to clipboard

AAPL Consolidated Balance Sheet - Cannot parse repeated line-item in both current & non-current assets

Open kalavrcom opened this issue 1 year ago • 4 comments

AAPL, like many other companies, displays their balance sheet asset section in two categories: Current and Non-current Assets.

I noticed in this specific case "Marketable Securities" shows up in both categories, but the XBRL is only parsing one of them (seems like the instance furthest down the page), and doesn't differentiate between the two in the report nor the dataframe.

This is an issue because it means a custom financial dashboard relying on Edgartools is unable to calculate a "Cash & Cash Equivalents + Short-Term Investments", which is what almost all existing financial dashboards (e.g. Google Finance, Koyfin, Interactive Brokers, Bing, etc.) show in a condensed format.

Code to generate this behaviour and corresponding outputs are shown below:

c = Company("AAPL")
f = c.get_filings(form="10-K", year=[2025, 2024, 2023, 2022])
Image
ff = XBRLS.from_filings(f)
bb = ff.statements.balance_sheet()
Image
bb.to_dataframe()
Image

You can see from the output above in dataframe row 17 that "Marketable Securities" only shows up one time as a current asset, but the numbers correspond to AAPL's 10-K balance sheet section showing the non-current marketable securities (wrong location), while not showing the current marketable securities (i.e. STI) figure at all.

Image

kalavrcom avatar Jun 09 '25 23:06 kalavrcom

I wasn't fully aware of the facts views before so I used the following code to see if there was an issue earlier in the XBRL pipeline, but the parser seems fine since the facts for MarketableSecurities (current & non-current) show the correct figures that match the 10-K excerpt above for AAPL's FY2024 10-K. I generally use Polars for my dataframes so that will be an additional dependency you will need to bring in to run the code below although one should be able to replicate by filtering/searching a Pandas dataframe also.

fx = pl.DataFrame(c.get_facts().to_pandas()) # create polars df from panadas df
fx.filter(pl.col('fact').str.contains('MarketableSecurities') & (pl.col('form') == '10-K') & (pl.col('fy') == 2024)) # filter rows based on three conditions

Output:

Image

kalavrcom avatar Jun 17 '25 20:06 kalavrcom

Found the issue in the standardization logic. I have added new mappings for Current Marketable Securities and Non Current Marketable Securities so that they would be distinct in the Balance Sheet view. Will include in a release over the next few days

dgunning avatar Jun 21 '25 13:06 dgunning

Fixed in Release 4.2.1

Image

dgunning avatar Jun 22 '25 11:06 dgunning

Thanks Dwight! This is working!

kalavrcom avatar Jun 26 '25 13:06 kalavrcom