yahoostats

Yahoo statistics webscraper


Keywords
fundamental-analysis, python, stock-analysis, webscraping
License
MIT
Install
pip install yahoostats==0.0.5

Documentation

yahoostats

Python version Travis-CI build status CodeFactor Codecov PyPI license PyPi version PyPi status PyPI - Downloads Docs Build Status Star this repo image


Webscrape stock statistic data from:

  • yahoo finance,
  • reuters,
  • morningstar,
  • zacks.

Quick start

Try on colab:

Python version

from yahoostats.evaluator import combine_stats
stocklist = ['GOOGL', 'TSLA', 'AMD']
combine_stats(stocklist)

Explanation for webscraped data:

                                        GOOGL
tr_score                                 6/10   Tipranks total score
tr_AnalystRatings                  Strong Buy
tr_BloggerOpinions                    Bullish
tr_Hedge FundActivity               Decreased
tr_InsiderActivity                Sold Shares
tr_TipRanksInvestors                  Neutral
tr_NewsSentiment                      Bullish
tr_Technicals                        Negative
tr_Fundamentals                        17.83%
tr_target_pr                         1482.030    Tipranks target price after 12 months
tr_change                    ▲ (7.06% Upside)    Tipranks
tr_next_ex_dividend_date                 None    Tipranks Next Ex-dividend Date
tr_dividend_amount                       None    Tipranks Next dividend amount
ex_date1                          Nov 9, 2020    Tipranks ex-dividend date history
ex_date2                          Aug 7, 2020    Tipranks ex-dividend date history 
ex_date3                          May 7, 2020    Tipranks ex-dividend date history
ex_date4                          Feb 7, 2020    Tipranks ex-dividend date history
ex_date5                          Nov 7, 2019    Tipranks ex-dividend date history
PEG Ratio (5 yr expected) 1              1.94    Yahoo Finance PEG Ratio
sa_rating                             3.20513    Seeking alpha rating 1(bearish) ÷ 5 bullish
sa_target_price                       1550.73    Seeking alpha target price
yf_price_now                          1384.34    Yahoo Finance price now
yf_price_target                       1515.73    Yahoo Finance target price
yf_ratingvalue                            1.8    Yahoo Finance recomendation score
yf_ratingstring                           buy    Yahoo Finance recomendation
yf_profit                             1.09491    Yahoo finance profit (target/current price)
yf_current_ratio                        3.658    Yahoo Finance Current ratio
yf_return_assets                      0.08712    Yahoo Finance Return on assets
yf_return_equity                      0.17835    Yahoo Finance Return on equity
yf_beta                                1.0649    Yahoo Finance Beta factor
ms_stars                              r_star3    Morningstar star rating [0-5]stars
zacks_rate                             3-Hold    Zacks.com recomentations
r_beta                                   1.06    Reuters Beta factor
r_eps_gr3                               20.82    Reuters EPS_Grow 3 years
r_eps_gr5                               19.92    Reuters EPS Grow 5y
r_div_gr3                                  --    Reuters Dividents grow 3y
r_roi_ttm                               15.56    Reuters Return on investment TTM
r_roi_5                                 15.02    Reuters Return on investment 5years
r_current_ratio                          3.37    Reuters Current ratio
r_mar_cap                          919,046.30    Reuters Market cap
r_net_income                        35,813.79    Reuters Net income
r_net_debt                        -115,121.00    Reuters Net debt
r_div_yield                                --    Reuters dividents yeld
r_div_yield5                               --    Reuters dividents yeld 5 years
r_rev_employee                   1,401,837.00    Reuters Revenue/Employee
r_eps                                   51.27    Reuters Deluted EPS
eps_-4q                                 12.76    Estimated EPS 2020Q1- Wall st consensus 
eps_-3q                                 10.66    Estimated EPS 2020Q2
eps_-2q                                  7.95    Estimated EPS 2020Q3
eps_-1q                                 11.28    Estimated EPS 2020Q4
eps_cur                                 15.74    Estimated EPS 2021Q1
eps_+1q                                 13.51    Estimated EPS 2020Q2
eps_+2q                                 14.03    Estimated EPS 2020Q3
eps_+3q                                 16.41    Estimated EPS 2020Q4

Install system requirements

On Windows:

  • Firefox with geckodriver in PATH
  • Chrome with chrome-driver in PATH

On Linux:

For Chrome -please check version compatability chrome-driver

sudo apt-get update
sudo apt-get install chromium chromium-driver

For Firefox - https://firefox-source-docs.mozilla.org/testing/geckodriver/Support.html

sudo apt-get update
sudo apt-get install wget libgtk-3-0 libdbus-glib-1-2 libxt6

FIREFOX_VERSION=62.0.2 
wget -O /tmp/firefox.tar.bz2 https://download-installer.cdn.mozilla.net/pub/firefox/releases/$FIREFOX_VERSION/linux-x86_64/en-US/firefox-$FIREFOX_VERSION.tar.bz2
rm -rf /opt/firefox 
tar -C /opt -xvjf /tmp/firefox.tar.bz2 
rm /tmp/firefox.tar.bz2 
mv /opt/firefox /opt/firefox-$FIREFOX_VERSION 
sudo ln -fs /opt/firefox-$FIREFOX_VERSION/firefox /usr/bin/firefox

GECKO_VERSION=0.26.0
wget https://github.com/mozilla/geckodriver/releases/download/v$GECKO_VERSION/geckodriver-v$GECKO_VERSION-linux64.tar.gz  
tar -xvzf geckodriver-v$GECKO_VERSION-linux64.tar.gz   
sudo cp geckodriver /usr/local/bin/
sudo chmod a+x /usr/local/bin/geckodriver

Install python requirements on venv

On Windows:

python -m venv env
env/Scripts/activate.bat
pip install -r requirements.txt
pip install yahoostats

On Linux:

alias python=python3
python -m venv env
source env/bin/activate
pip install -r requirements.txt
pip install yahoostats

Python Requirements

  • pandas==1.0.3
  • requests>=2.21.0
  • beautifulsoup4==4.6.3
  • urllib3==1.25.9
  • selenium==3.141.0

License

This project is licensed under the MIT License - see the LICENSE.txt

Acknowledgments

Donation

If you want to send me a tip:

  • Buy me a coffee
  • BTC address = 1GfRewxWtovg7gHYiKvGyaxxEhzdN2CMgC
  • LTC address = LS9Jcek1mCrvbpsnbyaCHHtn6iqpM6ef4a