Alphavantage API wrapper.
Project description
alphavantage
alphavantage is a Python wrapper for the Alpha Vantage API.
The API wrapper can be used to retrieve historical prices such as intraday or daily prices for global equities and ETFs.
Status
The API aims to support equity time-series data as a first step.
The package is currently in alpha status. It has not been used extensively yet and therefore mainly of the potential quirks of Alpha Vantage's actual API may not be accounted for. We plan on using this wrapper for price history charting in our company lookup and ratings tool.
Design Consideration
This library is intended to provide a simple wrapper with minimal dependencies, and does not intend to introduce pydata stack dependencies (numpy, pandas, etc.) in the future. Differences with existing wrappers for the Alpha Vantage API include:
Library Differences
- No Pandas dependencies or optional dependency
- Focuses on simplifying data for ingesting
- Avoids logical branching making the code simpler (only two if statements at moment)
- Provides symbology mapping references
The library carries out some conveniences versus using the API without a wrapper.
Conveniences
- Converts timestamps to UTC time when applicable.
- Simplifies record field names i.e. "4. close" -> "close".
- Appends the timestamp field to record vs. having the timestamp act as dictionary key.
- Uses time ascending list versus a dictionary for price record data structure.
- Returns multiple tickers over a given parameter set using threads.
- Maps ticker symbology from other vendors.
- Excludes intraday data in daily price history requests.
Examples
from alphavantage.price_history import (
AdjustedPriceHistory, get_results, PriceHistory, IntradayPriceHistory,
filter_dividends
)
# weekly prices
history = PriceHistory(period='W', output_size='compact')
results = history.get('AAPL')
# intraday prices, 5 minute interval
history = IntradayPriceHistory(utc=True, interval=5)
results = history.get('AAPL')
# adjusted daily prices
history = AdjustedPriceHistory(period='D')
results = history.get('AAPL')
dividends = list(filter_dividends(results.records))
# Return multiple tickers
parameters = {'output_size': 'compact', 'period': 'D'}
tickers = ['AAPL', 'MSFT']
results = dict(get_results(PriceHistory, tickers, parameters))
Contributing
Contributions are welcome. Someone can immediately contribute by building out wrappers for the rest of the API such as FX rates or crypto prices.
Getting Started
Installing
pip install alphavantage
Developer Installation
These instructions assume Python 3.6. It is recommended that you use conda or a virtualenv.
For conda install follow:
Download the conda installer. And follow setup instructions.
Conda Environment
conda create --name <environment_name> python=3.6
activate <environment_name>
conda install --file requirements.txt
python setup.py install bdist_wheel
debian installation
Follow the instructions in the link provided. DO NOT SUDO PIP INSTALL. Alias the preferred Python installation by adding, for example:
alias python='/usr/bin/python3.6'
When using Pip
pip install --upgrade pip
pip install wheel
pip install -r requirements.txt
python setup.py install bdist_wheel
Running the Tests
py.test
Running Coverage Report
py.test --cov
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file alphavantage-0.0.11.tar.gz
.
File metadata
- Download URL: alphavantage-0.0.11.tar.gz
- Upload date:
- Size: 7.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8fa5e18c3c11ff91d478ed561434b82b3cf6c22e01f4768d6f4c799da94f1bad |
|
MD5 | f8a0d775c1fb6f5dd57b5e460f06943c |
|
BLAKE2b-256 | 79f98ee688bd9fd9be532cd8deed32b16431ec8ee3ec5bc1cf56d80a25f03ecc |
File details
Details for the file alphavantage-0.0.11-py36-none-any.whl
.
File metadata
- Download URL: alphavantage-0.0.11-py36-none-any.whl
- Upload date:
- Size: 9.1 kB
- Tags: Python 3.6
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6d296128a22fa53ec2eb24b84f74c7d95c2519d6eb258006d344edd29f897786 |
|
MD5 | fdea7d99844341c01c44b7fb3792c244 |
|
BLAKE2b-256 | 0842fcd23ce652ddaa26f8296f2efd41c503685c084af49d5f5063d90af8ee29 |