Scripts to download fundamental data on stocks from Yahoo Finance webpage.
In the functions file there're functions to download fundamental data from Yahoo Finance webpage. The download script is only a caller with a simple command line interface.
The functions are:
- balance: newest data on balance sheet page
- balance_allyears: all available years
- financials: newest data on financials page
- financials_allyears: all available years
- cashflow: newest data on cashflow page
- cashflow_allyears: all available years
- keystats: data from keystats page
- download_newest: wrapper that calls functions to download only newest data on stock
Disclaimer: using the download.py to download many stocks can take while since it'll run a chrome instance for each stock.
Python 3.8
BeautifulSoup4 4.9.1
Numpy 1.19.1
Pandas 1.1.0
Requests 2.24.0
Selenium 3.141.0
Google Chrome
Chrome webdriver (matching your OS and chrome version)
There're several ways to use:
- You can copy the functions script to your repository and import it.
- Use the download script.
The most important part is to download the chrome webdriver from this page: https://chromedriver.chromium.org/downloads
Unzip the driver inside your repo and name it as 'chromedriver'. It's important that the driver match your operational system and your Chrome version.
The chromedriver listed inside this repository probably will not match yours, so do your work.
- Implement option to run with firefox webdriver
- Add a docker image to run the download.py in a container