Skip to main content
Python Software Foundation 20th Year Anniversary Fundraiser  Donate today!

a general purpose stock data extractor

Project description

Stock Extractor

This package includes a series of stock data extractor class from a few widely used sources, such as Yahoo Finance,, etc.


``pip install stock_extractor``

The package has the following dependencies:
* requests
* pandas
* beautifulsoup4


The package currently has only one extractor class - SP500Extractor
It is used to extract stock data about S&P 500 companies


# import extractor class
from stock_extractor.BarchartExtractor.sp_500_extract import SP500Extractor

extractor = SP500Extractor()

# get_sp500_symbol_list() returns all SP500 company symbols as a list
sp500_symbols = extractor.get_sp500_symbol_list()

# get_sp500_data_by_type(type) retrieves sp500 company stock infomation and store the result in a pandas dataframe
# type can be 'main', 'technical', or 'performance'
# 'main' includes fields: 'Symbol', 'Name', 'Last Price', 'Change', 'Percent', 'High', 'Low', 'Volume', 'Time'
# 'technical' includes fields: 'Symbol', 'Name', 'Last Price', 'Opinion', '20D-Strength', '20D-Volty', '20D-AVol', '52W-Low', '52W-High'
# 'performance' includes fields: 'Symbol', 'Name', 'Last Price', 'Weighted-Alpha', 'YTD-Pct', '1Month-Pct Change', '3Month-Pct Change', '1Year-Pct Change'

# get_sp500_full_data() will retrieve all three types of data and combine them into the dataframe

# get_dataframe() will return the dataframe that stores retrieved data

# save_to_csv(filepath) will save the dataframe as a csv file

run ::
python -m unittest discover


The package is created by Zach Liu. Please send email to if you have questions or comments.



Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for stock_extractor, version 0.1
Filename, size File type Python version Upload date Hashes
Filename, size stock_extractor-0.1.tar.gz (2.2 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page