Skip to main content

Python package

Upload Python Package

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. volume
2020-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 stockmarketdata

Import

import sys import stockmarketdata.dl_quotes as dlq
import 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'

operation = sys.argv

#----------------------------------------------------------------------------
# Download Current OHLCV from Ally for Every Symbol in a Robinhood Watchlist |
# ----------------------------------------------------------------------------

if operation[1] == '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 AlphaVantage for a List of Stock Symbols |
# ----------------------------------------------------------------------    

elif operation[1] == 'list': del operation[0:2] dlq.simple_quotes(av_key, filePath, operation)

# ----------------------------------------------------------------------------------
# Download historical quotes for all symbols in a Robinhood watchlist to CSV files |
# ----------------------------------------------------------------------------------    

elif operation[1] == 'full': dlq.dlquotes(av_key, filePath, rh_email, rh_password, rh_watchlist)

Example Usage in Command Line:

Download Current OHLCV from Ally for Every Symbol in a Robinhood Watchlist (fast)

python examples.py fast

Download Current OHLCV from AlphaVantage for One Symbol OR a List of Symbols (fast)

python examples.py list WMT

python examples.py list WMT AAPL MSFT TSLA

Download historical quotes for all symbols in a Robinhood watchlist (Time consuming)

python examples.py full

Release files for stockmarketdata 0.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for stockmarketdata 0.0.4
File Size Uploaded
stockmarketdata-0.0.4.tar.gz 6.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for stockmarketdata 0.0.4
File Interpreter ABI Platform
stockmarketdata-0.0.4-py3-none-any.whl Python 3 none any Details

Total release size: 13.5 kB

Release files / stockmarketdata-0.0.4.tar.gz

Download URL stockmarketdata-0.0.4.tar.gz
Size 6.1 kB
Tags Source
SHA-256 checksum
How to use checksums
abefc0a85dd4172d8ea2e6a3b2ce1a2d9962b96c333b5884662602b1a1a922dd
BLAKE2b-256 checksum
How to use checksums
7d385d84892e39b0094dfc0a05a56aaec44e2b5a66eaedd0efb33ea42f932fc3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.3

Release files / stockmarketdata-0.0.4-py3-none-any.whl

Download URL stockmarketdata-0.0.4-py3-none-any.whl
Size 7.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
737002d6f178b26322fb48ea6e417a16552fd3af916fe2bd21e6f1be6ca33613
BLAKE2b-256 checksum
How to use checksums
6d7db78f6b74d914548f8760ca78149da612839a4a71b7465d51a20f8f489a60
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.3

Release history Release notifications | RSS feed

This release

0.0.4 This release

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page