This is just a simple program that after proper configuration will print out a list of transactions and plot a figure of cumulative spending.
The main file is spending_report.py and runs from command line like so:
spending_report.py
Required:
--institution <financial institution nickname>
Optional
--trend_file <a filename/path to save image>
--ofx_file <an xml formatted ofx file>
--start <date in mm/dd/yyyy>
--end <date in mm/dd/yyyy>
--config <path to ofxget config file>
--goal <a spending amount for the week>
ofxtools matplotlib bs4 keyring numpy
Configuring ofxget is pretty well documented here ofxtools doc
Here are two simple curl scripts to post and get info from an ofx server be sure to modify the header for your use. curl_get_sample.sh curl_post_sample.sh
An example of the xml config you will be dealing with ofx_chase_sample.xml
If you have trouble installing ofxget see my specific instructions for chase & Citi credit cards. Even if you do not have accounts at those institutions they can provide some relavent details.
Once installed and configured properly in ~/.config/ofxtools/ofxget.cfg You can run
$ ofxget stmt <institution nickname>
typically prompts for password. Enter it and you will get an xml response of ofx data.
We can store the password with keyring
$ pip install keyring
$ pip install keyrings.alt
note: '.alt' only necessary for WSL, which is my setup
then run:
$ ofxget stmt <bank/cc name> --savepass
will store the entered password
rerunning --savepass will store a new password
Because the documentation is not super great, here are the simple steps for adding Citi Credit Card accounts, and chase credit card accounts. I authorized 3 accounts, and the process was different each time. I configured Citi credit card, chase credit card, and wells fargo bank. Wells fargo bank charges a few bucks a month for the ofxget access. So proceed at your discretion
Caveat: They are subject to change at anytime.
For Citi CC
-
login online
-
click Profile
-
click More Settings
-
under Security click Manage desktop apps
-
click Add access
-
a timer will start (10 mins)
-
add this to ~/.config/ofxtools/ofxget.cfg
[citi] FID = 24909 ORG = Citigroup URL = https://mobilesoa.citi.com/CitiOFXInterface user = <user name> clientuid = <uuid you generated> creditcard = <cc number> appid = QWIN appver = 2500 version = 103
-
make a stmt request
$ ofxget stmt citi
voila!
-
you will see that an app has been added, mine says Quicken.
For Chase CC
-
login online
-
click the Main menu (three horizontal bars icon)
-
click Profile & Settings
-
click AccountSafe^tm
-
click Desktop software
-
click Set up/enable
-
follow simple wizard
-
make ofx.chase.com POST using curl
-
Response
<OFX> ... <MESSAGE> Please verify your identity within the next 7 days. Using your desktop computer, go to your bank's website and visit the Secure Message Center for instructions. ... </OFX>
-
wait < 5 mins
-
login online
-
click Main menu
-
click Secure messages
-
click the message with subject "Action Required for Quicken or QuickBooks users"
-
click "confirm your identity now" & follow short wizard
-
add this to ~/.config/ofxtools/ofxget.cfg
[chase] clientuid = <uuid you generated> user = <username> creditcard = <cc number> appver = 2700 version = 220
-
make a stmt request
$ ofxget stmt chase
voila!