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.14
- 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 --upgrade pip
python -m pip install finquotes
Optional extras:
- Types only:
python -m pip install 'finquotes[types]' - All optional dependencies:
python -m pip install -e '.[all]'
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:
- Environment variable:
FINQUOTES_<PROVIDER>_API_KEY(e.g.FINQUOTES_QUANDL_API_KEY) - File:
~/.finquotes/api_keys.txtwith 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)andSplit.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
Set up a local environment once:
python -m venv venv
. .\venv\Scripts\Activate.ps1
python -m pip install --upgrade pip
python -m pip install -e '.[all]'
Run tests:
pytest -q
Pre-commit hooks:
pre-commit install
pre-commit run --all-files
Publishing (maintainers)
cz bump -ch --retry # bump version, update files, create tag
git push && git push --tags
The tagged publish-pypi pipeline job builds the distributions and uploads them to PyPI via trusted
publishing.
Release files for finquotes 0.73.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| finquotes-0.73.1.tar.gz | 46.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| finquotes-0.73.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 101.4 kB
Release files / finquotes-0.73.1.tar.gz
| Download URL | finquotes-0.73.1.tar.gz |
|---|---|
| Size | 46.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
55a87c9429bb48827e1cd616a75314fbb14989a4d1df1d873fc203ee099c42e6
|
|
BLAKE2b-256 checksum How to use checksums |
5dbf95b54eb664878b35f859a204be185828fd4da62a530c45ce93ee84639f5a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / finquotes-0.73.1-py3-none-any.whl
| Download URL | finquotes-0.73.1-py3-none-any.whl |
|---|---|
| Size | 54.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fc672f975ee465d3cd9c2312272683ce35c338e586dba5e8d124d1fce03fa34e
|
|
BLAKE2b-256 checksum How to use checksums |
c0f08dfb5a8b3924d85ee90b6708670bcfca5bd9f7e37516be4c9cb82186baf2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|