Upgraded version from previous “Simple Python Script to retrieve all stocks data from Google Finance Screener“. The new version allows options to select the various stocks exchange including all US exchange and expand on the financial metrics present.
To run the script, you can simply run the following commands.
from google_screener_data_extract import GoogleStockDataExtract hh = GoogleStockDataExtract() hh.target_exchange = 'NASDAQ' #SGX, NYSE, NYSEMKT hh.retrieve_all_stock_data() hh.result_google_ext_df.to_csv(r'c:\data\temp.csv', index =False) #save filename
The new script allows easy installation via pip. To install:
pip install google_screener_data_extract
The script is also available in GitHub.
these packge installation results in syntax errors because “print” calls are being used without parenthesis in this and pattern-2.6 package
Hi buy sell, these packages are run on Python 2.x. If you use python 3, there will be syntax error particularly with the print statement. Hope that helps 🙂
Does this work for any exchange or just SGX? I only get the results for SGX even when I change target_exchange
Hi QB, this is mainly for SGX but you can do slight tweaking for other exchanges.
Alternatively, you can also refer to below post “Simple Python Script to retrieve all stocks data from Google Finance Screener (Part 2)” https://goo.gl/deU5CS which enables data scraping for different exchanges found in Google screener.
Hope that helps.
This is very useful. Thank you.
How do you get the fieldnames? I am thinking of getting other info such as the sector of the company etc.
HI GY, thanks for the good comments. You can refer to the prior post “https://simply-python.com/2015/09/26/simple-python-script-to-retrieve-all-stocks-data-from-google-finance-screener/” on how to get the various field parameters. The parameters must be part of the parameters in google stock screener.
Give it a try. Let me know if you need further help.
Thanks, I have just tried going through the morningstar method to get the url (so that I could see if I could get other parameters) but it doesn’t seem to work for google screener now. Seems like there are some problems with it at the moment.
Hi GY, I am able to get the parameters. Are you still facing problem? Let me know if you need further help.