Skip to content

fix(massive): read financial statements from the v1 statement endpoints - #61

Merged
stefan-jansen merged 2 commits into
mainfrom
fix/massive-financials-endpoint
Sep 23, 2026
Merged

stefan-jansen merged 2 commits into
mainfrom
fix/massive-financials-endpoint

Conversation

@stefan-jansen

Copy link
Copy Markdown
Contributor

Massive retired its old financials endpoint on 2026-06-22; it returns HTTP 404. fetch_financials() now reads /stocks/financials/v1/income-statements, balance-sheets and cash-flow-statements, follows next_url up to limit, and supports TTM for income and cash flow. filed_at is Massive's filing_date (latest filing that included the period) and is documented as not point-in-time.

fetch_company_metrics() now dates its rows from the ratios row's date field; it read end_date, which the live endpoint does not return, so as_of was always null.

Verified live against Apple's FY2024 10-K: revenue 391,035, net income 93,736, total assets 364,980, operating cash flow 118,254 (USD millions), all exact. 40 quarterly periods paginate; TTM returns distinct trailing windows.

Local gates: ruff, ruff format, ty, 3654 offline tests (also with ResourceWarning as error), mkdocs build --strict, 10 live Massive integration tests.

🤖 Generated with Claude Code

https://claude.ai/code/session_01F6TR4nQDjiPtanA2n4F3Gw

Copilot AI lite review requested due to automatic review settings September 23, 2026 20:16

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

stefan-jansen added a commit that referenced this pull request Sep 23, 2026
…#63)

The offline network guard patches Python's socket module, but yfinance
sends through curl_cffi, whose libcurl opens sockets in C. Three offline
Yahoo tests mocked yf.download only; an empty download then retries
through yf.Ticker(...).history, which reached Yahoo live. CI on PR #61
failed on Windows with YFRateLimitError from one of them.

The guard now rejects curl_cffi Session and AsyncSession requests, with
probe tests for both, and the three tests mock the Ticker retry.


Claude-Session: https://claude.ai/code/session_01F6TR4nQDjiPtanA2n4F3Gw

Co-authored-by: Stefan Jansen <stefan@ml4trading.io>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Stefan Jansen and others added 2 commits September 23, 2026 16:49
fetch_financials() called /stocks/financials/v1/financials, which Massive
retired on 2026-06-22; every call failed with HTTP 404. It now reads
income-statements, balance-sheets and cash-flow-statements, parses their
flat record shape, sorts most recent period first and follows next_url up
to limit. TTM is supported for income and cash flow. filed_at is Massive's
filing_date, the most recent filing that included the period, and is
documented as not point-in-time.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01F6TR4nQDjiPtanA2n4F3Gw
A live call to /stocks/financials/v1/ratios returns flat fields dated by
'date'; the provider read 'end_date', so every metric came back with
as_of null. The unit test used an invented nested shape with end_date and
could not see it. The test now uses the live row shape, and a live test
asserts as_of is populated. Live financial tests move above the
__main__ block.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01F6TR4nQDjiPtanA2n4F3Gw
@stefan-jansen
stefan-jansen force-pushed the fix/massive-financials-endpoint branch from fc3e7a9 to 87ca01f Compare September 23, 2026 20:49
@stefan-jansen
stefan-jansen merged commit 038a24a into main Sep 23, 2026
26 checks passed
@stefan-jansen
stefan-jansen deleted the fix/massive-financials-endpoint branch September 23, 2026 21:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants