ofxparse

It's been a while (June 29, 2016)
ofxparse 0.15 is up, with more changes than you can shake a stick at.  Unless you're really good at shaking a stick.  Then maybe not.  We have our first utility program called ofx2xls which takes an ofx file and converts it to a reasonably formatted Excel spreadsheet (thanks Ehud Ben-Reuven!).  Enjoy!

Gosh, well that was cool 
(Aug 13, 2013)
ofxparse 0.12 is up on Pypi.  There have been some truly amazing people adding capabilities to ofxparse, and I can't thank them enough!  Python 3 support has arrived (thanks jaraco)!  Reading and writing ofx files using the new ofxutil module (thanks Jzar)!  Support for fast fail on parse errors!  On the fly decoding of MCC bank codes!  Oh my!

Another day, another language (October 27, 2012)
ofxparse version 0.9 is up on Pypi.  This release supports Japanese files via UTF-8 and stock positions in addition to several bugfixes.  Enjoy!

Contributors make ofxparse the success it is (April 8, 2012)
Thanks to the hard work of contributors like Richard Guyofxparse 0.8 is available on Pypi with the ability to continue parsing OFX files in the face of errors.  Error handling in general is much improved.  I'm also excited to learn that Wave Accounting is using ofxparse for parsing OFX files!  When I started this project I dreamed that one day people would be using it and it is exciting to see more users with each new release! :)

A new year, a new ofxparse release
ofxparse version 0.6 is up on Pypi.  This release has improvements to investment statements thanks to rkhwaja on github, as well as some other minor changes.  Enjoy!

Oops.
I just released ofxparse version 0.5 on Pypi, after someone alerted me to the fact that it crashed on all investment files.  I need more unit tests. :)  Thanks for the heads up, Saravanan!

Celebrate!

Thanks to contributions from Eric and Leonardo and, well, almost a gaggle of people, ofxparse version 0.4 supports credit card statements and statements from some Brazilian banks!  Hooray!  You can find ofxparse version 0.4 on the Cheeseshop, available for Python 2.4 through Python 2.7! 

What is it?


ofxparse is a Python library that parses .ofx files.  Ofx files are used for exchanging financial information like account statements.  These files are available from banks, credit card companies and trading accounts.

OFX stands for Open Financial Exchange.

Why is it better than X?

Well, uh... you see... I think this is the only library like this for Python.  So it's the best!  Yay!

How to install (you know you wanna)

ofxparse installs using setuptools or distribute.  If you have those installed, you can do:

easy_install ofxparse

If you don't have setuptools or distribute, you can use the files listed below and install them manually.  If you do this, you'll also need to have the BeautifulSoup python package installed as well.

Documentation

How to parse a file:
from ofxparse import OfxParser

ofx = OfxParser.parse(file('file.ofx'))
ofx.account # An account with information
ofx.account.number # The account number
ofx.account.routing_number # The transit id (sometimes called branch number)
ofx.account.statement # Account information for a period of time
ofx.account.statement.start_date # The start date of the transactions
ofx.account.statement.end_date # The end date of the transactions
ofx.account.statement.transactions # A list of account activities
ofx.account.statement.balance # The money in the account as of the statement date
ofx.account.statement.available_balance # The money available from the account as of
# the statement date

...and that's it!

The full documentation (such as it is) is available at the GitHub ofxparse page.

Downloads

You can download the files from the PyPi ofxparse page.  It's easier to use easy_install, though.

Development

Development happens on the GitHub ofxparse page.  I accept bug reports and patches by email, carrier pigeon and the ofxparse issues list, or by a pull request.