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.
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
muslpy 3.10–3.920 runs
installs and imports cleanly · install 0.0s · import 0.608s · 21.3MB
glibcpy 3.10–3.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)
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.