DEV Community

Cover image for AskDividend: Simplifying Dividend Calculations [India Edition]
Piyush Chhabra
Piyush Chhabra

Posted on

AskDividend: Simplifying Dividend Calculations [India Edition]

Introduction

Programming is often seen as a complex and serious task, but it can also be incredibly fun and rewarding. In this blog post, we'll explore how I wrote a simple Python automation to. calculate the total dividend amount I received from my stocks investments. So, grab your favorite beverage, sit back, and let's dive into the world of programming fun!

The Problem

So, It's that time of the year again, when everyone is worried about filling out ITR (Income Tax Returns) before the deadline arrives. For me personally, It's always a tedious task that I procrastinate to complete till the last moment. One common thing where I struggle every year is to manually calculate the dividends I have received from my stock investments. I use the groww app to do all my investments, and the app does not give me the dividend report. So I need to go through my yearly bank statement to find all the dividends credit. As you can imagine, It's a boring and mundane task 😭. I am sure, almost all the people who invest in stocks, would have to go through the same process.

Python to the Rescue

Instead of doing the same thing manually this year, I thought of writing a simple Python script that can calculate the dividends from my bank statement. Sounds fun, right 🤩?

Image description

I figured out that dividends are always credited with certain keywords in transaction summary. It was fairly simple to get the CSV file for yearly bank statements and then I crawled through it to find all the credit transactions with those keywords. And Voila, It works ✌️ !!

I recently came across the framework called Streamlit in python that lets you easily share your work with everyone by hosting your scripts with simple UI. I wrapped my script with some simple UI elements and managed to host it so that I can share it with friends.

🥁🥁🥁🥁 !!!!!! Drum Rolls here !!!!!!! 🥁🥁🥁🥁

I present to you ask-dividend: https://ask-dividend.streamlit.app/

It just takes your bank name and a CSV file for your bank statement as input, to show you the dividend amount you received along with all dividend credit transactions.

Image description
It currently supports 2 banks: SBI and HDFC.

And yes, It's just a hosted script within a UI application so your financial data is safe and not going anywhere. Pinky Promise 😄 !!!

Source code: https://github.com/piyushchhabra/streamlit-experiments/blob/main/dividend.py

Do share If you have also written code to automate boring stuff, I would love to see!!

Thanks for reading !!!

Top comments (0)