This simply script meant to parse a stock price and to send SMS if a threshold is passed.
- Python 3.6 or newer (
python --version
orpython3 --version
) - Update your pip:
sudo python -m pip install --upgrade pip
(if don't have any, for installationsudo apt-get install python3-pip
) - Install Beautiful soup
sudo pip install bs4
- Install Requests
sudo pip install requests
- Install Requests-HTML
sudo pip install requests_html
(this one is requires Python 3.6 and is used with trading-view data provider)
Please, do the following:
- You need to obtain a valid API key for SMS.RU service
- You need to create a file key.txt, and insert the API key into the file
- You need to create a file config.txt, and insert your phone number into the file (please look into example config-example.txt)
- You need to create a task with autostarting stock-watcher.py. You can do it via crontab or via systemd
- You need to create a task with server rebooting (because this allows you to flush sent SMS counter)
- You need to make stock-watcher.py executable (chmod +x)
crontab -e
this allows reboot server every day at 04:05 am (at server local time)
0 4 * * * /sbin/shutdown -r +5
@reboot sleep 120 && /home/user/git/Stock-watcher/stock-watcher.py >> /home/user/git/Stock-watcher/stock-watcher.log 2>&1