It has been many years since I wrote software code for a living, and maybe ten since I last dabbled.

The dabbling was building a database of stock and futures prices using Groovy and the lightweight H2 database. I had a fairly robust application and a good block of historical data when I ran into a couple of problems. The goal of the database was to calculate the relative strength of a stock or future against its peers, as described by Tom Dorsey in his book Point and Figure Charting. At that time, I couldn’t find a Groovy or Java application that allowed me to calculate the results I needed – bad planning on my part as I couldn’t get my head round how to write the code. The second problem was that H2 changed their database structure and for the life of me I couldn’t work out how to migrate.

As a result, the project just sat there with nothing happening. I’m still collecting the raw price data, but right now it sits in flat files on my hard drives and backups.

About three years ago, I dusted off my coding gloves and used Python to manipulate some health care data for a project I was working on. Now Python as I suspect most reading this know, is incredibly powerful and has a host of open source libraries available to the developer. One of those libraries matplotlib has a whole set of finance utilities. I looked at the library, and put my notes aside but the thought of it never really left my mind.

This past week, I pulled out the old Groovy scripts and looked at migrating them to Python. I rethought exactly what I had been looking to do that first time and scaled back a lot of the calculations that weren’t really necessary. The refactoring ended up being much easier than I expected. And fast. Over 200,000 rows into a SQLITE database in about five seconds!

I also found some interesting and illuminating thoughts in Jeremy Du Plessis’s book The Definitive Guide to Point and Figure. I still need to think through the calculation routines based on his writing, but I may not need matplotlib after all!