Add opt-in reconstruction of total liabilities from XBRL balance sheets
Feature Category
- [x] New API functionality
- [ ] Performance improvement
- [ ] Developer experience improvement
- [ ] Documentation enhancement
- [ ] Tool/utility addition
Problem Statement
Financials.get_total_liabilities() returns None when a consolidated balance sheet has no standalone total liabilities line. Some filings report a complete set of liability components that can be summed and independently checked against reported assets and equity. Users who need this value currently have to reconstruct it themselves.
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
Add an opt-in method that reconstructs a missing total from the primary XBRL balance sheet. Use the filing's presentation and calculation relationships to select a complete set of non-overlapping liability components. Check the sum against reported assets less all equity presented outside liabilities for the same period and currency.
Return the derived amount with its reporting date, currency, filing accession, and the original line items used. Leave the result unavailable when a component is missing or the treatment of noncontrolling or temporary equity cannot be resolved. Preserve the current behavior of get_total_liabilities().
Describe alternatives you've considered
Subtracting equity from assets alone is simpler, but the result depends on identifying the complete equity scope. Summing the reported liability components first gives us a separate calculation to check against the balance sheet. Making this a separate method also preserves the distinction between filed and derived values for existing callers.
Use Case Example
# financials is a Financials instance for Amazon's Q2 2026 filing.
assert financials.get_total_liabilities() is None
# Proposed API
result = financials.derive_total_liabilities()
assert result.value == 544_069_000_000
Implementation Considerations
Complexity Level:
- [ ] Simple (minor API addition)
- [x] Moderate (new functionality with existing patterns)
- [ ] Complex (significant architectural changes)
Backwards Compatibility:
- [x] This feature maintains backwards compatibility
- [ ] This feature might break existing code (please explain below)
- [ ] Unsure about compatibility impact
Regression tests would cover the two filings below, a filing with a directly reported total, and a case where missing or overlapping components prevent reconstruction.
Additional Context
- Amazon, quarter ended June 30, 2026. Current liabilities, long-term lease liabilities, long-term debt, and other long-term liabilities sum to $544,069 million. Reported assets of $1,095,689 million less reported equity of $551,620 million give the same result.
- NIKE, year ended May 31, 2026. The liability components sum to $23,545 million, matching the reconciliation documented in #1279.
Related Issues/Features:
Related to #1279 and the follow-up edgartools-y4yp.5 mentioned in the existing regression test. Is there a preferred issue or API for this follow-up? I'd be happy to work on a PR once we agree on the scope.
Thanks, this is the follow-up I left open after #1279, and your scope is what I'd want. Please go ahead with a PR.
A separate derive_total_liabilities() is the right call. It keeps get_total_liabilities() returning only filed values, and it settles the question I couldn't answer then: how a caller tells a derived total from a filed one.
I ran some numbers on SEC's CY2025 year-end frames to see how much the cross-check matters:
- 650 of 6,220 filers that report
Assetsreport noLiabilitiestotal. - For 199 of them, assets minus
StockholdersEquitywould be wrong, because parent equity leaves the noncontrolling interest inside "liabilities". - Even assets minus total equity (with NCI) minus temporary equity misses the filed
Liabilitiesfor 302 of the 5,413 filers that do report one.
So the identity on its own isn't safe, and summing the components first and refusing when the two calculations disagree is what makes this work.
A few things I'd like in the PR:
- Besides AMZN and NKE, add a filer with a noncontrolling interest, and ideally one with redeemable NCI shown as temporary equity. Disney covers both. It files no
Liabilitiestotal, and its FY2023 balance sheet (2023-09-30) has about $4.7B of noncontrolling interest in equity plus $9.1B of redeemable NCI in temporary equity. The redeemable NCI is zero a year later, so FY2024 tests the same filer without it. Reconcile its total by hand against the filed balance sheet and give the accession in the test. - Add a case that has to refuse, either a missing or overlapping component or ambiguous NCI treatment. Assert the specific reason it gives, not just that the value is unavailable.
- Leave
debt_to_assetsand the other ratios on filed values only. If we want ratios to use derived totals, that's a separate decision. - Keep it in
Financials. I don't want EntityFacts changed in this PR. - Regression tests go in
tests/issues/regression/test_issue_1878.pywith the issue URL in the module docstring, and the changelog entry goes in achangelog.d/1878.added.mdfragment (seechangelog.d/README.md), not CHANGELOG.md.
The result object you describe (value, period, currency, accession, and the line items used) sounds right. I'd also include which of the two calculations each number came from, so someone can audit a derived total without re-running it.