When a chosen ticker's previous day closing price exceeds 5% (percentage constraint) of the opening price, the title of news are searched for the company name and 3 (pageSzize) articles are returned and parsed, then sent to a chat via Telegram. (Previous commits used SMS via Twilio)
pythonanywhere - it's limited in its features for the free tier but its simple and works
- Get stock data - https://www.alphavantage.co/query
- Get news stories - https://newsapi.org/v2/everything
- Send SMS - Twilio (careful not to burst your free credits)
- Telegram API - https://core.telegram.org/bots/api
To change number of articles retrieved:
- Change pageSize in NEWS_PARAMS (e.g. 3)
To change Percentage constraints of price fluctuations: e.g. 5% under get_stock_alert() --> if (abs(day_changes)/opening_price)*100 > 5: get_news(day_changes, up_down)