finquotes


Namefinquotes JSON
Version 0.65.0 PyPI version JSON
download
home_pageNone
SummaryRetrieves financial quotes from the web
upload_time2025-09-01 23:52:40
maintainerNone
docs_urlNone
authorelmotec
requires_python<3.14,>=3.11
licenseNone
keywords stock quote quotes financial finance share common market
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![pipeline status](https://gitlab.com/elmotec/finquotes/badges/main/pipeline.svg)](https://gitlab.com/elmotec/finquotes/-/commits/main)
[![coverage report](https://gitlab.com/elmotec/finquotes/badges/main/coverage.svg)](https://gitlab.com/elmotec/finquotes/-/commits/main)

# 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).

- Python: 3.11–3.13
- 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

```powershell
python -m pip install --upgrade pip
python -m pip install finquotes
```

Optional extras:

- Types only: `python -m pip install 'finquotes[types]'`
- Dev/test: `python -m pip install -e '.[develop,test,types]'`

## Quick start (Python)

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

```python
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). 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:

```text
finquotes.quandl=<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

Set up a local environment once:

```powershell
python -m venv venv
. .\venv\Scripts\Activate.ps1
python -m pip install --upgrade pip
python -m pip install -e '.[develop,test,types]'
```

Run tests:

```powershell
pytest -q
```

Pre-commit hooks:

```powershell
pre-commit install
pre-commit run --all-files
```

### Publishing (maintainers)

```powershell
cz bump -ch    # bump version, update files, create tag
git push --tags
# build & upload using your preferred toolchain
python -m build          # or: python -m setup sdist
twine upload dist/*       # or target a custom repository URL
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "finquotes",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<3.14,>=3.11",
    "maintainer_email": null,
    "keywords": "stock, quote, quotes, financial, finance, share, common, market",
    "author": "elmotec",
    "author_email": "elmotec@gmx.com",
    "download_url": "https://files.pythonhosted.org/packages/d7/1c/26371ec1ac0a07b2ce7f4f38f7d34040ea049c40b3fb3e75255e541ddf9a/finquotes-0.65.0.tar.gz",
    "platform": null,
    "description": "[![pipeline status](https://gitlab.com/elmotec/finquotes/badges/main/pipeline.svg)](https://gitlab.com/elmotec/finquotes/-/commits/main)\r\n[![coverage report](https://gitlab.com/elmotec/finquotes/badges/main/coverage.svg)](https://gitlab.com/elmotec/finquotes/-/commits/main)\r\n\r\n# FinQuotes\r\n\r\nFinQuotes 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.\r\n\r\nIt supports close snapshots, historical OHLCV, distributions (dividends), splits, and security metadata across multiple providers (Yahoo Finance, yfinance, yahooquery, Stooq, Morningstar, Quandl).\r\n\r\n- Python: 3.11\u20133.13\r\n- License: GPL-3.0\r\n\r\n## Features\r\n\r\n- Unified API and CLI for multiple data sources\r\n- Normalized data models: Price, Distribution, Split, Security\r\n- Deterministic CSV output for easy piping and testing\r\n- Robust network options: retry, timeout, max retries\r\n- Pluggable sources via lightweight \u201cfeed\u201d builders\r\n\r\n## Install\r\n\r\n```powershell\r\npython -m pip install --upgrade pip\r\npython -m pip install finquotes\r\n```\r\n\r\nOptional extras:\r\n\r\n- Types only: `python -m pip install 'finquotes[types]'`\r\n- Dev/test: `python -m pip install -e '.[develop,test,types]'`\r\n\r\n## Quick start (Python)\r\n\r\nUse typed builder helpers for clarity, or `build_feed` with a `FeedType`.\r\n\r\n```python\r\nimport finquotes as fq\r\n\r\n# Historical OHLCV (yfinance)\r\nhfeed = fq.build_historical_feed(\"finquotes.yfinance\", auto_adjust=True)\r\nfor p in hfeed.fetch_hist_prices(\"MSFT\", begin_date=fq.today(), end_date=fq.today()):\r\n\tassert p.open is not None and p.high is not None and p.low is not None\r\n\r\n# Distributions & splits (yahooquery)\r\nqhist = fq.build_historical_feed(\"finquotes.yahooquery\")\r\nfor d in qhist.fetch_hist_dists(\"BIL\", begin_date=fq.today(), end_date=fq.today()):\r\n\tprint(d)\r\nfor s in qhist.fetch_hist_splits(\"AAPL\", begin_date=fq.today(), end_date=fq.today()):\r\n\tprint(s)\r\n```\r\n\r\nNetwork parameters (`timeout`, `max_retries`, `retry_delay`, and provider-specific args) can be passed to feed builders as keyword arguments.\r\n\r\n## API keys\r\n\r\nSome providers require an API key (e.g., Quandl). FinQuotes looks for keys in:\r\n\r\n1) Environment variable: `FINQUOTES_<PROVIDER>_API_KEY` (e.g. `FINQUOTES_QUANDL_API_KEY`)\r\n2) File: `~/.finquotes/api_keys.txt` with lines like:\r\n\r\n```text\r\nfinquotes.quandl=<YOUR_KEY>\r\n```\r\n\r\nOn Windows the file path expands to `%USERPROFILE%\\.finquotes\\api_keys.txt`.\r\n\r\nYou can also pass `--api-key` on the CLI or `api_key=\"...\"` to feed builders where applicable.\r\n\r\n## Data model at a glance\r\n\r\n- `Price(symbol, date|datetime, close[, open, high, low, volume, source])`\r\n- `Distribution(symbol, ex_date, amount[, pay_date])`\r\n- `Split(symbol, ex_date, new_quantity, old_quantity)` and `Split.from_ratio(...)`\r\n- `Security(symbol, name[, type, currency, exchange, country, sector, industry, source, source_id])`\r\n\r\nInstances print to CSV for easy piping; attributes are typed (Decimal for prices) and validated by a helper (`PriceValidator`).\r\n\r\n## Tips & caveats\r\n\r\n- Some providers adjust historical series (e.g., Stooq distributions are adjusted); check source notes before using for cash-flow analysis.\r\n- Yahoo-derived OHLC fields may be dividend-adjusted; see in-code comments where noted.\r\n- Timezone defaults to America/New_York for timestamp parsing.\r\n\r\n## Development\r\n\r\nSet up a local environment once:\r\n\r\n```powershell\r\npython -m venv venv\r\n. .\\venv\\Scripts\\Activate.ps1\r\npython -m pip install --upgrade pip\r\npython -m pip install -e '.[develop,test,types]'\r\n```\r\n\r\nRun tests:\r\n\r\n```powershell\r\npytest -q\r\n```\r\n\r\nPre-commit hooks:\r\n\r\n```powershell\r\npre-commit install\r\npre-commit run --all-files\r\n```\r\n\r\n### Publishing (maintainers)\r\n\r\n```powershell\r\ncz bump -ch    # bump version, update files, create tag\r\ngit push --tags\r\n# build & upload using your preferred toolchain\r\npython -m build          # or: python -m setup sdist\r\ntwine upload dist/*       # or target a custom repository URL\r\n```\r\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Retrieves financial quotes from the web",
    "version": "0.65.0",
    "project_urls": null,
    "split_keywords": [
        "stock",
        " quote",
        " quotes",
        " financial",
        " finance",
        " share",
        " common",
        " market"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "3ee5eafdda2bd0596af63b45c0aac7f0317f00c761a4797c39854909fe5bff83",
                "md5": "a4237ddd64b9a92d33b9a70099266a0e",
                "sha256": "e8e944548523a38a30f37aef9b1deea3b75a8b6ca902ddbd56afaf0863397668"
            },
            "downloads": -1,
            "filename": "finquotes-0.65.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a4237ddd64b9a92d33b9a70099266a0e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<3.14,>=3.11",
            "size": 50948,
            "upload_time": "2025-09-01T23:52:39",
            "upload_time_iso_8601": "2025-09-01T23:52:39.539481Z",
            "url": "https://files.pythonhosted.org/packages/3e/e5/eafdda2bd0596af63b45c0aac7f0317f00c761a4797c39854909fe5bff83/finquotes-0.65.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "d71c26371ec1ac0a07b2ce7f4f38f7d34040ea049c40b3fb3e75255e541ddf9a",
                "md5": "a5b4007fae3b9b58af10909b94562b98",
                "sha256": "cd082871b62f9fa8cdfa20d15efd8fea1323433f6708e973a013197c2d543877"
            },
            "downloads": -1,
            "filename": "finquotes-0.65.0.tar.gz",
            "has_sig": false,
            "md5_digest": "a5b4007fae3b9b58af10909b94562b98",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<3.14,>=3.11",
            "size": 44575,
            "upload_time": "2025-09-01T23:52:40",
            "upload_time_iso_8601": "2025-09-01T23:52:40.661023Z",
            "url": "https://files.pythonhosted.org/packages/d7/1c/26371ec1ac0a07b2ce7f4f38f7d34040ea049c40b3fb3e75255e541ddf9a/finquotes-0.65.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-09-01 23:52:40",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "finquotes"
}
        
Elapsed time: 0.77585s