Unified api to fetch stock prices from varied sources
Project description
Bardata - Common api to fetch stock prices from various sources
This project provides a minimal common api to fetch stock prices from various sources. It includes a driver model with entry points to add custom data source providers. Each driver is implemented as a thin wrapper around the respective client libraries.
[!WARNING] This project is experimental and the interface is likely to change.
Conventions
- Prices are dataframes with a datetime index called
dateordatetime - Column names
open,high,low,close,volumeall lower case - Arguments like
freq,start_date,end_dateandmax_barsare optional - Price data is adjusted by default
Fetching Prices
from bardata import get_prices
prices = get_prices("AAPL", freq="daily", source="tiingo") # pandas.DataFrame
Polars Adapters
By default prices are returned as pandas DataFrames. For polars output, use the bardata.polars adapters, which mirror the pandas methods but return polars dataframes instead. This requires the polars extra "bardata[polars]".
from bardata.polars import get_prices
prices = get_prices("AAPL", freq="daily", source="tiingo") # polars.DataFrame
The pandas index (date/datetime) becomes an explicit column in the polars dataframe.
Built-in Data Sources
Default Source
When source is omitted, it is resolved from environment variables depending on frequency — BARDATA_DEFAULT_ENDOFDAY for end-of-day data and BARDATA_DEFAULT_INTRADAY for intraday (hourly/minute). There is no built-in default: if the default variable is not set, fetching without an explicit source will raise an exception.
export BARDATA_DEFAULT_ENDOFDAY=tiingo
export BARDATA_DEFAULT_INTRADAY=massive
Credentials
Some data sources require credentials
- Tiingo via the
TIINGO_API_KEYenvironment variable - Massive via the
MASSIVE_API_KEYenvironment variable
Installation
You can install the package with pip. Include the required source as an extra: yahoo, tiingo, massive, or all for all built-in sources. Add polars for polars support.
pip install "bardata[tiingo,massive,polars]"
Related Projects and Resources
- yfinance - Download market data from Yahoo! Finance's API
- tiingo-python - Python client for interacting with the Tiingo Financial Data API (stock ticker and news data)
- client-python - The official Python client library for the Massive.com REST and WebSocket API.
- pandas-datareader - Extract data from a wide range of Internet sources into a pandas DataFrame.
- findatapy - Python library to download market data via Bloomberg, Eikon, Quandl, Yahoo etc.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bardata-0.0.9-py3-none-any.whl.
File metadata
- Download URL: bardata-0.0.9-py3-none-any.whl
- Upload date:
- Size: 542.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.13 {"installer":{"name":"uv","version":"0.9.13"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"25.04","id":"plucky","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ebd92ee9dee40801efbbf2f8bb2f8ce0a94a4e473d644d93f38a3dca5bcca096
|
|
| MD5 |
e7d64f751170acbc1b9f75e349611691
|
|
| BLAKE2b-256 |
15c08e5da3a76e72e9fdc9a3e0ca545598a017ef0a307b86095b1877b21d241b
|