Friday, February 6, 2009

Project Report: Midas


So that just leaves Midas, my most recent project.

Okay, some of you have read Gods Tomorrow already, and you're not allowed to snicker. I needed a name, I had just finished writing the book, and it was an easy grab. I don't have delusions of grandeur or anything, I just had to call it something.

Anyway, starting...I don't know, two or three years ago -- maybe even four -- I discovered our family's finances were too complicated for me to keep track of them in my head (or even just online) and finally started for the first time trying to keep a balanced checkbook.

We didn't bother trying to do it in a checkbook, though, because we've never really paid for much of anything with checks. Instead, I pulled up an Excel spreadsheet, stuck Sunday in the far left column and Saturday in the far right, and made a copy of that tab for each week in the month. Then, on the first one, I plugged in our starting bank balance on the first page, and on each tab after that (and each new spreadsheet, as month rolled into month) I would import the ending balance from the end of the previous tab.

So I had two columns for each day of the week, and I would put dollar amounts in the first column (positive for deposits and negative for debits), and then a brief description of the transaction in the second column ("Groceries at Wal-Mart" or "Cash at ATM" or whatever).

Then every six months or so we'd hit a financial crisis, and after the dust cleared I would go back and try to figure out where all our money had been going, so I would open up six months worth of spreadsheets, and manually find and add all of the Grocery entries from the spreadsheets to a column in a new one, so I could do a report, and the same for all the allowance expenses, and bills, and so on. It was always hours and hours of work, and I knew there should be a better way (which I assumed had to do with using Access instead of Excel), but I never felt like putting in the time to design a database -- and learn how to use it.

Well...that left me making a new spreadsheet every month, copying over an old one and going through manually to reposition dates and paydays and whatever might have changed, and then filling it out every couple days. In December of last year, I'd already worked ahead for a few months to get a financial prediction, so I probably had forty-five or so spreadsheets, spread across the years, tracking our financial history (and with predictions into the future so I could schedule credit card payments and budget long-term expenses like car repairs), and all of that was stolen when we were robbed.

Ugh.

I had a backup from November of 2007, but it wasn't much help. Our regular monthly expenses had changed enough since then, as well as some of my format, that I didn't much feel like putting in the work to revive a shambling, unpleasant system anyway.

I figured what I should do was learn Quicken or Microsoft Money or something, but in that first week after we were robbed, the not knowing about our finances kept getting under my skin.

So one day, during lunch, I decided to see what I could do. I threw together a quick GUI in Python's built-in GUI manager, and with less than twenty minutes I was able to make it look pretty much exactly like my Excel spreadsheets had. Then I grabbed some sample data -- we had closed out our old account as an aftermath of the robbery and started a new one, so there was a pretty small set of data to get me fully up-to-date, which was nice. I built a rough database, threw that information in there,, and within an hour total I had it navigating week-to-week, and displaying a Transactions database as though I had entered it all manually on one of my old Excel spreadsheets.

Of course, the real benefit was that it was no longer a spreadsheet, but a real, relational database. Even if it looked the same, I could easily write a one-line query to grab all of the "Groceries" entries in the database for the last month and give me the total we spent on it. What I used to do over the course of hours could be done in seconds now.

I worked with it more, polishing the GUI more than anything else, over the course of several weeks. I got lots of help from K--, who is a SQL master, and some from Toby without actually telling him what I was up to (not that I was deliberately keeping it a secret, but it never came up). Anyway, I completely redesigned the database a couple times, adding tables and replacing names with IDs and all the sorts of things a good SQL administrator does to optimize performance.

One cool thing I did was implement "virtual accounts" (I call them RollingBalances within the code), for things like allowances and those long-term car repair savings. Basically, every week I allot (as an example) $80 for groceries, $80 for entertainment, and $30 for gas. If some of that doesn't get used one week, it probably will the next. This is even more true for things like our allowances ($80 a month, each), which we sometimes save up for larger purchases, or car repairs (also $80 a month) which might accrue for months before it disappears all at once (and then some) as soon as we have to go to a mechanic.

We don't do the coffee jars or envelopes techniques for this money, and we certainly don't have multiple bank accounts. We just keep it all in one big balance in our checking account, and I would try in vain to track what was spent where, out of which balance.

My new software does all that for me. Every week I do a handful of cash transfers into our weekly RollingBalances (groceries, gas, entertainment) and on the first of every month I do the monthly ones (allowances, car repairs, and gifts), and as soon as I do that, my total balance shows that the money has been spent, so I won't budget it for anything else. Then any money spent out of the RollingBalances (as long as their total is still positive) comes out of them but not out of my total balance. If the RollingBalance goes negative, though, that extra is taken out of my total balance. It works really well.

It also lets me print out a report of the total in each of those RollingBalances, which I have as a separate frame at the bottom of my main GUI. It makes it easy to keep track of where our money is going, every time I open it up.

I also use something called Virtual Transactions. In my old spreadsheet days, I would mark future entries (like a guess on what next month's electric bill is going to be) with a yellow highlight, so I would know that entry still needed to be corrected. Then, once I got the bill, I could schedule a payment for the actual amount online, and then correct the entry in my spreadsheet and change it back to no highlight, or a white background.

I preserved that functionality in Midas, by putting a boolean flag on every transaction of Virtual. If a transaction is Virtual, it automatically shows up with a yellow background in the program. If it's not, it's got a white background.

That's helpful to me when I'm analyzing the report, but it gave me some other options, too. The biggest one is that I can print out a constant "Actual balance" which only takes into account non-virtual entries. That way I can look forward three week and see what our calculated balance will be if we make all of the virtual transactions I anticipate (including deductions for allowances and whatnot), but I can also check at a glance to see what our actual balance should be right now, and confirm that against my bank's website. It's very cool.

That's where the software is now, and I've been using it regularly since late December when I got it to that state. I've made a few small tweaks in the meantime, but nothing dramatic (apart, of course, from updating the database with our regular transactions).

Oh! I did make a big change this week. I automated so that whenever I browse forward to a week I haven't visited yet, it automatically asks me if I want to install some default transfers to my RollingBalances. Same thing when I visit a page that has the first day of a new month on it -- if there's no transfer into our allowances or car repairs on it, the program automatically asks me if I want it to fill them in. Very nice.

I'd like to add copy and paste, because there's some very common expenses that aren't quite common enough to automate that way. I'd also like to clean up the GUI some, including a major conversion to add the option of a ledger-style interface as opposed to the calendar-style I've been using. Something that would be really nice is cell-phone-friendly web reports, but I've been told it takes some complicated work to get a webserver running, so that might be beyond the scope of my interest.

I had a lunch with Toby early last month, and as I was briefly running through the list of all my programming projects, this was the one that caught my mind. So I sent him everything I had so far, and he immediately had some great suggestions, and even volunteered to get to work on one of them, but right after that he got sick for a week.

So I expect I'll continue to see some progress on this one, even though I don't really take it as seriously as I should. Still, K-- and Toby both continue to show interest in it, and they're precisely the kind of guys I expected to say, "There's already a thousand of those programs on the internet, just use one of them." So maybe this is worth my time after all.

Status: In Development

No comments:

Post a Comment