Simple Python Script to retrieve all stocks data from Google Finance Screener (Part 2)

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.

Advertisements

10 comments

  1. these packge installation results in syntax errors because “print” calls are being used without parenthesis in this and pattern-2.6 package

    1. 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 🙂

    1. 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.

  2. 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.

    1. 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.

      1. 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.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s