diff --git a/.gitignore b/.gitignore index e5ca2e7b..db33c71f 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ beancount_import/frontend_dist .coverage htmlcov/ .*.ofx +*~ diff --git a/README.md b/README.md index b02c0210..1df42bb8 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,15 @@ each other and with existing transactions. - Pluggable data source architecture, including existing support for OFX (cash, investment, and retirement accounts), Mint.com, Amazon.com, and Venmo. +- Due to the existing OFX support and the tool + [ofxstatement](https://github.com/kedder/ofxstatement) it is very easy to + import any financial source provided there is an ofxstatement plugin for + it. Currently the plugin ofxstatement-dutch is part of the setup allowing + you to convert ICSCards PDF files (or PDF converted to TEXT) to an OFX + file. Please note that you need to have the pdftotext utility to convert PDF + to TEXT, please follow the instructions of the [ofxstatement-dutch + README](https://github.com/gpaulissen/ofxstatement-dutch). + - Robustly associates imported transactions with the source data, to automatically avoid duplicates. @@ -124,6 +133,8 @@ The currently supported set of data sources is: [Morgan Stanley StockPlan Connect](https://stockplanconnect.com). - [beancount_import.source.ultipro_google](beancount_import/source/ultipro_google.py): imports Google employee Ultipro payroll statements. +- [beancount_import.source.icscards](beancount_import/source/icscards.py): + imports ICSCards PDF files (after converting them to an OFX file). Refer to the individual data source documentation for details on configuration. @@ -131,8 +142,9 @@ Refer to the individual data source documentation for details on configuration. To run Beancount-import, create a Python script that invokes the `beancount_import.webserver.main` function. Refer to the examples -[fresh](examples/fresh/run.py) and -[manually_entered](examples/manually_entered/run.py). +[fresh](examples/fresh/run.py), +[manually_entered](examples/manually_entered/run.py) and +[convert2ofx](examples/convert2ofx/run.py). ## Errors diff --git a/examples/convert2ofx/accounts.beancount b/examples/convert2ofx/accounts.beancount new file mode 100644 index 00000000..e72a0e27 --- /dev/null +++ b/examples/convert2ofx/accounts.beancount @@ -0,0 +1,5 @@ +1900-01-01 open Liabilities:Credit-Card EUR + ofx_org: "" + ofx_broker_id: "" + ofx_account_type: "cash_only" + account_id: "99999999999" diff --git a/examples/convert2ofx/ignored.beancount b/examples/convert2ofx/ignored.beancount new file mode 100644 index 00000000..e69de29b diff --git a/examples/convert2ofx/journal.beancount b/examples/convert2ofx/journal.beancount new file mode 100644 index 00000000..9b1b6182 --- /dev/null +++ b/examples/convert2ofx/journal.beancount @@ -0,0 +1,3 @@ +include "accounts.beancount" +include "transactions.beancount" +include "prices.beancount" diff --git a/examples/convert2ofx/prices.beancount b/examples/convert2ofx/prices.beancount new file mode 100644 index 00000000..e69de29b diff --git a/examples/convert2ofx/run.py b/examples/convert2ofx/run.py new file mode 100644 index 00000000..f4516438 --- /dev/null +++ b/examples/convert2ofx/run.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python3 + +import glob +import os +import json +import sys + +from beancount_import.source.ofx import convert2ofx + +def run_reconcile(extra_args): + import beancount_import.webserver + + journal_dir = os.path.dirname(__file__) + data_dir = os.path.join(os.path.dirname(__file__), '..', '..', 'testdata', 'source', 'icscards') + force = False + + data_sources = [ + dict( + module='beancount_import.source.ofx', + ofx_filenames=( + convert2ofx('nl-icscards', glob.glob(os.path.join(data_dir, 'icscards.txt')), force) + ), + checknum_numeric=lambda ofx_filename: False, + check_balance=lambda ofx_filename: False, + ), + ] + + beancount_import.webserver.main( + extra_args, + journal_input=os.path.join(journal_dir, 'journal.beancount'), + ignored_journal=os.path.join(journal_dir, 'ignored.beancount'), + default_output=os.path.join(journal_dir, 'transactions.beancount'), + open_account_output_map=[ + ('.*', os.path.join(journal_dir, 'accounts.beancount')), + ], + balance_account_output_map=[ + ('.*', os.path.join(journal_dir, 'accounts.beancount')), + ], + price_output=os.path.join(journal_dir, 'prices.beancount'), + data_sources=data_sources, + ) + + +if __name__ == '__main__': + run_reconcile(sys.argv[1:]) diff --git a/examples/convert2ofx/transactions.beancount b/examples/convert2ofx/transactions.beancount new file mode 100644 index 00000000..e69de29b