Implement new fundamentals API #928
Open
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.
🎉 New Fundamentals API Implementation!
Summary
Successfully implemented the new Polygon Fundamentals API to replace the deprecated single
/vX/reference/financials
endpoint with 6 specialized endpoints.✅ What Was Implemented
1. New Model Classes (
polygon/rest/models/fundamentals.py
)BalanceSheet
- Balance sheet data modelCashFlowStatement
- Cash flow statement data modelIncomeStatement
- Income statement data modelFinancialRatios
- Financial ratios data modelShortInterest
- Short interest data modelShortVolume
- Short volume data model2. New Client (
polygon/rest/fundamentals.py
)FundamentalsClient
with 6 specialized methods:list_balance_sheets()
→/stocks/financials/v1/balance-sheets
list_cash_flow_statements()
→/stocks/financials/v1/cash-flow-statements
list_income_statements()
→/stocks/financials/v1/income-statements
list_financial_ratios()
→/stocks/financials/v1/ratios
list_short_interest()
→/stocks/v1/short-interest
list_short_volume()
→/stocks/v1/short-volume
3. Integration (
polygon/rest/__init__.py
)FundamentalsClient
to mainRESTClient
client.fundamentals
client.vx
(deprecated)4. Deprecation Handling (
polygon/rest/vX.py
)VXClient
5. Documentation & Examples
FUNDAMENTALS_MIGRATION.md
- Complete migration guideexamples/rest/fundamentals_example.py
- Working examplestest_fundamentals.py
- Comprehensive test suite🚀 Usage
New API (Recommended)
Old API (Deprecated)
🔍 Key Benefits
✅ Quality Assurance
📁 Files Modified/Created
New Files
polygon/rest/fundamentals.py
- New fundamentals clientpolygon/rest/models/fundamentals.py
- New data modelsexamples/rest/fundamentals_example.py
- Usage examplesFUNDAMENTALS_MIGRATION.md
- Migration guidetest_fundamentals.py
- Test suiteModified Files
polygon/rest/__init__.py
- Added FundamentalsClient integrationpolygon/rest/models/__init__.py
- Added fundamentals modelspolygon/rest/vX.py
- Added deprecation warnings🎯 Next Steps
🌟 Result
The Polygon Python client now supports the modern Fundamentals API with:
Migration is now seamless for all users! 🚀