Database Generator for OFX Financial Statement Data, by Finarrow.
ofxdb
is a Python package providing ETL infrastructure needed
to create a database of personal financial data. It uses
ofxtools to connect to financial institutions and retrieve
ofx files that are parsed into various csv files. The
project's goal is to serve as the basis for making better personal
finance decisions by providing a seamless and safe way to aggregate
your account history across any financial institution and make the
data available for you to analyze.
These are few things that ofxfdb
does in its current state:
- Parse
ofxtools
account config file - Retrieve ofx files for all accounts in the
ofxtools
account config - Transform
ofxtools
account info and statement objects into csv files and save to disk - Aggregate data into various views
The source code is currently hosted on GitHub at: https://github.com/finarrow/ofxbd
Binary installer for the latest released version is available at the Python package index.
pip install ofxdb
Set up your account credentials in your system keyring using the
ofxtools
command line tool ofxget
. Do this for all accounts you would
like to aggregate data for. You will be prompted in the command line to
enter your password.
ofxget acctinfo <server_nickname> -u <your_username> --write --savepass
You can get a list of available server nicknames as follows:
ofxget list
Check out the ofxtools documentation if you have any issues using ofxget
.
Use the generate script to build the tables.
python ofxdb/data/generate.py
Use the view script to generate views on the data.
Only the risk view is supported at the moment.
If you have an idea for a new view open an issue against ofxdb
on GitHub
python ofxdb/view.py -view risk
Date | YYYY-MM-DD |
---|---|
MV($) | 100,000.00 |
GrossMV($) | 150,000.00 |
BAGMV($) | 120,000.00 |
NetMV($) | 90,000.00 |
NetGrossMV($) | 140,000.00 |
Gross(%) | 150.00 |
BAG(%) | 120.00 |
NetMV(%) | 90.00 |
NetGrossMV(%) | 140.00 |
Note: the risk view relies on data in the exposures auxiliary table. For the time being this is manually generated and supports most liquid US listed ETFs (including levered ETFs). Feel free to open a PR to add support for more securities.
Use -h to see available views and modifiers.
python ofxdb/view.py -h
Account information
Investment statements
To do:
Bank statements
Tax statements
Generates 5 csv files in your $HOME directory as follows:
$HOME/ofxdb/account_info.csv
$HOME/ofxdb/positions.csv
$HOME/ofxdb/transactions.csv
$HOME/ofxdb/balances.csv
$HOME/ofxdb/securities.csv
For more details, take a look at the tables guide, column definitions and table samples.
ofxdb
is well-tested with TD Ameritrade accounts that hold only stocks and ETFs.
By design ofxdb
should work well for any broker that you can connect to with ofxtools
and
for any security types supported by the ofx protocol.
If you encounter any issues, please open an issue against ofxdb
on GitHub.
In its current version, ofxdb
only works on linux and linux-based systems (including OSX).
Support for Windows is in the scope of the project and will come in a future version.
Discuss ofxdb
on the Finarrow community Slack
We welcome your contributions. To file a bug, suggest an improvement, or
request a new feature please open an issue against ofxdb
on GitHub.