Registry / data / finnhub-python

finnhub-python

JSON →
library2.4.27pypypi✓ verified 33d ago

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.

datahttp-networking
Install & Compatibility
Where this runs
tested against v2.4.28 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.608s · 21.3MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 2.2s · import 0.549s · 22MB
19MB installed
● package 19MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

from finnhub import Client

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.

import finnhub import os # Get API key from environment variable for security finnhub_api_key = os.environ.get('FINNHUB_API_KEY', 'YOUR_FREE_API_KEY_HERE') # Setup client finnhub_client = finnhub.Client(api_key=finnhub_api_key) # Fetch real-time stock quote for Apple Inc. quote = finnhub_client.quote('AAPL') print("AAPL Quote:", quote) # Fetch company profile for Apple Inc. company_profile = finnhub_client.company_profile2(symbol='AAPL') print("AAPL Company Profile:", company_profile)
Debug
Known footguns
breakingVersion 2.0.0 introduced significant changes, simplifying library usage and making return data more compatible with data analysis libraries like pandas. Code written for version 1.x.x will likely break.
gotchaNaming your Python script 'finnhub.py' will lead to a circular import error: 'AttributeError: partially initialized module 'finnhub' has no attribute 'Client''.
gotchaFree tier API keys often have strict rate limits (e.g., 60 calls/minute) and may not have access to all resources. Exceeding limits results in '429 Too Many Requests', and attempting to access premium data will return 'You don't have access to this resource.'.
gotchaWhen deploying applications using `finnhub-python` on certain hosting platforms (e.g., PythonAnywhere), you might encounter '403 Forbidden' errors due to proxy restrictions.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
37 hits · last 30 days
petalbot
10
dotbot
4
ahrefsbot
4
googlebot
2
perplexity-user
2
script
1
bingbot
1
bytedance
1
chatgpt-user
1
oai-searchbot
1
Resources