This website collects cookies to deliver better user experience
Automating personal investment reports with Gitlab Pages and CI/CD pipelines
Automating personal investment reports with Gitlab Pages and CI/CD pipelines
👋 Introduction
I’ve been investing in stocks and mutual funds in the Indian stock market for a couple of years. The reports available on the trading platforms are not sufficient. Moreover, I use multiple platforms making it impossible to look at the health of my portfolio as a whole. So I set out to create my personal investment report. These were my expectations:
The trading platform I use doesn’t provide APIs to fetch my trades automatically 😕. So I manually export the trade book (as CSV) end of every month and store them in a “data” folder in the repository.
2. Latest prices
I wrote a python script that crawls the stock exchange sites. It collects the end of day prices which is good enough for my usecase. You can check out the code here.
📈 Report generation
With all my trades and their latest prices, I could calculate the metrics that I was interested in:
I segregated my trades into equity and debt and calculated the same metrics for the two categories as well. With these metrics, I used Jinja templating engine to display these numbers in a simple cards design 👇
Finally, I set up Gitlab’s pipeline schedule to generate the above HTML file every day after the markets closed. And with Gitlab pages, served the same HTML by placing it inside the public folder. For private repositories, only members can access the Gitlab pages thus making it my personal investment report 👻
Are you an investor looking to create a personal investment report just like this one? Feel free to drop your comments (or reach out to me on Twitter), I can share more details.
If you liked this article, you can subscribe to my newsletter to get new articles directly in your inbox 🙏