fix: annotate get_fundamentals_data return type as dict (#71)#72
Open
alexpipipi wants to merge 1 commit into
Open
fix: annotate get_fundamentals_data return type as dict (#71)#72alexpipipi wants to merge 1 commit into
alexpipipi wants to merge 1 commit into
Conversation
The /api/fundamentals/{ticker} endpoint returns a JSON object (keys like
General, Highlights, Valuation, ...), but get_fundamentals_data and
get_fundamentals_data_v1_1 were annotated `-> list`, producing misleading
type hints and type-checker errors for users.
Changed both annotations to `-> dict` and added a regression test asserting
the return annotation. Verified against the live API: AAPL.US fundamentals
returns a dict.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Closes #71 (reported by @AnthonyTedde).
/api/fundamentals/{ticker}returns a JSON object, butget_fundamentals_data(andget_fundamentals_data_v1_1, which has the same bug) were annotated-> list. This produces misleading IDE hints and type-checker errors.Change
get_fundamentals_dataandget_fundamentals_data_v1_1:-> list→-> dictdictVerification
get_fundamentals_data('AAPL.US')returnsdictwith keysGeneral, Highlights, Valuation, ...pytest: ✅ 66 passed🤖 Generated with Claude Code