fix(massive): read financial statements from the v1 statement endpoints - #61
Merged
Merged
Conversation
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>
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
force-pushed
the
fix/massive-financials-endpoint
branch
from
September 23, 2026 20:49
fc3e7a9 to
87ca01f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Massive retired its old financials endpoint on 2026-06-22; it returns HTTP 404.
fetch_financials()now reads/stocks/financials/v1/income-statements,balance-sheetsandcash-flow-statements, followsnext_urlup tolimit, and supports TTM for income and cash flow.filed_atis Massive'sfiling_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'sdatefield; it readend_date, which the live endpoint does not return, soas_ofwas 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