Download current and historical stock quotes to CSV files. Built on the Ally, Robinhood, and AlphaVantage APIs and relies on their free keys.
Project description
stockmarketdata
Download current and historical stock quotes while connecting to your Ally or Robinhood account.Working Functions:
Download historical stock quotes to CSV files from AlphaVantage (slow) OR Ally (fast!) for the symbols in your Robinhood watchlists.Download current stock quotes to CSV files from AlphaVantage (slow) OR Ally (fast!) for a list of symbols you define or for the symbols in your Robinhood watchlists (Ally watchlists coming soon!).
Example of the CSV Files
date,1. open,2. high,3. low,4. close,5. volume2020-01-31,32.2,32.325,31.85,32.03,3968506.0
2020-01-30,31.74,32.495,31.69,32.45,4338968.0
Install
pip install stockmarketdataImport
import stockmarketdata.dl_quotes as dlqimport stockmarketdata.ally as ally
Add Your Credentials and Choices
av_key = 'YOUR_ALPHAVANTAGE_KEY'filePath = "C:\\YOUR\\PATH\\" # where to place the CSV files.
rh_email = 'YOUR_EMAIL_WITH_ROBINHOOD@MAIL.COM'
rh_password = 'YOUR_ROBINHOOD_PASSWORD'
rh_watchlist = "Default" # The Robinhood watchlist to pull symbols from.
ally_consumer_key = 'YOUR_ALLY_CONSUMER_KEY'
ally_secret = 'YOUR_ALLY_SECRET'
ally_oauth_token = 'YOUR_ALLY_OAUTH_TOKEN'
ally_oauth_secret = 'YOUR_ALLY_OAUTH_SECRET'
Download Current OHLCV from Ally for Every Symbol in a Robinhood Watchlist (Fast)
rh_symbols = dlq.get_watchlist_symbols(rh_email, rh_password, rh_watchlist)ally.get_ohlcv_from_ally(ally_consumer_key, ally_secret, ally_oauth_token, ally_oauth_secret, rh_symbols, filePath)
Download Current OHLCV from Ally for a List of Stock Symbols (Fast)
ally_symbols = ['WORK', 'SPCE', 'BILI']ally.get_ohlcv_from_ally(ally_consumer_key, ally_secret, ally_oauth_token, ally_oauth_secret, ally_symbols, filePath)
Download Historical Quotes (up to 20 years) from AlphaVantage for all Symbols in a Robinhood Watchlist (Slow but currently don't have an alternative for historical)
dlq.dlquotes(av_key, filePath, rh_email, rh_password, rh_watchlist)Download Current OHLCV from AlphaVantage for Every Symbol in a Robinhood Watchlist (Slow)
wlsymbols = dlq.get_watchlist_symbols(rh_email, rh_password, rh_watchlist)dlq.simple_quotes(av_key, filePath, wlsymbols)
Download Current OHLCV from AlphaVantage for One or More Stock Symbols You Define (Slow)
symbol_list = ['BA', 'ALLY', 'F', 'MU', 'SPCE', 'T', 'WMT', 'S']dlq.simple_quotes(av_key, filePath, symbol_list)
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
stockmarketdata-0.0.1.tar.gz
(5.7 kB
view hashes)
Built Distribution
Close
Hashes for stockmarketdata-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2db49511568eaf00bfb9e5ccb589786dc43c0daf47982c7ec7f519a2327eeae8 |
|
MD5 | 6ed5cb37e960ab30c6a0bcce9252c46a |
|
BLAKE2b-256 | 765de0f02d61ed2b3abce705e24d1f9b4ca36f2ca11f6de877c2cbf991516dc9 |