yahoostock
A package designed to scrape data from Yahoo Finance.
Installation
The most simple installation method is through PIP.
pip install yahoostock
The PyPI page can be found here.
Usage
Use the following code to see a list of useful methods.
from yahoostock import yahoo
print(dir(yahoo))
Note that each method accepts a stock ticker as a single parameter and returns a float with the specified statistic.
Here's an example:
from yahoostock.yahoo import *
stock_name = "GOOGL"
function_list = [
get_price,
get_open,
get_previous_close,
get_change,
get_percent_change
]
for function in function_list:
# prints price ($), opening price ($), last closing price ($),
# change in price ($), and relative change (%)
print(function(stock_name))
For information about a specific method's purpose refer to the respective method's docstrings.
For example:
from yahoostock.yahoo import get_price
help(get_price)