When I trade, sometimes I missed out on cum dividend information. For stocks with high dividend yield, it sometimes cause a significant price drop. In the past I bought a stock thinking it was still in uptrend, not knowing that it was a dividend trap. Below is an example of dividend trap I encountered.
Now it would be nice if someone can alert me when some stocks are going to share dividends. So, I created this project to notify me via Telegram. What I did in this project is open the page where dividend announcements are shared. In this case, it’s here.
The problem with the page is the cum dates are stored inside a pdf file. So the first part of the project is:
- Fetch the pdf file
- Parse the pdf file
- Get the cum date. Fortunately, the dates are always beside this text. So we can use that to our advantage.
After we successfully retrieved the dates, we will use a chatbot to send the information. You can see the tutorial for telegram chatbot here. For this, we’ll need 2 things: the bot token and chat id of the room. It will then successfully report to me the list of cum dividend dates.
Here’s the project repository: https://github.com/manuel-hans/ksei-scraper. If you have any suggestions, or if you have a web page to scrap, leave me a comment down below. If it’s something interesting, I’ll gladly do it.