From c78fa865004b17af611579e1d6b56c09020e104b Mon Sep 17 00:00:00 2001 From: "David Arias, CFA" Date: Wed, 23 Sep 2026 21:28:52 +0200 Subject: [PATCH] fix(sec_edgar): find capital expenditure reported as productive assets (#1370) - Capital Expenditure also reads PaymentsToAcquireProductiveAssets, after the property and equipment tag --- CHANGELOG.md | 6 ++++++ tests/test_sec_edgar.py | 11 +++++++++++ tradingagents/dataflows/sec_edgar.py | 3 ++- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6bd57ecf6..c59f02fcc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html). Breaking changes within the 0.x line are called out explicitly. +## [Unreleased] + +### Fixed + +- SEC EDGAR cash flow statements find capital expenditure for filers that moved it to purchases of productive assets (NVIDIA since fiscal 2022, Amazon since 2016), whose recent periods read as empty. + ## [0.5.0] — 2026-09-18 Point-in-time integrity across every dated path, decisions that are recorded as diff --git a/tests/test_sec_edgar.py b/tests/test_sec_edgar.py index 79f205357..a6c55333c 100644 --- a/tests/test_sec_edgar.py +++ b/tests/test_sec_edgar.py @@ -237,3 +237,14 @@ def test_an_uninstalled_checkout_still_identifies_itself(monkeypatch): monkeypatch.setattr(sec_edgar.metadata, "version", _missing) assert "@" in sec_edgar._user_agent() + + +@pytest.mark.unit +def test_capital_expenditure_is_found_under_either_tag_filers_use(monkeypatch): + """NVIDIA and Amazon report purchases of productive assets, not of property and equipment.""" + facts = {"facts": {"us-gaap": {"PaymentsToAcquireProductiveAssets": {"units": {"USD": [ + _fact("2024-12-31", 70_000_000, "2025-02-10", start="2024-01-01")]}}}}} + monkeypatch.setattr(sec_edgar, "_fetch_json", + lambda url: TICKER_MAP if "company_tickers" in url else facts) + out = sec_edgar.get_cashflow("AAPL", "annual", "2025-03-01") + assert [r for r in out.splitlines() if r.startswith("Capital Expenditure")] == ["Capital Expenditure,70"] diff --git a/tradingagents/dataflows/sec_edgar.py b/tradingagents/dataflows/sec_edgar.py index 2999f815d..7a4eca19e 100644 --- a/tradingagents/dataflows/sec_edgar.py +++ b/tradingagents/dataflows/sec_edgar.py @@ -66,7 +66,8 @@ _STATEMENTS: dict[str, list[tuple[str, tuple[str, ...]]]] = { "NetCashProvidedByUsedInOperatingActivitiesContinuingOperations")), ("Investing Cash Flow", ("NetCashProvidedByUsedInInvestingActivities",)), ("Financing Cash Flow", ("NetCashProvidedByUsedInFinancingActivities",)), - ("Capital Expenditure", ("PaymentsToAcquirePropertyPlantAndEquipment",)), + ("Capital Expenditure", ("PaymentsToAcquirePropertyPlantAndEquipment", + "PaymentsToAcquireProductiveAssets")), ], }