MarketQuery
A unified interface for market data APIs, providing a simple way to download historical market data from multiple providers.
Features
- Support for multiple data providers:
- Yahoo Finance (default)
- Stooq
- Tiingo
- Alpha Vantage
- Polygon.io
- Built-in caching system
- Consistent data format across providers
- Easy-to-use interface
- Support for multiple tickers
- Progress bars for long downloads
Installation
pip install marketquery
Quick Start
import marketquery as mq
# Download data for a single ticker
data = mq.download('AAPL', start='2024-01-01', end='2024-01-31')
# Download data for multiple tickers
data = mq.download(['AAPL', 'GOOGL', 'MSFT'], start='2024-01-01', end='2024-01-31')
# Use a different provider
data = mq.download('AAPL', provider='tiingo', api_key='your_api_key')
Environment Variables
MarketQuery supports configuration through environment variables. To use them:
- Create a
.envfile in your project directory:
# Set default provider
MARKETQUERY_DEFAULT_PROVIDER=tiingo
# API keys for different providers
TIINGO_API_KEY=your_tiingo_api_key
ALPHA_VANTAGE_API_KEY=your_alpha_vantage_api_key
ALPHA_VANTAGE_PREMIUM_API_KEY=your_alpha_vantage_premium_api_key
- Load the environment variables in your code:
from dotenv import load_dotenv
load_dotenv() # Load environment variables from .env file
import marketquery as mq
data = mq.download('AAPL') # Will use settings from .env file
Available environment variables:
MARKETQUERY_DEFAULT_PROVIDER: Set default provider (e.g., 'yahoo', 'tiingo', 'alpha_vantage')TIINGO_API_KEY: API key for TiingoALPHA_VANTAGE_API_KEY: API key for Alpha VantageALPHA_VANTAGE_PREMIUM_API_KEY: Premium API key for Alpha Vantage
Documentation
For detailed documentation, run:
import marketquery as mq
mq.help()
Cache Management
MarketQuery includes a built-in caching system to improve performance and reduce API calls. The cache is stored in your system's cache directory:
- macOS:
~/Library/Caches/marketquery - Linux:
~/.cache/marketquery - Windows:
%LOCALAPPDATA%\marketquery\Cache
You can control caching behavior with the following parameters:
load=True/False: Enable/disable loading from cachesave=True/False: Enable/disable saving to cachecache_dir: Specify a custom cache directory
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Metadata
Release files for marketquery 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| marketquery-0.1.0.tar.gz | 23.8 kB | Without provenance | Details for marketquery-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| marketquery-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for marketquery-0.1.0-py3-none-any.whl |
Total release size: 47.9 kB
Release files / marketquery-0.1.0.tar.gz
| Download URL | marketquery-0.1.0.tar.gz |
|---|---|
| Size | 23.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4ed4513896ce3ff65ea1debf5f97aafcad033e196bfb6e0fa0d8375fba20312f
|
|
BLAKE2b-256 checksum How to use checksums |
bdd614b1d0c709ba17249cbc986a9d9d1f77b4194c9ed40548e9a2f05a4efe49
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.12
|
Release files / marketquery-0.1.0-py3-none-any.whl
| Download URL | marketquery-0.1.0-py3-none-any.whl |
|---|---|
| Size | 24.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a98a1df2aa771ec58e2bc0f8d87dd2ef334321f99fc52bd37c1f583156bfd472
|
|
BLAKE2b-256 checksum How to use checksums |
e0db86a13896d16e0bfd11abcce9ef020ef058be5e37c02cc3c85f5e6ca9e942
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.12
|
Security for marketquery 0.1.0
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.