Archive for May 11th, 2017

Speaking OFX Using Go

Thursday, May 11th, 2017

I’ve been working on a web-based mint.com/Gnucash/Quicken clone I’m calling ‘moneygo‘ off and on in my spare time. One important feature of these types of programs is the ability to automatically import transaction and balance information from a user’s financial institution. In the US, this functionality is primarily supported by banks via the OFX specification.

I spent some time exploring my options and was unable to find an OFX library written in Golang capable of not only parsing OFX responses, but generating the request files as well. Generating the request file is important because otherwise the user must obtain the OFX file out-of-band (i.e. most likely logging into their bank and downloading it with a web browser). It is much more convenient for your financial management software to do this automatically for you. I actually ended up briefly using libofx before deciding that the C-to-Go interface was too awkward to make it a reasonable solution – converting complex types from C to Go is not fun.

So, I did what any self-respecting programmer would do – downloaded the OFX spec and wrote my own OFX generator and parser in Go: ofxgo. This process was somewhat tedious at times(there are a lot of OFX elements, particularly for investment transactions), and I didn’t implement nearly all of the spec. However, the result is a library that I’ve been able to use to download bank, credit card, and investment transactions and balances for all of my financial institutions! Along the way, I also created a sample Golang command-line client which can be used to test the library with your bank, download and/or parse OFX, or even to help detect the correct settings to use with your bank.

I hope my ofxgo library will enable others to more easily access their financial data using OFX, and am looking forward to getting it fully integrated with moneygo. Don’t hesitate to let me know if you find bugs or would like to see improvements in this library by creating an issue or pull request on github.