Home / Libraries / ML4T Data / Docs
ML4T Data
ML4T Data Documentation
Unified market data acquisition from 19+ providers
Skip to content

Finnhub Provider

Provider: FinnhubProvider Website: finnhub.io API Key: Required Free Tier: 60 requests/minute


Overview

Finnhub provides multi-asset market data with strong fundamentals and company metrics coverage.

Best For: Company metrics, analyst estimates, real-time quotes

Pricing: | Tier | Price | Features | |------|-------|----------| | Free | $0/month | 60 requests/minute, US quotes and selected company data | | All-in-One | See current pricing | Historical OHLC and additional datasets |


Quick Start

import os
os.environ["FINNHUB_API_KEY"] = "your_key_here"

from ml4t.data.providers import FinnhubProvider

with FinnhubProvider() as provider:
    quote = provider.fetch_quote("AAPL")

fetch_quote() uses Finnhub's free US quote endpoint. Historical candles use a premium endpoint:

with FinnhubProvider() as provider:
    history = provider.fetch_ohlcv(
        "AAPL",
        "2024-01-01",
        "2024-12-01",
        frequency="daily",
    )

Do not assume that a free key can call fetch_ohlcv(). Finnhub's current pricing table lists US OHLC history under its paid plan.


API Key Setup

# Environment variable
export FINNHUB_API_KEY=your_api_key_here

Get your API key at finnhub.io/register.


Implemented Capabilities

Method Account requirement
fetch_quote() Free key
fetch_company_metrics() Depends on requested metric and account coverage
fetch_financials() Depends on requested company and account coverage
fetch_ohlcv() Paid OHLC access

See Also