I hold a few stocks and I want to stay up-to-date about their quotations. However, I found it a bit tedious to actively log in to my portfolio every day to see what has changed. So I decided that I needed a notification system that automatically informs me about the relative price changes for all of my stocks once a day. Since I get all kinds of notifications – including security alerts from my server, updates in my GitHub feed, and more – via Telegram, the choice to use that messenger for stock price notifications as well was quite obvious. Another obvious decision what have been to write a small Python script, that gets executed once a day via CRON. However, this time, I didn’t want to write any code, but instead try the flow-based visual programming tool Node-RED.
The resulting flow, that fulfills the above mentioned purpose looks like this.
The flow’s entry node is an
inject node, that holds a JSON array of all my stocks’ symbols (e.g.
QCOM) and is automatically executed once every afternoon. The message is then split into multiple, individual messages, namely, one for every stock symbol. A
http request node then calls the Alphavantage API once for every message to fetch the intra-day price changes. Subsequently, the response is parsed, post-processed and formatted as Markdown. Eventually all individual messages are combined into one again before my Webhook2Telegram bot is requested to send me the message as a last step.