|
| 1 | +# Google Stock Screener |
| 2 | +*Have you ever wished a good selection of stocks be delivered daily to your inbox?* *Have you ever wished you could navigate in a few moments through the thousands of names available for investment in the stock markets?* **So did I.** |
| 3 | + |
| 4 | +Therefore, I created this module to support my own investment activity. |
| 5 | + |
| 6 | +What it does: |
| 7 | +- It connects to the [Google Stock Screener API](https://www.google.com/finance/stockscreener); |
| 8 | +- Runs a query on it based on certain fundamental stock screening criteria (e.g. [P/E ratio](http://wwww.investopedia.com/terms/p/price-earningsratio.asp), [Dividend Yield](http://wwww.investopedia.com/terms/d/dividendyield.asp), [EBITDA Margin](http://wwww.investopedia.com/terms/e/ebitda-margin.asp)). |
| 9 | +- Delivers the result in a nice formatting to my inbox. |
| 10 | + |
| 11 | +The module support **multi-exchange queries**, and a **maximum of 8 criteria** at a time. |
| 12 | + |
| 13 | +## Installation Instructions |
| 14 | +Tested with, and assumes you already have at your disposal: |
| 15 | +- Ubuntu 16.04; |
| 16 | +- Anaconda Python 3.5.3 |
| 17 | +- Gmail email server. |
| 18 | + |
| 19 | +Install git |
| 20 | +``` |
| 21 | +sudo apt-get update |
| 22 | +sudo apt-get install git |
| 23 | +``` |
| 24 | + |
| 25 | +Copy the repository on your computer and rename the sample config file |
| 26 | +``` |
| 27 | +git clone https://github.com/terzim/GoogleStockScreener.git |
| 28 | +cd GoogleStockScreener |
| 29 | +mv config-sample.ini config.ini |
| 30 | +``` |
| 31 | +Install the python requirements |
| 32 | +``` |
| 33 | +conda install --yes --file requirements.txt # If using Anaconda Python distribution |
| 34 | +``` |
| 35 | +or |
| 36 | +``` |
| 37 | +pip3 install -r requirements.txt # If using a standard Python3 distributions |
| 38 | +``` |
| 39 | + |
| 40 | +## Configuration |
| 41 | +Open the ```config.ini``` file in your favourite text editor. Edit the configuration parameters accordingly. |
| 42 | + |
| 43 | +### Screener data |
| 44 | + |
| 45 | +Sample config file: |
| 46 | +``` |
| 47 | +[screener_data] |
| 48 | +csv_file = YOUR_CSV_FILE_NAME (e.g. csv_file.csv) |
| 49 | +json_file = YOUR_JSON_FILE_NAME (e.g. json_file.json) |
| 50 | +currency = YOUR_CURRENCY_OF_CHOICE (e.g. USD) |
| 51 | +; Note - if left empty, defaults to standard currency of exchange |
| 52 | +exchanges = YOUR, LIST, OF, EXCHANGES, SEPARATED, BY COMMAS (e.g. NYSE, LON, BIT) |
| 53 | +sector = YOUR_SECTOR_OF_CHOICE ** TODO ** |
| 54 | +; Note - to do leave sector empty for now |
| 55 | +``` |
| 56 | + |
| 57 | +### Email Data |
| 58 | +``` |
| 59 | +[email_data] |
| 60 | +send_email = TRUE/FALSE |
| 61 | +; set send_email to True is wish to send the email |
| 62 | +sender = YOUR_SENDER_USERNAME (e.g. [email protected]) |
| 63 | +recipient = YOUR_RECIPIENT_EMAIL (e.g. [email protected]) |
| 64 | +pwd_sender = YOUR_SENDER_PASSWORD (e.g. catdog123) |
| 65 | +server_name = YOUR_SMTP_SERVER_NAME (e.g. smtp.gmail.com) |
| 66 | +; Note - gmail server_name is smtp.gmail.com |
| 67 | +server_port = YOUR_SMTP_SERVER_PORT (e.g. 587) |
| 68 | +; Note - gmail server_post is 587 |
| 69 | +``` |
| 70 | + |
| 71 | +### Screening Criteria |
| 72 | + |
| 73 | +These are also set at the bottom of the configuration file. A full list of the criteria (organized by topic) is to be found in the class documentation. **Leave blank the criteria you do not use** |
| 74 | + |
| 75 | +``` |
| 76 | +[screening_criteria] |
| 77 | +CRITERIA1 = (e.g. pe_ratio) |
| 78 | +CRITERIA1_MIN = (e.g. 5) |
| 79 | +CRITERIA1_MAX = (e.g. 15) |
| 80 | +CRITERIA2 = (e.g. price_to_book) |
| 81 | +CRITERIA2_MIN = 1 |
| 82 | +CRITERIA2_MAX = 3 |
| 83 | +CRITERIA3 = |
| 84 | +CRITERIA3_MIN = |
| 85 | +CRITERIA3_MAX = |
| 86 | +CRITERIA4 = |
| 87 | +CRITERIA4_MIN = |
| 88 | +CRITERIA4_MAX = |
| 89 | +CRITERIA5 = |
| 90 | +CRITERIA5_MIN = |
| 91 | +CRITERIA5_MAX = |
| 92 | +CRITERIA6 = |
| 93 | +CRITERIA6_MIN = |
| 94 | +CRITERIA6_MAX = |
| 95 | +CRITERIA7 = |
| 96 | +CRITERIA7_MIN = |
| 97 | +CRITERIA7_MAX = |
| 98 | +CRITERIA8 = |
| 99 | +CRITERIA8_MIN = |
| 100 | +CRITERIA8_MAX = |
| 101 | +``` |
| 102 | +### Run the screen |
| 103 | +The screen can be run one-off |
| 104 | +``` |
| 105 | +python StockScreener.py |
| 106 | +``` |
| 107 | +or - in alternative - scheduled for periodical execution via crontab (and - possibly - a VPS). For instructions to setup crontab on a VPS, read a [shorthand guide here](https://www.digitalocean.com/community/tutorials/how-to-use-cron-to-automate-tasks-on-a-vps). |
0 commit comments