Skip to main content

pipeline status coverage report PyPI version Python 3.11+ License: GPL v3

FinQuotes

FinQuotes is a small Python library to be used as a facade to fetch financial data from public sources through a single, consistent interface. It adapts various interface to a consistent one described below allowing one to quickly switch between service.

It supports close snapshots, historical OHLCV, distributions (dividends), splits, and security metadata across multiple providers (Yahoo Finance, yfinance, yahooquery, Stooq, Morningstar, Quandl, Twelve Data).

  • Python: 3.11–3.15
  • License: GPL-3.0

Features

  • Unified API and CLI for multiple data sources
  • Normalized data models: Price, Distribution, Split, Security
  • Deterministic CSV output for easy piping and testing
  • Robust network options: retry, timeout, max retries
  • Pluggable sources via lightweight “feed” builders

Install

python -m pip install finquotes

Quick start (Python)

Use typed builder helpers for clarity, or build_feed with a FeedType.

import finquotes as fq

# Historical OHLCV (yfinance)
hfeed = fq.build_historical_feed("finquotes.yfinance", auto_adjust=True)
for p in hfeed.fetch_hist_prices("MSFT", begin_date=fq.today(), end_date=fq.today()):
    assert p.open is not None and p.high is not None and p.low is not None

# Distributions & splits (yahooquery)
qhist = fq.build_historical_feed("finquotes.yahooquery")
for d in qhist.fetch_hist_dists("BIL", begin_date=fq.today(), end_date=fq.today()):
    print(d)
for s in qhist.fetch_hist_splits("AAPL", begin_date=fq.today(), end_date=fq.today()):
    print(s)

Network parameters (timeout, max_retries, retry_delay, and provider-specific args) can be passed to feed builders as keyword arguments.

API keys

Some providers require an API key (e.g., Quandl, Twelve Data). FinQuotes looks for keys in:

  1. Environment variable: FINQUOTES_<PROVIDER>_API_KEY (e.g. FINQUOTES_QUANDL_API_KEY)
  2. File: ~/.finquotes/api_keys.txt with lines like:
finquotes.quandl=<YOUR_KEY>
finquotes.twelvedata=<YOUR_KEY>

On Windows the file path expands to %USERPROFILE%\.finquotes\api_keys.txt.

You can also pass --api-key on the CLI or api_key="..." to feed builders where applicable.

Data model at a glance

  • Price(symbol, date|datetime, close[, open, high, low, volume, source])
  • Distribution(symbol, ex_date, amount[, pay_date])
  • Split(symbol, ex_date, new_quantity, old_quantity) and Split.from_ratio(...)
  • Security(symbol, name[, type, currency, exchange, country, sector, industry, source, source_id])

Instances print to CSV for easy piping; attributes are typed (Decimal for prices) and validated by a helper (PriceValidator).

Tips & caveats

  • Some providers adjust historical series (e.g., Stooq distributions are adjusted); check source notes before using for cash-flow analysis.
  • Yahoo-derived OHLC fields may be dividend-adjusted; see in-code comments where noted.
  • Timezone defaults to America/New_York for timestamp parsing.

Development

Install uv and sync the locked development environment:

uv sync --locked

Run the local checks:

make lint
make unit-test
make coverage
make test-all

make test-all runs unit tests on the Python versions listed in the pyproject.toml classifiers. Update those classifiers when support changes; they also drive the GitLab version checks. uv downloads missing interpreters as needed.

Pre-commit hooks:

uv run --locked pre-commit install
make pre-commit

Edit pyproject.toml and run uv lock when dependencies change. Commit the project file and uv.lock together. make upgrade refreshes locked dependencies and pre-commit hooks, and make build builds the package.

Publishing (maintainers)

make release           # bump version, update changelog and lockfile, create tag
git push && git push --tags

The tagged publish-pypi pipeline job builds the distributions and uploads them to PyPI via trusted publishing.

Metadata

Release files for finquotes 0.74.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for finquotes 0.74.1
File Size Uploaded Provenance Actions
finquotes-0.74.1.tar.gz 47.6 kB Without provenance Details for finquotes-0.74.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for finquotes 0.74.1
File Interpreter ABI Platform Actions
finquotes-0.74.1-py3-none-any.whl Python 3 none any Details for finquotes-0.74.1-py3-none-any.whl

Total release size: 103.1 kB

Release files / finquotes-0.74.1.tar.gz

Download URL finquotes-0.74.1.tar.gz
Size 47.6 kB
Tags Source
SHA-256 checksum
How to use checksums
f6c3be70862abfb781f190e4b54ec102364753d60b5a3f988f5b0e88f8a49cf9
BLAKE2b-256 checksum
How to use checksums
5694e4013694a04d93904a58a868e25bd9f4a46100c1a125b66ea0481c931810
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.15.2

Release files / finquotes-0.74.1-py3-none-any.whl

Download URL finquotes-0.74.1-py3-none-any.whl
Size 55.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
34de56d0b2877ea7f16ea4adc79db709ca23d36f2a565de3441f66457fea0625
BLAKE2b-256 checksum
How to use checksums
e80d6c9b614e852ec0238c6ea30ee57ddd0274ac1b3b2dc9d2cda7f651095598
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.15.2

Security for finquotes 0.74.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page