finnhub-python is the official Python client for the Finnhub API, providing institutional-grade financial data. This includes real-time stock prices, global fundamentals, global ETF holdings, and alternative data. The library is actively maintained, with regular updates and a current version of 2.4.27, offering a comprehensive interface for financial market data access.
pip install finnhub-pythonVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to initialize the Finnhub client using an API key from an environment variable and fetch basic stock data such as a real-time quote and company profile for Apple Inc. Make sure to replace 'YOUR_FREE_API_KEY_HERE' with a valid Finnhub API key or set the FINNHUB_API_KEY environment variable.
Refer to the CHANGELOG on GitHub and update your code to align with the new API patterns for `finnhub.Client` and data access methods. Many return values are now more directly consumable by pandas DataFrames.
Rename your script file to anything other than `finnhub.py` (e.g., `my_finnhub_app.py`) to avoid conflicts with the installed library's module name.
Implement exponential backoff and retry logic for API calls to handle rate limits gracefully. For 'access denied' errors, check the Finnhub API documentation to confirm if the requested endpoint requires a premium subscription, or verify your API key and plan details.
Ensure that the Finnhub API domain (`api.finnhub.io`) is whitelisted on your hosting provider. Contact your hosting support if necessary to confirm and enable access.
No dependency data recorded yet.