How I use Python to accelerate currency conversion

This is the second post in series where I talk about how I use Python programming language to speed up some of my everyday activities. The first one has been written on a Linkedin and in that blog post I explain how I wrote a small Python script which helps me format the books I read

If you are interested in reading it, you can check it here.The main idea I am trying to convey here, is thinking about how to approach certain problems or actions that we need to take. In my primary job as a verification engineer, automation is often very preferable, but there are many areas in our everyday life, which could be automated as well.

 

I am not saying every person should learn Python in order to do that of course, there are other possibilities, but having the right mindset and making things more effective is always desirable.In this blog post, I will explain one very specific action which I need to do once a month and how I realized it can be automated, to a certain extent.


Every month I perform multiple paymets related to taxes, various insurrances and the usual monthly bills. Some of these require of me to convert X amount of euros to dinars (Serbian currency) and then type that amount into the mobile bank app. Now, for a single conversation I need to do the following:

  • Go to the national bank website and check currency rate.
  • Convert specific amount of dinars to euros.
  • Type the amount into mobile bank app.
  • Repeat again for the next payment.

As soon as I “detect” something that can be automated, I try to think of a way of doing it. In my everyday job as a verification engineer, automation usually means writing some script which will parse logs for me, generate specific file or calculate the total memory I occupy, to name a few. But in this case, I needed something in my everyday life. I decied to write Python script which will do the conversion for me, without me having to do all the borring steps above.Right from the beginning of this challenge, I decided my program has to satisfy two requirements:


  • I want it to be executable, so I can just click on it on my desktop.
  • It has to show my results in a GUI, not the typical cryptic message in some terminal, as most program outputs look like.

Having in mind what I want to achieve, it was easy to focus my efforts. However, problem was that I didn’t how to implement either of the above requrements, so I went onto learning how to produce executable from the usual Python program and how to produce “GUI-like” output.
This is one of the reason why I like mini-adventures like this.  They essentially make me improve myself, learn new things, work on my focus and concentration and generally explore new stuff. 

Once we understand we can learn anything, we will be able to achieve everything. 

<- I just came up with this sentence and realized it’s so cool, that I will put in the book I plan to write in the future. :)Anyway, without going into all the technical details, as this post would then become way too long and borring, eventually I managed to do it. Along the way I’ve learned many new things, because both of the above requirements (executable and GUI) produced themselves many separate learning threads.
Executable file now sits on my desktop nicely:

And the best part, one click (double click, to be precise), will produce the results I need:

In this specific case I needed only a few conversions, so one can argue that doing all the work manually is not a big deal. However, my solution is completelly scalable – imagine you needed ten or more conversions. Wouldn’t it be nice to have them all delivered to you with a two mouse clicks?


To conclude, I personally love setting mini goals and challenges like this for myself. The initial idea usually branches into quite a new few things I need to learn along the way and that is one of my missions – never to stop learning.Do you have some tips how to automate and speed things up? Please share in comments, so we can all learn something new.

You may also like

Programming
Milos

qa$F.d0xjq

In this blog I share a quick VIM tip how to extract parts of instance path. This may be particularly useful in large files with lots of lines.

Read More »
Join my Mailing list!