Package: ofxparse
ofxparseofxparse is a parser for Open Financial Exchange (.ofx) format files.  OFX
files are available from almost any online banking site, so they work well
if you want to pull together your finances from multiple sources.  Online
trading accounts also provide account statements in OFX files.There are three different types of OFX files, called BankAccount,
CreditAccount and InvestmentAccount files.  This library has been tested with
real-world samples of all three types.  If you find a file that does not work
with this library, please consider contributing the file so ofxparse can be
improved.  See the Help! section below for directions on how to do this.Example UsageHere’s a sample programfromofxparseimportOfxParserwithcodecs.open('file.ofx')asfileobj:ofx=OfxParser.parse(fileobj)# The OFX objectofx.account# An Account object# AccountType# (Unknown, Bank, CreditCard, Investment)# Accountaccount=ofx.accountaccount.account_id# The account numberaccount.number# The account number (deprecated -- returns account_id)account.routing_number# The bank routing numberaccount.branch_id# Transit ID / branch numberaccount.type# An AccountType objectaccount.statement# A Statement objectaccount.institution# An Institution object# InvestmentAccount(Account)account.brokerid# Investment broker IDaccount.statement# An InvestmentStatement object# Institutioninstitution=account.institutioninstitution.organizationinstitution.fid# Statementstatement=account.statementstatement.start_date# The start date of the transactionsstatement.end_date# The end date of the transactionsstatement.balance# The money in the account as of the statement datestatement.available_balance# The money available from the account as of the statement datestatement.transactions# A list of Transaction objects# InvestmentStatementstatement=account.statementstatement.positions# A list of Position objectsstatement.transactions# A list of InvestmentTransaction objects# Transactionfortransactioninstatement.transactions:transaction.payeetransaction.typetransaction.datetransaction.user_datetransaction.amounttransaction.idtransaction.memotransaction.sictransaction.mcctransaction.checknum# InvestmentTransactionfortransactioninstatement.transactions:transaction.typetransaction.tradeDatetransaction.settleDatetransaction.memotransaction.security# A Security objecttransaction.income_typetransaction.unitstransaction.unit_pricetransaction.comissiontransaction.feestransaction.totaltransaction.tferaction# Positionsforpositioninstatement.positions:position.security# A Security objectposition.unitsposition.unit_priceposition.market_value# Securitysecurity=transaction.security# orsecurity=position.securitysecurity.uniqueidsecurity.namesecurity.tickersecurity.memoHelp!Sample.ofxand.qfxfiles are very useful.  If you want to help us out,
please edit all identifying information from the file and then email it to
jseutter dot ofxparse at gmail dot com.DevelopmentPrerequisites::# Ubuntu
sudo apt-get install python-beautifulsoup python-nose python-coverage-test-runner
# Python 3 (pip)
pip install BeautifulSoup4 six lxml nose coverage
# Python 2 (pip)
pip install BeautifulSoup six nose coverageThesixpackage is required for python 2.X compatibilityTests:
Simply running thenosetestscommand should run the tests.nosetestsIf you don’t have nose installed, the following might also work:python-munittesttests.test_parseTest Coverage Report:coveragerun-munittesttests.test_parse# text reportcoveragereport# html reportcoveragehtmlfirefoxhtmlcov/index.htmlHomepageHomepage:https://sites.google.com/site/ofxparseSource:https://github.com/jseutter/ofxparseLicenseofxparse is released under an MIT license.  See the LICENSE file for the actual
license text.  The basic idea is that if you can use Python to do what you are
doing, you can also use this library.