• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

ofxparse/H01-Dec-2018-2,5522,252

ofxparse.egg-info/H03-May-2022-200149

tests/H01-Dec-2018-2,3992,176

AUTHORSH A D01-Dec-2018401 2927

LICENSEH A D01-Dec-20181 KiB2319

MANIFEST.inH A D01-Dec-201859 32

PKG-INFOH A D01-Dec-20186.7 KiB200149

README.rstH A D01-Dec-20184.5 KiB177127

setup.cfgH A D01-Dec-2018116 96

setup.pyH A D01-Dec-20181.9 KiB6350

README.rst

1ofxparse
2========
3
4ofxparse is a parser for Open Financial Exchange (.ofx) format files.  OFX
5files are available from almost any online banking site, so they work well
6if you want to pull together your finances from multiple sources.  Online
7trading accounts also provide account statements in OFX files.
8
9There are three different types of OFX files, called BankAccount,
10CreditAccount and InvestmentAccount files.  This library has been tested with
11real-world samples of all three types.  If you find a file that does not work
12with this library, please consider contributing the file so ofxparse can be
13improved.  See the Help! section below for directions on how to do this.
14
15Example Usage
16=============
17
18Here's a sample program
19
20.. code:: python
21
22  from ofxparse import OfxParser
23  with codecs.open('file.ofx') as fileobj:
24      ofx = OfxParser.parse(fileobj)
25
26  # The OFX object
27
28  ofx.account               # An Account object
29
30  # AccountType
31  # (Unknown, Bank, CreditCard, Investment)
32
33  # Account
34
35  account = ofx.occount
36  account.account_id        # The account number
37  account.number            # The account number (deprecated -- returns account_id)
38  account.routing_number    # The bank routing number
39  account.branch_id         # Transit ID / branch number
40  account.type              # An AccountType object
41  account.statement         # A Statement object
42  account.institution       # An Institution object
43
44  # InvestmentAccount(Account)
45
46  account.brokerid          # Investment broker ID
47  account.statement         # An InvestmentStatement object
48
49  # Institution
50
51  institution = account.institution
52  institution.organization
53  institution.fid
54
55  # Statement
56
57  statement = account.statement
58  statement.start_date          # The start date of the transactions
59  statement.end_date            # The end date of the transactions
60  statement.balance             # The money in the account as of the statement date
61  statement.available_balance   # The money available from the account as of the statement date
62  statement.transactions        # A list of Transaction objects
63
64  # InvestmentStatement
65
66  statement = account.statement
67  statement.positions           # A list of Position objects
68  statement.transactions        # A list of InvestmentTransaction objects
69
70  # Transaction
71
72  for transaction in statement.transactions:
73    transaction.payee
74    transaction.type
75    transaction.date
76    transaction.amount
77    transaction.id
78    transaction.memo
79    transaction.sic
80    transaction.mcc
81    transaction.checknum
82
83  # InvestmentTransaction
84
85  for transaction in statement.transactions:
86    transaction.type
87    transaction.tradeDate
88    transaction.settleDate
89    transaction.memo
90    transaction.security      # A Security object
91    transaction.income_type
92    transaction.units
93    transaction.unit_price
94    transaction.comission
95    transaction.fees
96    transaction.total
97    transaction.tferaction
98
99  # Positions
100
101  for position in statement.positions:
102    position.security       # A Security object
103    position.units
104    position.unit_price
105    position.market_value
106
107  # Security
108
109  security = transaction.security
110  # or
111  security = position.security
112  security.uniqueid
113  security.name
114  security.ticker
115  security.memo
116
117
118Help!
119=====
120
121Sample ``.ofx`` and ``.qfx`` files are very useful.  If you want to help us out,
122please edit all identifying information from the file and then email it to
123jseutter dot ofxparse at gmail dot com.
124
125Development
126===========
127
128Prerequisites::
129  # Ubuntu
130  sudo apt-get install python-beautifulsoup python-nose python-coverage-test-runner
131  # Python 3 (pip)
132  pip install BeautifulSoup4 six lxml nose coverage
133  # Python 2 (pip)
134  pip install BeautifulSoup six nose coverage
135
136The `six` package is required for python 2.X compatibility
137
138Tests:
139Simply running the ``nosetests`` command should run the tests.
140
141.. code:: bash
142
143  nosetests
144
145If you don't have nose installed, the following might also work:
146
147.. code:: bash
148
149  python -m unittest tests.test_parse
150
151Test Coverage Report:
152
153.. code:: bash
154
155  coverage run -m unittest tests.test_parse
156
157  # text report
158  coverage report
159
160  # html report
161  coverage html
162  firefox htmlcov/index.html
163
164
165Homepage
166========
167| Homepage: https://sites.google.com/site/ofxparse
168| Source: https://github.com/jseutter/ofxparse
169
170License
171=======
172
173ofxparse is released under an MIT license.  See the LICENSE file for the actual
174license text.  The basic idea is that if you can use Python to do what you are
175doing, you can also use this library.
176
177