Tue, 17 Nov 09

Converting Egg Statements and Transactions to Ofx

Wow, it was around two and half years ago that I first hacked together a little utility to do this. I’ve pretty much neglected the code since then but have always intended to get back to it. Over the last week or so I’ve done just that (egg2ofx on github).

I’d like to think that this version is a little more usable. You can install it as a gem for a start.

$ gem install egg2ofx --source http://gemcutter.org

With that, you get a nice little binary that you can use to convert a downloaded copy of your statement or recent transactions.

$ egg2ofx downloaded-statement.html > egg-statement.ofx

As if that wasn’t enough, I’ve also created a little web service that exposes the conversion functionality over http. Assuming you’ve got ruby and curl (and probably other stuff) installed you should be able to do something like this to try it out.

$ cat downloaded-statement.html | ruby -rcgi -e "puts 'documentHtml=' + CGI.escape(STDIN.read)" | curl http://egg2ofx.seagul.co.uk -d@-

Where we pipe the content of the downloaded statement into a single line ruby script that constructs the key/value pair that we need to send to the service and pipes that into curl that actually makes the POST request (the magic -d@- means, read from stdin).

The final little treat is a greasemonkey script that adds a button to the egg transactions and statement pages allowing you to download them as Ofx right there. Whoah.

VERY IMPORTANT If you happen to use the greasemonkey script, or manually send your data to the web service, you should be aware that you’re sending your account details (including account number, balance and transactions) IN THE CLEAR to my server. I certainly won’t keep any logs of what gets sent but I can’t promise the same thing of any of the servers in between your computer and my server. I might see if I can get an SSL certificate installed but, unless I can get one freely or incredibly cheaply, you shouldn’t hold out much hope for this.

A much better idea would be to install the web service on your own machine. I don’t know how this might work on Windows but the combination of Apache, passenger and the passenger preference pane make it trivial on a Mac. There are instructions to get the web service installed locally on github, along with instructions to change the server that the greasemonkey script sends the data to.