├── beancount_import ├── __init__.py ├── api_proxies │ ├── __init__.py │ └── beautifulsoup.py ├── frontend_dist │ └── index.html ├── posting_date.py ├── sorted_entry_printer.py ├── source │ ├── waveapps_test.py │ ├── healthequity_test.py │ ├── venmo_test.py │ ├── google_purchases_test.py │ ├── description_based_source_test.py │ ├── google_purchases_sanitize.py │ ├── mint_test.py │ ├── amazon_test.py │ ├── paypal_sanitize.py │ └── paypal_test.py ├── thread_helpers.py ├── sorted_list.py ├── training_test.py ├── unbook_test.py └── unbook.py ├── examples ├── fresh │ ├── ignored.beancount │ ├── prices.beancount │ ├── transactions.beancount │ ├── journal.beancount │ └── accounts.beancount ├── manually_entered │ ├── ignored.beancount │ ├── prices.beancount │ ├── journal.beancount │ └── accounts.beancount ├── data │ ├── importers │ │ ├── creditcard.csv │ │ └── bank.csv │ ├── venmo │ │ └── balances.csv │ └── mint │ │ └── mint.csv └── README.md ├── testdata ├── reconcile │ ├── test_basic │ │ ├── 0 │ │ │ ├── errors.json │ │ │ ├── ignore.beancount │ │ │ ├── journal.beancount │ │ │ ├── candidates.diff │ │ │ └── pending.beancount │ │ ├── 1 │ │ │ ├── errors.json │ │ │ ├── ignore.beancount │ │ │ ├── candidates.diff │ │ │ ├── pending.beancount │ │ │ └── journal.beancount │ │ └── 2 │ │ │ ├── candidates.diff │ │ │ ├── ignore.beancount │ │ │ ├── pending.beancount │ │ │ └── journal.beancount │ ├── test_ignore │ │ ├── 0 │ │ │ ├── errors.json │ │ │ ├── ignore.beancount │ │ │ ├── journal.beancount │ │ │ ├── candidates.diff │ │ │ └── pending.beancount │ │ ├── 1 │ │ │ ├── journal.beancount │ │ │ ├── ignore.beancount │ │ │ ├── candidates.diff │ │ │ └── pending.beancount │ │ ├── 2 │ │ │ ├── journal.beancount │ │ │ ├── candidates.diff │ │ │ ├── pending.beancount │ │ │ └── ignore.beancount │ │ └── 3 │ │ │ ├── candidates.diff │ │ │ ├── pending.beancount │ │ │ ├── journal.beancount │ │ │ └── ignore.beancount │ ├── test_amazon_large │ │ └── 0 │ │ │ ├── errors.json │ │ │ ├── ignore.beancount │ │ │ └── journal.beancount │ ├── test_ofx_basic │ │ └── 0 │ │ │ ├── errors.json │ │ │ ├── ignore.beancount │ │ │ ├── training_examples.json │ │ │ ├── journal.beancount │ │ │ ├── candidates.diff │ │ │ └── pending.beancount │ ├── test_ofx_cleared │ │ └── 0 │ │ │ ├── errors.json │ │ │ ├── ignore.beancount │ │ │ ├── training_examples.json │ │ │ ├── candidates.diff │ │ │ ├── pending.beancount │ │ │ └── journal.beancount │ ├── test_ofx_matching │ │ └── 0 │ │ │ ├── errors.json │ │ │ ├── ignore.beancount │ │ │ ├── training_examples.json │ │ │ ├── candidates.diff │ │ │ ├── pending.beancount │ │ │ └── journal.beancount │ ├── test_ofx_ignore_balance │ │ └── 0 │ │ │ ├── errors.json │ │ │ ├── training_examples.json │ │ │ ├── ignore.beancount │ │ │ ├── journal.beancount │ │ │ ├── candidates.diff │ │ │ └── pending.beancount │ └── test_ofx_ignore_price │ │ └── 0 │ │ ├── errors.json │ │ ├── training_examples.json │ │ ├── ignore.beancount │ │ ├── journal.beancount │ │ ├── candidates.diff │ │ └── pending.beancount ├── source │ ├── amazon │ │ ├── test_basic │ │ │ ├── accounts.txt │ │ │ ├── journal.beancount │ │ │ └── training_examples.json │ │ ├── test_prediction │ │ │ └── accounts.txt │ │ ├── test_cleared_and_invalid │ │ │ └── accounts.txt │ │ ├── test_credit_card_transactions │ │ │ ├── accounts.txt │ │ │ ├── training_examples.json │ │ │ └── journal.beancount │ │ ├── README.md │ │ └── de_DE │ │ │ ├── D22-9220967-2566135.json │ │ │ ├── D60-9825125-4795642.json │ │ │ ├── 447-6209054-6766419.json │ │ │ ├── 071-4816388-0694813.json │ │ │ ├── 075-2225405-7594823.json │ │ │ ├── 399-5779972-5007935.json │ │ │ ├── 256-0244967-2403944.json │ │ │ ├── 142-4912939-2196263.json │ │ │ └── 588-8509154-9761865.json │ ├── waveapps │ │ ├── test_basic │ │ │ ├── accounts.txt │ │ │ ├── journal.beancount │ │ │ ├── training_examples.json │ │ │ └── import_results.beancount │ │ ├── test_matching │ │ │ ├── accounts.txt │ │ │ ├── training_examples.json │ │ │ ├── journal.beancount │ │ │ └── import_results.beancount │ │ ├── 10000001.jpg │ │ ├── 12345678.jpg │ │ ├── 12345678.json │ │ └── 10000001.json │ ├── paypal │ │ ├── test_basic │ │ │ ├── journal.beancount │ │ │ ├── training_examples.json │ │ │ └── accounts.txt │ │ ├── de_DE │ │ │ └── test_basic │ │ │ │ ├── journal.beancount │ │ │ │ ├── training_examples.json │ │ │ │ └── accounts.txt │ │ ├── test_matching │ │ │ └── accounts.txt │ │ ├── README.md │ │ ├── 5TO8EO8C4DZE4QCC7.json │ │ ├── LZ63BPLO2CIA3MUIG.json │ │ └── 266LYBQVWC7P8PXV0.json │ ├── venmo │ │ ├── test_basic │ │ │ ├── journal.beancount │ │ │ ├── training_examples.json │ │ │ └── accounts.txt │ │ ├── test_matching │ │ │ ├── accounts.txt │ │ │ └── import_results.beancount │ │ ├── test_invalid_references │ │ │ ├── accounts.txt │ │ │ └── import_results.beancount │ │ ├── balances.csv │ │ └── transactions.csv │ ├── google_purchases │ │ ├── test_basic │ │ │ ├── accounts.txt │ │ │ ├── journal.beancount │ │ │ ├── training_examples.json │ │ │ └── import_results.beancount │ │ ├── test_invalid │ │ │ ├── accounts.txt │ │ │ ├── training_examples.json │ │ │ ├── import_results.beancount │ │ │ └── journal.beancount │ │ ├── test_matching │ │ │ ├── accounts.txt │ │ │ ├── training_examples.json │ │ │ ├── import_results.beancount │ │ │ └── journal.beancount │ │ ├── README.md │ │ ├── 88348393419580772365.json │ │ ├── 79184124027478022589.json │ │ └── order_88348393419580772365.json │ ├── mint │ │ ├── test_basic │ │ │ ├── training_examples.json │ │ │ ├── accounts.txt │ │ │ └── journal.beancount │ │ ├── test_currency │ │ │ ├── training_examples.json │ │ │ ├── accounts.txt │ │ │ └── journal.beancount │ │ ├── test_invalid │ │ │ ├── import_results.beancount │ │ │ ├── accounts.txt │ │ │ ├── training_examples.json │ │ │ └── journal.beancount │ │ ├── test_training_examples │ │ │ ├── import_results.beancount │ │ │ ├── accounts.txt │ │ │ ├── journal.beancount │ │ │ └── training_examples.json │ │ └── mint.csv │ ├── ofx │ │ ├── test_amex │ │ │ ├── training_examples.json │ │ │ ├── accounts.txt │ │ │ └── journal.beancount │ │ ├── test_anzcc │ │ │ ├── training_examples.json │ │ │ ├── accounts.txt │ │ │ ├── journal.beancount │ │ │ └── import_results.beancount │ │ ├── test_checking │ │ │ ├── training_examples.json │ │ │ ├── accounts.txt │ │ │ └── journal.beancount │ │ ├── test_suncorp │ │ │ ├── training_examples.json │ │ │ ├── accounts.txt │ │ │ ├── journal.beancount │ │ │ └── import_results.beancount │ │ ├── test_bank_medium │ │ │ ├── training_examples.json │ │ │ ├── accounts.txt │ │ │ └── journal.beancount │ │ ├── test_checking2 │ │ │ ├── training_examples.json │ │ │ ├── accounts.txt │ │ │ └── journal.beancount │ │ ├── test_td_ameritrade │ │ │ ├── training_examples.json │ │ │ ├── accounts.txt │ │ │ ├── journal.beancount │ │ │ └── import_results.beancount │ │ ├── test_vanguard401k │ │ │ ├── training_examples.json │ │ │ ├── accounts.txt │ │ │ └── journal.beancount │ │ ├── test_fidelity_ira │ │ │ ├── import_results.beancount │ │ │ └── accounts.txt │ │ ├── test_fidelity_savings │ │ │ ├── training_examples.json │ │ │ ├── accounts.txt │ │ │ └── journal.beancount │ │ ├── test_fidelity_treasury │ │ │ ├── training_examples.json │ │ │ ├── accounts.txt │ │ │ └── journal.beancount │ │ ├── test_investment_401k │ │ │ ├── training_examples.json │ │ │ ├── accounts.txt │ │ │ └── journal.beancount │ │ ├── test_multiple_accounts │ │ │ ├── training_examples.json │ │ │ ├── accounts.txt │ │ │ ├── journal.beancount │ │ │ └── import_results.beancount │ │ ├── test_vanguard_basic │ │ │ ├── training_examples.json │ │ │ ├── accounts.txt │ │ │ ├── journal.beancount │ │ │ └── import_results.beancount │ │ ├── test_vanguard_roth_ira │ │ │ ├── training_examples.json │ │ │ ├── accounts.txt │ │ │ ├── journal.beancount │ │ │ └── import_results.beancount │ │ ├── test_vanguard_xfer_in │ │ │ ├── training_examples.json │ │ │ ├── accounts.txt │ │ │ ├── journal.beancount │ │ │ └── import_results.beancount │ │ ├── test_checking_emptyledgerbal │ │ │ ├── training_examples.json │ │ │ ├── accounts.txt │ │ │ └── journal.beancount │ │ ├── test_vanguard_401k_matching │ │ │ ├── training_examples.json │ │ │ ├── accounts.txt │ │ │ └── journal.beancount │ │ ├── test_investment_buy_sell_income │ │ │ ├── training_examples.json │ │ │ ├── journal.beancount │ │ │ └── accounts.txt │ │ ├── test_vanguard_with_cash_account │ │ │ ├── training_examples.json │ │ │ ├── accounts.txt │ │ │ └── journal.beancount │ │ ├── test_checking2_matching │ │ │ ├── accounts.txt │ │ │ ├── training_examples.json │ │ │ └── journal.beancount │ │ ├── test_vanguard_with_cash_account_matching_missing_primary │ │ │ ├── training_examples.json │ │ │ ├── accounts.txt │ │ │ ├── journal.beancount │ │ │ └── import_results.beancount │ │ ├── test_vanguard_roth_ira_matching │ │ │ ├── accounts.txt │ │ │ ├── training_examples.json │ │ │ ├── import_results.beancount │ │ │ └── journal.beancount │ │ ├── test_vanguard_invalid │ │ │ ├── accounts.txt │ │ │ ├── training_examples.json │ │ │ ├── import_results.beancount │ │ │ └── journal.beancount │ │ ├── test_vanguard_matching │ │ │ ├── accounts.txt │ │ │ ├── training_examples.json │ │ │ ├── import_results.beancount │ │ │ └── journal.beancount │ │ ├── test_vanguard_with_cash_account_matching_missing_transfer │ │ │ ├── accounts.txt │ │ │ ├── training_examples.json │ │ │ ├── journal.beancount │ │ │ └── import_results.beancount │ │ ├── test_non_default_capital_gains │ │ │ ├── accounts.txt │ │ │ ├── training_examples.json │ │ │ └── journal.beancount │ │ ├── test_fidelity │ │ │ ├── accounts.txt │ │ │ └── training_examples.json │ │ ├── anzcc.ofx │ │ ├── bank_medium.ofx │ │ ├── README.md │ │ ├── suncorp.ofx │ │ └── multiple_accounts.ofx │ ├── ultipro_google │ │ ├── test_20211223 │ │ │ ├── accounts.txt │ │ │ ├── journal.beancount │ │ │ ├── training_examples.json │ │ │ ├── 2021-12-23.statement-98765432.pdf │ │ │ ├── 20211223-1.pdf │ │ │ └── 20211223-1.txt │ │ ├── test_20220107 │ │ │ ├── accounts.txt │ │ │ ├── journal.beancount │ │ │ ├── training_examples.json │ │ │ ├── 2022-01-07.statement-19260817.pdf │ │ │ ├── 20220107-1.pdf │ │ │ └── 20220107-1.txt │ │ └── test_basic │ │ │ ├── accounts.txt │ │ │ ├── journal.beancount │ │ │ ├── training_examples.json │ │ │ ├── 2021-01-08.statement-98765432.pdf │ │ │ ├── 20210108-1.pdf │ │ │ └── 20210108-1.txt │ ├── schwab_csv │ │ ├── test_basic │ │ │ ├── training_examples.json │ │ │ ├── transactions │ │ │ │ ├── Brokerage_Transactions_20201130-180000.CSV │ │ │ │ └── EAC_Checking_Transactions_20201223-160009.CSV │ │ │ ├── accounts.txt │ │ │ ├── positions │ │ │ │ └── Intelligent-Positions-2020-11-30.CSV │ │ │ └── journal.beancount │ │ └── test_lots │ │ │ ├── training_examples.json │ │ │ ├── accounts.txt │ │ │ ├── positions │ │ │ ├── lots │ │ │ │ ├── 2020-09-25 │ │ │ │ │ ├── IAU.csv │ │ │ │ │ ├── FNDA.csv │ │ │ │ │ ├── HYLB.csv │ │ │ │ │ └── SCHA.csv │ │ │ │ ├── 2020-10-25 │ │ │ │ │ ├── IAU.csv │ │ │ │ │ ├── SCHA.csv │ │ │ │ │ └── HYLB.csv │ │ │ │ └── 2020-08-25 │ │ │ │ │ ├── FNDA.csv │ │ │ │ │ └── SCHA.csv │ │ │ ├── Intelligent-Positions-2020-10-25.CSV │ │ │ ├── Intelligent-Positions-2020-08-25.CSV │ │ │ └── Intelligent-Positions-2020-09-25.CSV │ │ │ ├── journal.beancount │ │ │ └── transactions │ │ │ └── Intelligent_Transactions_20201115-180120.CSV │ ├── generic_importer │ │ ├── test_basic │ │ │ ├── training_examples.json │ │ │ ├── accounts.txt │ │ │ └── journal.beancount │ │ ├── test_cost │ │ │ ├── training_examples.json │ │ │ ├── accounts.txt │ │ │ ├── journal.beancount │ │ │ ├── input │ │ │ │ └── generic_statement.beancount │ │ │ └── import_results.beancount │ │ ├── test_invalid │ │ │ ├── accounts.txt │ │ │ └── import_results.beancount │ │ ├── test_training_examples │ │ │ ├── accounts.txt │ │ │ ├── import_results.beancount │ │ │ ├── journal.beancount │ │ │ └── training_examples.json │ │ └── csv │ │ │ └── generic_statement.csv │ └── healthequity │ │ ├── test_basic │ │ ├── training_examples.json │ │ ├── accounts.txt │ │ └── journal.beancount │ │ ├── data │ │ └── 1234567 │ │ │ ├── cash-transactions-distribution.csv │ │ │ ├── 2016-08-26T152440-0700.balances.csv │ │ │ ├── 2016-08-27T200554-0700.balances.csv │ │ │ ├── cash-transactions-contribution.csv │ │ │ ├── cash-transactions-other.csv │ │ │ └── investment-transactions.csv │ │ ├── test_invalid │ │ └── accounts.txt │ │ └── test_matching │ │ └── accounts.txt ├── webserver │ └── test_check_modification │ │ ├── 0 │ │ ├── ignore.beancount │ │ ├── journal.beancount │ │ └── transactions.beancount │ │ ├── 1 │ │ ├── ignore.beancount │ │ ├── journal.beancount │ │ └── transactions.beancount │ │ ├── 2 │ │ ├── ignore.beancount │ │ ├── journal.beancount │ │ ├── additional │ │ │ └── transactions.beancount │ │ └── transactions.beancount │ │ ├── 3 │ │ ├── ignore.beancount │ │ ├── journal.beancount │ │ ├── transactions.beancount │ │ └── additional │ │ │ └── transactions.beancount │ │ └── 4 │ │ ├── ignore.beancount │ │ ├── journal.beancount │ │ └── transactions.beancount └── matching_test │ └── match_many_merged │ └── pending.beancount ├── pytest.ini ├── .coveragerc ├── .gitattributes ├── pyproject.toml ├── tox.ini ├── .gitignore ├── .editorconfig ├── frontend ├── tsconfig.json ├── third_party │ └── fava │ │ ├── codemirror │ │ ├── helpers.js │ │ ├── hint-query.js │ │ ├── fold-beancount.js │ │ └── mode-query.js │ │ └── README.md ├── codemirror-beancount │ └── codemirror-fold-beancount.js └── README.md └── mypy.ini /beancount_import/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /examples/fresh/ignored.beancount: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /examples/fresh/prices.beancount: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /examples/fresh/transactions.beancount: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /beancount_import/api_proxies/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /examples/manually_entered/ignored.beancount: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /examples/manually_entered/prices.beancount: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /testdata/reconcile/test_basic/0/errors.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /testdata/reconcile/test_basic/0/ignore.beancount: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /testdata/reconcile/test_basic/1/errors.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /testdata/reconcile/test_basic/1/ignore.beancount: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /testdata/reconcile/test_basic/2/candidates.diff: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /testdata/reconcile/test_basic/2/ignore.beancount: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /testdata/reconcile/test_ignore/0/errors.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /testdata/reconcile/test_ignore/3/candidates.diff: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /testdata/source/amazon/test_basic/accounts.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /testdata/source/waveapps/test_basic/accounts.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /testdata/reconcile/test_amazon_large/0/errors.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /testdata/reconcile/test_ignore/0/ignore.beancount: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /testdata/reconcile/test_ofx_basic/0/errors.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /testdata/reconcile/test_ofx_basic/0/ignore.beancount: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /testdata/reconcile/test_ofx_cleared/0/errors.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /testdata/reconcile/test_ofx_matching/0/errors.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /testdata/source/amazon/test_basic/journal.beancount: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /testdata/source/amazon/test_prediction/accounts.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /testdata/source/paypal/test_basic/journal.beancount: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /testdata/source/venmo/test_basic/journal.beancount: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /testdata/source/waveapps/test_basic/journal.beancount: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /testdata/source/waveapps/test_matching/accounts.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /testdata/reconcile/test_amazon_large/0/ignore.beancount: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /testdata/reconcile/test_basic/2/pending.beancount: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /testdata/reconcile/test_ignore/3/pending.beancount: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /testdata/reconcile/test_ofx_cleared/0/ignore.beancount: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /testdata/reconcile/test_ofx_ignore_balance/0/errors.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /testdata/reconcile/test_ofx_ignore_price/0/errors.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /testdata/reconcile/test_ofx_matching/0/ignore.beancount: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /testdata/source/amazon/test_basic/training_examples.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /testdata/source/google_purchases/test_basic/accounts.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /testdata/source/google_purchases/test_invalid/accounts.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /testdata/source/mint/test_basic/training_examples.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /testdata/source/ofx/test_amex/training_examples.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /testdata/source/ofx/test_anzcc/training_examples.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /testdata/source/ofx/test_checking/training_examples.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /testdata/source/ofx/test_suncorp/training_examples.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /testdata/source/paypal/de_DE/test_basic/journal.beancount: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /testdata/source/paypal/test_basic/training_examples.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /testdata/source/ultipro_google/test_20211223/accounts.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /testdata/source/ultipro_google/test_20220107/accounts.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /testdata/source/ultipro_google/test_basic/accounts.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /testdata/source/venmo/test_basic/training_examples.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /testdata/reconcile/test_ofx_basic/0/training_examples.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /testdata/reconcile/test_ofx_cleared/0/training_examples.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /testdata/reconcile/test_ofx_matching/0/training_examples.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /testdata/source/amazon/test_cleared_and_invalid/accounts.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /testdata/source/google_purchases/test_basic/journal.beancount: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /testdata/source/google_purchases/test_matching/accounts.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /testdata/source/mint/test_currency/training_examples.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /testdata/source/mint/test_invalid/import_results.beancount: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /testdata/source/ofx/test_bank_medium/training_examples.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /testdata/source/ofx/test_checking2/training_examples.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /testdata/source/ofx/test_td_ameritrade/training_examples.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /testdata/source/ofx/test_vanguard401k/training_examples.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /testdata/source/schwab_csv/test_basic/training_examples.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /testdata/source/schwab_csv/test_lots/training_examples.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /testdata/source/ultipro_google/test_20211223/journal.beancount: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /testdata/source/ultipro_google/test_20220107/journal.beancount: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /testdata/source/ultipro_google/test_basic/journal.beancount: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /testdata/source/venmo/test_basic/accounts.txt: -------------------------------------------------------------------------------- 1 | Assets:Venmo 2 | -------------------------------------------------------------------------------- /testdata/source/waveapps/test_basic/training_examples.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /testdata/source/waveapps/test_matching/training_examples.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /testdata/webserver/test_check_modification/0/ignore.beancount: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /testdata/webserver/test_check_modification/1/ignore.beancount: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /testdata/webserver/test_check_modification/2/ignore.beancount: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /testdata/webserver/test_check_modification/3/ignore.beancount: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /testdata/webserver/test_check_modification/4/ignore.beancount: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /pytest.ini: -------------------------------------------------------------------------------- 1 | [pytest] 2 | norecursedirs = .git frontend examples 3 | -------------------------------------------------------------------------------- /testdata/reconcile/test_ofx_ignore_price/0/training_examples.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /testdata/source/amazon/test_credit_card_transactions/accounts.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /testdata/source/generic_importer/test_basic/training_examples.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /testdata/source/generic_importer/test_cost/training_examples.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /testdata/source/google_purchases/test_basic/training_examples.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /testdata/source/healthequity/test_basic/training_examples.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /testdata/source/ofx/test_checking/accounts.txt: -------------------------------------------------------------------------------- 1 | Assets:Checking 2 | -------------------------------------------------------------------------------- /testdata/source/ofx/test_fidelity_ira/import_results.beancount: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /testdata/source/ofx/test_fidelity_savings/training_examples.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /testdata/source/ofx/test_fidelity_treasury/training_examples.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /testdata/source/ofx/test_investment_401k/training_examples.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /testdata/source/ofx/test_multiple_accounts/training_examples.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /testdata/source/ofx/test_vanguard_basic/training_examples.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /testdata/source/ofx/test_vanguard_roth_ira/training_examples.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /testdata/source/ofx/test_vanguard_xfer_in/training_examples.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /testdata/source/paypal/de_DE/test_basic/training_examples.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /testdata/source/paypal/test_basic/accounts.txt: -------------------------------------------------------------------------------- 1 | Assets:Paypal 2 | -------------------------------------------------------------------------------- /testdata/source/paypal/test_matching/accounts.txt: -------------------------------------------------------------------------------- 1 | Assets:Paypal 2 | -------------------------------------------------------------------------------- /testdata/source/ultipro_google/test_basic/training_examples.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /testdata/source/venmo/test_matching/accounts.txt: -------------------------------------------------------------------------------- 1 | Assets:Venmo 2 | -------------------------------------------------------------------------------- /.coveragerc: -------------------------------------------------------------------------------- 1 | [run] 2 | source = beancount_import 3 | branch = True 4 | -------------------------------------------------------------------------------- /testdata/reconcile/test_ofx_ignore_balance/0/training_examples.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /testdata/source/generic_importer/test_basic/accounts.txt: -------------------------------------------------------------------------------- 1 | Assets:Bank 2 | -------------------------------------------------------------------------------- /testdata/source/generic_importer/test_cost/accounts.txt: -------------------------------------------------------------------------------- 1 | Assets:Bank 2 | -------------------------------------------------------------------------------- /testdata/source/google_purchases/test_invalid/training_examples.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /testdata/source/google_purchases/test_matching/training_examples.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /testdata/source/mint/test_training_examples/import_results.beancount: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /testdata/source/ofx/test_anzcc/accounts.txt: -------------------------------------------------------------------------------- 1 | Liabilities:Credit-Card 2 | -------------------------------------------------------------------------------- /testdata/source/ofx/test_bank_medium/accounts.txt: -------------------------------------------------------------------------------- 1 | Assets:Checking 2 | -------------------------------------------------------------------------------- /testdata/source/ofx/test_checking_emptyledgerbal/training_examples.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /testdata/source/ofx/test_suncorp/accounts.txt: -------------------------------------------------------------------------------- 1 | Assets:Checking:Suncorp 2 | -------------------------------------------------------------------------------- /testdata/source/ofx/test_vanguard_401k_matching/training_examples.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /testdata/source/paypal/de_DE/test_basic/accounts.txt: -------------------------------------------------------------------------------- 1 | Assets:Paypal 2 | -------------------------------------------------------------------------------- /testdata/source/ultipro_google/test_20211223/training_examples.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /testdata/source/ultipro_google/test_20220107/training_examples.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /testdata/source/amazon/test_credit_card_transactions/training_examples.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /testdata/source/generic_importer/test_invalid/accounts.txt: -------------------------------------------------------------------------------- 1 | Assets:Bank 2 | -------------------------------------------------------------------------------- /testdata/source/generic_importer/test_invalid/import_results.beancount: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /testdata/source/google_purchases/test_invalid/import_results.beancount: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /testdata/source/google_purchases/test_matching/import_results.beancount: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /testdata/source/ofx/test_amex/accounts.txt: -------------------------------------------------------------------------------- 1 | Liabilities:Credit-Card:Amex 2 | -------------------------------------------------------------------------------- /testdata/source/ofx/test_checking2/accounts.txt: -------------------------------------------------------------------------------- 1 | Assets:Checking:MyBank 2 | -------------------------------------------------------------------------------- /testdata/source/ofx/test_investment_buy_sell_income/training_examples.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /testdata/source/ofx/test_vanguard_with_cash_account/training_examples.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /testdata/source/paypal/README.md: -------------------------------------------------------------------------------- 1 | Test data for the paypal data source. 2 | -------------------------------------------------------------------------------- /testdata/source/venmo/test_invalid_references/accounts.txt: -------------------------------------------------------------------------------- 1 | Assets:Venmo 2 | -------------------------------------------------------------------------------- /testdata/source/ofx/test_checking2_matching/accounts.txt: -------------------------------------------------------------------------------- 1 | Assets:Checking:MyBank 2 | -------------------------------------------------------------------------------- /testdata/source/ofx/test_checking_emptyledgerbal/accounts.txt: -------------------------------------------------------------------------------- 1 | Assets:Checking 2 | -------------------------------------------------------------------------------- /testdata/source/ofx/test_fidelity_savings/accounts.txt: -------------------------------------------------------------------------------- 1 | Assets:Savings:Fidelity 2 | -------------------------------------------------------------------------------- /testdata/source/generic_importer/test_training_examples/accounts.txt: -------------------------------------------------------------------------------- 1 | Assets:Bank 2 | -------------------------------------------------------------------------------- /testdata/source/generic_importer/test_training_examples/import_results.beancount: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Prevent line ending conversion on testdata files 2 | testdata/** -text 3 | -------------------------------------------------------------------------------- /testdata/source/generic_importer/test_basic/journal.beancount: -------------------------------------------------------------------------------- 1 | 1900-01-01 open Assets:Bank 2 | -------------------------------------------------------------------------------- /testdata/source/generic_importer/test_cost/journal.beancount: -------------------------------------------------------------------------------- 1 | 1900-01-01 open Assets:Bank 2 | -------------------------------------------------------------------------------- /testdata/source/mint/test_basic/accounts.txt: -------------------------------------------------------------------------------- 1 | Assets:Checking 2 | Liabilities:Credit-Card 3 | -------------------------------------------------------------------------------- /testdata/source/ultipro_google/test_20211223/2021-12-23.statement-98765432.pdf: -------------------------------------------------------------------------------- 1 | 20211223-1.pdf -------------------------------------------------------------------------------- /testdata/source/ultipro_google/test_20220107/2022-01-07.statement-19260817.pdf: -------------------------------------------------------------------------------- 1 | 20220107-1.pdf -------------------------------------------------------------------------------- /testdata/source/ultipro_google/test_basic/2021-01-08.statement-98765432.pdf: -------------------------------------------------------------------------------- 1 | 20210108-1.pdf -------------------------------------------------------------------------------- /testdata/source/google_purchases/README.md: -------------------------------------------------------------------------------- 1 | Test data for the google_purchases data source. 2 | -------------------------------------------------------------------------------- /testdata/source/mint/test_currency/accounts.txt: -------------------------------------------------------------------------------- 1 | Assets:Checking 2 | Liabilities:Credit-Card 3 | -------------------------------------------------------------------------------- /testdata/source/mint/test_invalid/accounts.txt: -------------------------------------------------------------------------------- 1 | Assets:Checking 2 | Liabilities:Credit-Card 3 | -------------------------------------------------------------------------------- /testdata/source/ofx/test_multiple_accounts/accounts.txt: -------------------------------------------------------------------------------- 1 | Assets:Checking 2 | Assets:Savings 3 | -------------------------------------------------------------------------------- /testdata/source/ofx/test_vanguard_with_cash_account_matching_missing_primary/training_examples.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /testdata/source/mint/test_training_examples/accounts.txt: -------------------------------------------------------------------------------- 1 | Assets:Checking 2 | Liabilities:Credit-Card 3 | -------------------------------------------------------------------------------- /testdata/reconcile/test_ofx_ignore_price/0/ignore.beancount: -------------------------------------------------------------------------------- 1 | 2018-07-03 price TYCDT 84.20 USD 2 | -------------------------------------------------------------------------------- /testdata/source/healthequity/data/1234567/cash-transactions-distribution.csv: -------------------------------------------------------------------------------- 1 | "Date","Transaction","Amount","Cash Balance" 2 | -------------------------------------------------------------------------------- /examples/fresh/journal.beancount: -------------------------------------------------------------------------------- 1 | include "accounts.beancount" 2 | include "transactions.beancount" 3 | include "prices.beancount" 4 | -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | [build-system] 2 | requires = [ 3 | "setuptools>=42", 4 | "wheel", 5 | "setuptools_scm>=5.0.2", 6 | ] 7 | -------------------------------------------------------------------------------- /testdata/source/waveapps/10000001.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jbms/beancount-import/HEAD/testdata/source/waveapps/10000001.jpg -------------------------------------------------------------------------------- /testdata/source/waveapps/12345678.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jbms/beancount-import/HEAD/testdata/source/waveapps/12345678.jpg -------------------------------------------------------------------------------- /testdata/source/ofx/test_vanguard_roth_ira/accounts.txt: -------------------------------------------------------------------------------- 1 | Assets:Retirement:Vanguard:Roth-IRA 2 | Assets:Retirement:Vanguard:Roth-IRA:TYCDT 3 | -------------------------------------------------------------------------------- /examples/manually_entered/journal.beancount: -------------------------------------------------------------------------------- 1 | include "accounts.beancount" 2 | include "transactions.beancount" 3 | include "prices.beancount" 4 | -------------------------------------------------------------------------------- /testdata/reconcile/test_ofx_ignore_balance/0/ignore.beancount: -------------------------------------------------------------------------------- 1 | 2018-07-03 balance Assets:Retirement:Vanguard:Roth-IRA:TYCDT 46.872 TYCDT 2 | -------------------------------------------------------------------------------- /testdata/source/healthequity/test_basic/accounts.txt: -------------------------------------------------------------------------------- 1 | Assets:HSA:HealthEquity 2 | Assets:HSA:HealthEquity:Cash 3 | Assets:HSA:HealthEquity:VIIIX 4 | -------------------------------------------------------------------------------- /testdata/webserver/test_check_modification/0/journal.beancount: -------------------------------------------------------------------------------- 1 | 1900-01-01 open Assets:Checking USD 2 | 3 | include "transactions.beancount" 4 | -------------------------------------------------------------------------------- /testdata/webserver/test_check_modification/1/journal.beancount: -------------------------------------------------------------------------------- 1 | 1900-01-01 open Assets:Checking USD 2 | 3 | include "transactions.beancount" 4 | -------------------------------------------------------------------------------- /testdata/webserver/test_check_modification/4/journal.beancount: -------------------------------------------------------------------------------- 1 | 1900-01-01 open Assets:Checking USD 2 | 3 | include "transactions.beancount" 4 | -------------------------------------------------------------------------------- /testdata/source/healthequity/test_invalid/accounts.txt: -------------------------------------------------------------------------------- 1 | Assets:HSA:HealthEquity 2 | Assets:HSA:HealthEquity:Cash 3 | Assets:HSA:HealthEquity:VIIIX 4 | -------------------------------------------------------------------------------- /testdata/source/healthequity/test_matching/accounts.txt: -------------------------------------------------------------------------------- 1 | Assets:HSA:HealthEquity 2 | Assets:HSA:HealthEquity:Cash 3 | Assets:HSA:HealthEquity:VIIIX 4 | -------------------------------------------------------------------------------- /testdata/source/ofx/test_vanguard_roth_ira_matching/accounts.txt: -------------------------------------------------------------------------------- 1 | Assets:Retirement:Vanguard:Roth-IRA 2 | Assets:Retirement:Vanguard:Roth-IRA:TYCDT 3 | -------------------------------------------------------------------------------- /testdata/source/amazon/test_credit_card_transactions/journal.beancount: -------------------------------------------------------------------------------- 1 | 1900-01-01 open Liabilities:Credit-Card 2 | credit_card_last_4_digits: "1234" 3 | -------------------------------------------------------------------------------- /testdata/source/ofx/test_fidelity_treasury/accounts.txt: -------------------------------------------------------------------------------- 1 | Assets:Savings:Fidelity 2 | Assets:Savings:Fidelity:Cash 3 | Assets:Savings:Fidelity:T912796Z77 4 | -------------------------------------------------------------------------------- /testdata/source/ofx/test_vanguard_basic/accounts.txt: -------------------------------------------------------------------------------- 1 | Assets:Investment:Vanguard 2 | Assets:Investment:Vanguard:VFIAX 3 | Assets:Investment:Vanguard:VFINX 4 | -------------------------------------------------------------------------------- /testdata/source/ofx/test_vanguard_invalid/accounts.txt: -------------------------------------------------------------------------------- 1 | Assets:Investment:Vanguard 2 | Assets:Investment:Vanguard:VFIAX 3 | Assets:Investment:Vanguard:VFINX 4 | -------------------------------------------------------------------------------- /testdata/source/ofx/test_vanguard_matching/accounts.txt: -------------------------------------------------------------------------------- 1 | Assets:Investment:Vanguard 2 | Assets:Investment:Vanguard:VFIAX 3 | Assets:Investment:Vanguard:VFINX 4 | -------------------------------------------------------------------------------- /testdata/source/ofx/test_vanguard_xfer_in/accounts.txt: -------------------------------------------------------------------------------- 1 | Assets:Investment:Vanguard 2 | Assets:Investment:Vanguard:PARMX 3 | Assets:Investment:Vanguard:PRBLX 4 | -------------------------------------------------------------------------------- /testdata/source/amazon/README.md: -------------------------------------------------------------------------------- 1 | Test Amazon invoice files. 2 | 3 | These files were generated using the 4 | `beancount_import.source.amazon_invoice_sanitize` module. 5 | -------------------------------------------------------------------------------- /testdata/source/ultipro_google/test_basic/20210108-1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jbms/beancount-import/HEAD/testdata/source/ultipro_google/test_basic/20210108-1.pdf -------------------------------------------------------------------------------- /testdata/reconcile/test_ofx_matching/0/candidates.diff: -------------------------------------------------------------------------------- 1 | /journal.beancount 2 | + 3 | +2018-07-03 price TYCDT 1.554232804232804232804232804 USD 4 | -------------------------------------------------------------------------------- /testdata/source/ultipro_google/test_20211223/20211223-1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jbms/beancount-import/HEAD/testdata/source/ultipro_google/test_20211223/20211223-1.pdf -------------------------------------------------------------------------------- /testdata/source/ultipro_google/test_20220107/20220107-1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jbms/beancount-import/HEAD/testdata/source/ultipro_google/test_20220107/20220107-1.pdf -------------------------------------------------------------------------------- /testdata/source/generic_importer/test_cost/input/generic_statement.beancount: -------------------------------------------------------------------------------- 1 | 2 | 2020-01-01 * "convert currency" 3 | Assets:Bank -1 USD 4 | Assets:Saving 2 EUR @@ 1USD 5 | -------------------------------------------------------------------------------- /testdata/source/ofx/test_td_ameritrade/accounts.txt: -------------------------------------------------------------------------------- 1 | Assets:Investment:TD-Ameritrade 2 | Assets:Investment:TD-Ameritrade:AMERITRADE-912810RW0 3 | Assets:Investment:TD-Ameritrade:AMZN 4 | -------------------------------------------------------------------------------- /testdata/webserver/test_check_modification/2/journal.beancount: -------------------------------------------------------------------------------- 1 | 1900-01-01 open Assets:Checking USD 2 | 3 | include "transactions.beancount" 4 | include "additional/transactions.beancount" 5 | -------------------------------------------------------------------------------- /testdata/webserver/test_check_modification/3/journal.beancount: -------------------------------------------------------------------------------- 1 | 1900-01-01 open Assets:Checking USD 2 | 3 | include "transactions.beancount" 4 | include "additional/transactions.beancount" 5 | -------------------------------------------------------------------------------- /testdata/reconcile/test_ofx_matching/0/pending.beancount: -------------------------------------------------------------------------------- 1 | ;; source: ofx 2 | ;; date: 2018-07-03 3 | ;; info: null 4 | 5 | 2018-07-03 price TYCDT 1.554232804232804232804232804 USD 6 | -------------------------------------------------------------------------------- /testdata/source/ofx/test_checking/journal.beancount: -------------------------------------------------------------------------------- 1 | 1900-01-01 open Assets:Checking 2 | ofx_org: "FAKE" 3 | ofx_broker_id: "" 4 | account_id: "1452687~7" 5 | ofx_account_type: "cash_only" 6 | -------------------------------------------------------------------------------- /examples/data/importers/creditcard.csv: -------------------------------------------------------------------------------- 1 | Credit Card Number: 1234XXXXXXXX7890 2 | Date,Description,Amount,Balance 3 | 2020-01-10,Amazon Order 54429302,-15.5,-35.5 4 | 2020-01-15,Payment Received,30,-5.5 5 | -------------------------------------------------------------------------------- /testdata/reconcile/test_basic/0/journal.beancount: -------------------------------------------------------------------------------- 1 | 1900-01-01 open Liabilities:Credit-Card USD 2 | mint_id: "My Credit Card" 3 | 4 | 1900-01-01 open Assets:Checking USD 5 | mint_id: "My Checking" 6 | -------------------------------------------------------------------------------- /testdata/reconcile/test_ignore/0/journal.beancount: -------------------------------------------------------------------------------- 1 | 1900-01-01 open Liabilities:Credit-Card USD 2 | mint_id: "My Credit Card" 3 | 4 | 1900-01-01 open Assets:Checking USD 5 | mint_id: "My Checking" 6 | -------------------------------------------------------------------------------- /testdata/reconcile/test_ignore/1/journal.beancount: -------------------------------------------------------------------------------- 1 | 1900-01-01 open Liabilities:Credit-Card USD 2 | mint_id: "My Credit Card" 3 | 4 | 1900-01-01 open Assets:Checking USD 5 | mint_id: "My Checking" 6 | -------------------------------------------------------------------------------- /testdata/reconcile/test_ignore/2/journal.beancount: -------------------------------------------------------------------------------- 1 | 1900-01-01 open Liabilities:Credit-Card USD 2 | mint_id: "My Credit Card" 3 | 4 | 1900-01-01 open Assets:Checking USD 5 | mint_id: "My Checking" 6 | -------------------------------------------------------------------------------- /testdata/reconcile/test_ignore/3/journal.beancount: -------------------------------------------------------------------------------- 1 | 1900-01-01 open Liabilities:Credit-Card USD 2 | mint_id: "My Credit Card" 3 | 4 | 1900-01-01 open Assets:Checking USD 5 | mint_id: "My Checking" 6 | -------------------------------------------------------------------------------- /testdata/source/mint/test_basic/journal.beancount: -------------------------------------------------------------------------------- 1 | 1900-01-01 open Liabilities:Credit-Card USD 2 | mint_id: "My Credit Card" 3 | 4 | 1900-01-01 open Assets:Checking USD 5 | mint_id: "My Checking" 6 | -------------------------------------------------------------------------------- /testdata/source/mint/test_currency/journal.beancount: -------------------------------------------------------------------------------- 1 | 1900-01-01 open Liabilities:Credit-Card CAD 2 | mint_id: "My Credit Card" 3 | 4 | 1900-01-01 open Assets:Checking CAD 5 | mint_id: "My Checking" 6 | -------------------------------------------------------------------------------- /testdata/source/ofx/test_anzcc/journal.beancount: -------------------------------------------------------------------------------- 1 | 1900-01-01 open Liabilities:Credit-Card 2 | ofx_org: "" 3 | ofx_broker_id: "" 4 | account_id: "1234123412341234" 5 | ofx_account_type: "cash_only" 6 | -------------------------------------------------------------------------------- /testdata/source/ofx/test_bank_medium/journal.beancount: -------------------------------------------------------------------------------- 1 | 1900-01-01 open Assets:Checking 2 | ofx_org: "" 3 | ofx_broker_id: "" 4 | account_id: "12300 000012345678" 5 | ofx_account_type: "cash_only" 6 | -------------------------------------------------------------------------------- /testdata/source/ofx/test_vanguard_with_cash_account/accounts.txt: -------------------------------------------------------------------------------- 1 | Assets:Investment:Vanguard 2 | Assets:Investment:Vanguard:Cash 3 | Assets:Investment:Vanguard:VFIAX 4 | Assets:Investment:Vanguard:VFINX 5 | -------------------------------------------------------------------------------- /testdata/source/ofx/test_suncorp/journal.beancount: -------------------------------------------------------------------------------- 1 | 1900-01-01 open Assets:Checking:Suncorp 2 | ofx_org: "SUNCORP" 3 | ofx_broker_id: "" 4 | account_id: "123456789" 5 | ofx_account_type: "cash_only" 6 | -------------------------------------------------------------------------------- /testdata/source/ofx/test_amex/journal.beancount: -------------------------------------------------------------------------------- 1 | 1900-01-01 open Liabilities:Credit-Card:Amex 2 | ofx_org: "AMEX" 3 | ofx_broker_id: "" 4 | ofx_account_type: "cash_only" 5 | account_id: "379700001111222" 6 | -------------------------------------------------------------------------------- /testdata/source/ofx/test_checking2/journal.beancount: -------------------------------------------------------------------------------- 1 | 1900-01-01 open Assets:Checking:MyBank 2 | ofx_org: "MyBank" 3 | ofx_broker_id: "MyBank" 4 | ofx_account_type: "cash_only" 5 | account_id: "123456789" 6 | -------------------------------------------------------------------------------- /testdata/source/ofx/test_checking_emptyledgerbal/journal.beancount: -------------------------------------------------------------------------------- 1 | 1900-01-01 open Assets:Checking 2 | ofx_org: "FAKE" 3 | ofx_broker_id: "" 4 | account_id: "1452687~7" 5 | ofx_account_type: "cash_only" 6 | -------------------------------------------------------------------------------- /testdata/source/healthequity/data/1234567/2016-08-26T152440-0700.balances.csv: -------------------------------------------------------------------------------- 1 | "Fund","Name","Shares (#)","Closing Price","Closing Value" 2 | "VIIIX","VANGUARD INSTITUTIONAL INDEX INSTL PL","10.543","199.17","2,099.85" 3 | -------------------------------------------------------------------------------- /testdata/source/healthequity/data/1234567/2016-08-27T200554-0700.balances.csv: -------------------------------------------------------------------------------- 1 | "Fund","Name","Shares (#)","Closing Price","Closing Value" 2 | "VIIIX","VANGUARD INSTITUTIONAL INDEX INSTL PL","10.543","198.86","2,096.58" 3 | -------------------------------------------------------------------------------- /testdata/source/waveapps/test_matching/journal.beancount: -------------------------------------------------------------------------------- 1 | plugin "beancount.plugins.auto_accounts" 2 | 3 | 2019-01-10 * "Solar4America Ice" ^waveapps.12345678 4 | Expenses:FIXME 34.00 USD 5 | Expenses:FIXME -34.00 USD 6 | -------------------------------------------------------------------------------- /testdata/source/ofx/test_vanguard401k/accounts.txt: -------------------------------------------------------------------------------- 1 | Assets:Retirement:Vanguard:Company401k 2 | Assets:Retirement:Vanguard:Company401k:Match:VANGUARD-92202V351 3 | Assets:Retirement:Vanguard:Company401k:PreTax:VANGUARD-92202V351 4 | -------------------------------------------------------------------------------- /testdata/source/ofx/test_vanguard_with_cash_account_matching_missing_primary/accounts.txt: -------------------------------------------------------------------------------- 1 | Assets:Investment:Vanguard 2 | Assets:Investment:Vanguard:Cash 3 | Assets:Investment:Vanguard:VFIAX 4 | Assets:Investment:Vanguard:VFINX 5 | -------------------------------------------------------------------------------- /testdata/source/ofx/test_vanguard_with_cash_account_matching_missing_transfer/accounts.txt: -------------------------------------------------------------------------------- 1 | Assets:Investment:Vanguard 2 | Assets:Investment:Vanguard:Cash 3 | Assets:Investment:Vanguard:VFIAX 4 | Assets:Investment:Vanguard:VFINX 5 | -------------------------------------------------------------------------------- /testdata/source/ofx/test_fidelity_savings/journal.beancount: -------------------------------------------------------------------------------- 1 | 1900-01-01 open Assets:Savings:Fidelity 2 | ofx_org: "fidelity.com" 3 | ofx_broker_id: "fidelity.com" 4 | account_id: "X0000001" 5 | ofx_account_type: "cash_only" 6 | -------------------------------------------------------------------------------- /testdata/source/ofx/test_non_default_capital_gains/accounts.txt: -------------------------------------------------------------------------------- 1 | Assets:Retirement:Vanguard:Company401k 2 | Assets:Retirement:Vanguard:Company401k:Match:VANGUARD-92202V351 3 | Assets:Retirement:Vanguard:Company401k:PreTax:VANGUARD-92202V351 4 | -------------------------------------------------------------------------------- /testdata/source/ofx/test_vanguard_401k_matching/accounts.txt: -------------------------------------------------------------------------------- 1 | Assets:Retirement:Vanguard:Company401k 2 | Assets:Retirement:Vanguard:Company401k:Match:VANGUARD-92202V351 3 | Assets:Retirement:Vanguard:Company401k:PreTax:VANGUARD-92202V351 4 | -------------------------------------------------------------------------------- /testdata/source/ofx/test_investment_401k/accounts.txt: -------------------------------------------------------------------------------- 1 | Assets:Retirement:ExampleOrg:Company401k 2 | Assets:Retirement:ExampleOrg:Company401k:BAR 3 | Assets:Retirement:ExampleOrg:Company401k:BAZ 4 | Assets:Retirement:ExampleOrg:Company401k:FOO 5 | -------------------------------------------------------------------------------- /testdata/webserver/test_check_modification/0/transactions.beancount: -------------------------------------------------------------------------------- 1 | 2013-12-02 * "NATIONAL FEDERAL DES:TRNSFR" 2 | Assets:Checking -66.88 USD 3 | date: 2013-12-02 4 | source_desc: "NATIONAL FEDERAL DES:TRNSFR" 5 | Expenses:FIXME 66.88 USD 6 | -------------------------------------------------------------------------------- /testdata/source/healthequity/test_basic/journal.beancount: -------------------------------------------------------------------------------- 1 | 2016-01-01 open Assets:HSA:HealthEquity 2 | healthequity_account_id: "1234567" 3 | dividend_account: "Income:HealthEquity:Dividends" 4 | capital_gains_account: "Income:HealthEquity:Capital-Gains" 5 | -------------------------------------------------------------------------------- /tox.ini: -------------------------------------------------------------------------------- 1 | [testenv] 2 | deps = 3 | pytest 4 | mypy 5 | coverage 6 | typing-extensions 7 | 8 | commands = 9 | mypy beancount_import --install-types --non-interactive --disable-error-code=type-abstract 10 | coverage run -m pytest -vv 11 | -------------------------------------------------------------------------------- /testdata/source/schwab_csv/test_lots/accounts.txt: -------------------------------------------------------------------------------- 1 | Assets:Schwab:Intelligent-4321 2 | Assets:Schwab:Intelligent-4321:Cash 3 | Assets:Schwab:Intelligent-4321:FNDA 4 | Assets:Schwab:Intelligent-4321:HYLB 5 | Assets:Schwab:Intelligent-4321:IAU 6 | Assets:Schwab:Intelligent-4321:SCHA 7 | -------------------------------------------------------------------------------- /testdata/source/healthequity/data/1234567/cash-transactions-contribution.csv: -------------------------------------------------------------------------------- 1 | "Date","Transaction","Amount","Cash Balance" 2 | "2016-01-15","Employer Contribution (Tax year: 2016)","$800.00","$800.00" 3 | "2016-03-11","Employer Contribution (Tax year: 2015)","$1,600.00","$2,436.76" 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | .pytest_cache 3 | .mypy_cache 4 | *.egg-info 5 | frontend/node_modules 6 | beancount_import/frontend_dist/*.js 7 | beancount_import/frontend_dist/*.css 8 | beancount_import/frontend_dist/*.map 9 | .tox 10 | .coverage 11 | htmlcov/ 12 | .eggs/ 13 | .idea/ 14 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | tab_width = 2 6 | end_of_line = lf 7 | charset = utf-8 8 | trim_leading_whitespace = true 9 | insert_final_newline = true 10 | max_line_length = 80 11 | 12 | [*.py] 13 | indent_style = space 14 | indent_size = 4 15 | -------------------------------------------------------------------------------- /testdata/source/ofx/test_vanguard_roth_ira/journal.beancount: -------------------------------------------------------------------------------- 1 | 1900-01-01 open Assets:Retirement:Vanguard:Roth-IRA 2 | ofx_org: "MyBank" 3 | ofx_broker_id: "MyBank" 4 | ofx_account_type: "securities_only" 5 | account_id: "123456789" 6 | div_income_account: "Income:Vanguard:Dividends" 7 | -------------------------------------------------------------------------------- /testdata/source/schwab_csv/test_basic/transactions/Brokerage_Transactions_20201130-180000.CSV: -------------------------------------------------------------------------------- 1 | "Transactions for account Brokerage XXXX-1234 as of 11/30/2020 18:00:00 ET From 11/16/2020 to 11/29/2020" 2 | "Date","Action","Symbol","Description","Quantity","Price","Fees & Comm","Amount", 3 | "" 4 | -------------------------------------------------------------------------------- /beancount_import/frontend_dist/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Beancount-import 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /testdata/source/google_purchases/88348393419580772365.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "88348393419580772365", 3 | "payment_processor": "AutoZone", 4 | "merchant": null, 5 | "items": [ 6 | "Relay - Blower Motor" 7 | ], 8 | "timestamp": 1508099580000, 9 | "units": 21.84, 10 | "currency": "USD" 11 | } -------------------------------------------------------------------------------- /testdata/source/ofx/test_fidelity_treasury/journal.beancount: -------------------------------------------------------------------------------- 1 | 1900-01-01 open Assets:Savings:Fidelity 2 | ofx_org: "fidelity.com" 3 | ofx_broker_id: "fidelity.com" 4 | account_id: "X0000001" 5 | ofx_account_type: "securities_and_cash" 6 | interest_income_account: "Income:Interest:Savings:Fidelity" 7 | -------------------------------------------------------------------------------- /testdata/source/ofx/test_vanguard_basic/journal.beancount: -------------------------------------------------------------------------------- 1 | 1900-01-01 open Assets:Investment:Vanguard 2 | ofx_org: "The Vanguard Group" 3 | ofx_broker_id: "vanguard.com" 4 | ofx_account_type: "securities_only" 5 | account_id: "01234567890" 6 | capital_gains_account: "Income:Vanguard:Capital-Gains" 7 | -------------------------------------------------------------------------------- /testdata/webserver/test_check_modification/2/additional/transactions.beancount: -------------------------------------------------------------------------------- 1 | 2013-12-04 * "NATIONAL FEDERAL DES:TRNSFR" #additional 2 | Assets:Checking -11.22 USD 3 | date: 2013-12-04 4 | source_desc: "NATIONAL FEDERAL DES:TRNSFR" 5 | additional: yes 6 | Expenses:FIXME 11.22 USD 7 | 8 | -------------------------------------------------------------------------------- /testdata/source/google_purchases/79184124027478022589.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "79184124027478022589", 3 | "payment_processor": "Square", 4 | "merchant": "Some merchant", 5 | "items": [ 6 | "Some purchase" 7 | ], 8 | "timestamp": 1532403683000, 9 | "units": 10.0, 10 | "currency": "USD" 11 | } 12 | -------------------------------------------------------------------------------- /testdata/source/ofx/test_investment_401k/journal.beancount: -------------------------------------------------------------------------------- 1 | 1900-01-01 open Assets:Retirement:ExampleOrg:Company401k 2 | ofx_org: "EXAMPLE" 3 | ofx_broker_id: "example.org" 4 | ofx_account_type: "securities_only" 5 | account_id: "12345678.123456-01" 6 | capital_gains_account: "Income:ExampleOrg:Capital-Gains" 7 | -------------------------------------------------------------------------------- /testdata/reconcile/test_ignore/1/ignore.beancount: -------------------------------------------------------------------------------- 1 | 2013-11-27 * "CR CARD PAYMENT ALEXANDRIA VA" 2 | Liabilities:Credit-Card 66.88 USD 3 | date: 2013-11-27 4 | source_desc: "CR CARD PAYMENT ALEXANDRIA VA" 5 | Expenses:FIXME -66.88 USD 6 | 2013-11-27 open Expenses:FIXME USD 7 | -------------------------------------------------------------------------------- /testdata/source/ofx/test_td_ameritrade/journal.beancount: -------------------------------------------------------------------------------- 1 | 1900-01-01 open Assets:Investment:TD-Ameritrade 2 | ofx_org: "ameritrade.com" 3 | ofx_broker_id: "ameritrade.com" 4 | account_id: "121212121" 5 | ofx_account_type: "securities_and_cash" 6 | 7 | 1900-01-01 commodity AMERITRADE-912810RW0 8 | cusip: "912810RW0" 9 | -------------------------------------------------------------------------------- /testdata/source/ofx/test_vanguard_with_cash_account/journal.beancount: -------------------------------------------------------------------------------- 1 | 1900-01-01 open Assets:Investment:Vanguard 2 | ofx_org: "The Vanguard Group" 3 | ofx_broker_id: "vanguard.com" 4 | ofx_account_type: "securities_and_pending_cash" 5 | account_id: "01234567890" 6 | capital_gains_account: "Income:Vanguard:Capital-Gains" 7 | -------------------------------------------------------------------------------- /testdata/reconcile/test_ofx_basic/0/journal.beancount: -------------------------------------------------------------------------------- 1 | plugin "beancount.plugins.auto_accounts" 2 | 3 | 1900-01-01 open Assets:Retirement:Vanguard:Roth-IRA 4 | ofx_org: "MyBank" 5 | ofx_broker_id: "MyBank" 6 | ofx_account_type: "securities_only" 7 | account_id: "123456789" 8 | div_income_account: "Income:Vanguard:Dividends" 9 | -------------------------------------------------------------------------------- /testdata/source/ofx/test_fidelity_ira/accounts.txt: -------------------------------------------------------------------------------- 1 | Assets:Investment:Fidelity 2 | Assets:Investment:Fidelity:AAPL220624P120 3 | Assets:Investment:Fidelity:Cash 4 | Assets:Investment:Fidelity:DAL220520C42 5 | Assets:Investment:Fidelity:IWM220826C207 6 | Assets:Investment:Fidelity:MSFT220826C310 7 | Assets:Investment:Fidelity:WMT220617P118 8 | -------------------------------------------------------------------------------- /testdata/reconcile/test_ofx_ignore_balance/0/journal.beancount: -------------------------------------------------------------------------------- 1 | plugin "beancount.plugins.auto_accounts" 2 | 3 | 1900-01-01 open Assets:Retirement:Vanguard:Roth-IRA 4 | ofx_org: "MyBank" 5 | ofx_broker_id: "MyBank" 6 | ofx_account_type: "securities_only" 7 | account_id: "123456789" 8 | div_income_account: "Income:Vanguard:Dividends" 9 | -------------------------------------------------------------------------------- /testdata/reconcile/test_ofx_ignore_price/0/journal.beancount: -------------------------------------------------------------------------------- 1 | plugin "beancount.plugins.auto_accounts" 2 | 3 | 1900-01-01 open Assets:Retirement:Vanguard:Roth-IRA 4 | ofx_org: "MyBank" 5 | ofx_broker_id: "MyBank" 6 | ofx_account_type: "securities_only" 7 | account_id: "123456789" 8 | div_income_account: "Income:Vanguard:Dividends" 9 | -------------------------------------------------------------------------------- /testdata/source/ofx/test_multiple_accounts/journal.beancount: -------------------------------------------------------------------------------- 1 | 1900-01-01 open Assets:Checking 2 | ofx_org: "blah" 3 | ofx_broker_id: "" 4 | account_id: "9100" 5 | ofx_account_type: "cash_only" 6 | 7 | 1900-01-01 open Assets:Savings 8 | ofx_org: "blah" 9 | ofx_broker_id: "" 10 | account_id: "9200" 11 | ofx_account_type: "cash_only" 12 | -------------------------------------------------------------------------------- /testdata/source/ofx/test_vanguard_xfer_in/journal.beancount: -------------------------------------------------------------------------------- 1 | 1900-01-01 open Assets:Investment:Vanguard 2 | ofx_org: "Vanguard" 3 | ofx_broker_id: "vanguard.com" 4 | ofx_account_type: "securities_only" 5 | account_id: "12345678" 6 | 1900-01-01 commodity PRBLX 7 | cusip: "701769101" 8 | 1900-01-01 commodity PARMX 9 | cusip: "701765885" 10 | -------------------------------------------------------------------------------- /frontend/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES2015", 4 | "module": "ES2015", 5 | "moduleResolution": "node", 6 | "jsx": "react", 7 | "sourceMap": true, 8 | "strict": true, 9 | "esModuleInterop": true, 10 | "allowSyntheticDefaultImports": true, 11 | "experimentalDecorators": true 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /testdata/reconcile/test_basic/1/candidates.diff: -------------------------------------------------------------------------------- 1 | /journal.beancount 2 | + 3 | +2016-08-10 * "STARBUCKS STORE 12345" 4 | + Liabilities:Credit-Card -2.45 USD 5 | + date: 2016-08-10 6 | + source_desc: "STARBUCKS STORE 12345" 7 | + [0]Expenses:FIXME 2.45 USD 8 | + 9 | +2016-08-10 open Expenses:FIXME USD 10 | -------------------------------------------------------------------------------- /testdata/source/ofx/test_fidelity/accounts.txt: -------------------------------------------------------------------------------- 1 | Assets:Investment:Fidelity 2 | Assets:Investment:Fidelity:CLCT 3 | Assets:Investment:Fidelity:Cash 4 | Assets:Investment:Fidelity:HI 5 | Assets:Investment:Fidelity:INTC 6 | Assets:Investment:Fidelity:RHT 7 | Assets:Investment:Fidelity:SDRL 8 | Assets:Investment:Fidelity:SPY 9 | Assets:Investment:Fidelity:XIN 10 | -------------------------------------------------------------------------------- /testdata/reconcile/test_ignore/2/candidates.diff: -------------------------------------------------------------------------------- 1 | /journal.beancount 2 | + 3 | +2016-08-10 * "STARBUCKS STORE 12345" 4 | + Liabilities:Credit-Card -2.45 USD 5 | + date: 2016-08-10 6 | + source_desc: "STARBUCKS STORE 12345" 7 | + [0]Expenses:FIXME 2.45 USD 8 | + 9 | +2016-08-10 open Expenses:FIXME USD 10 | -------------------------------------------------------------------------------- /testdata/reconcile/test_ignore/1/candidates.diff: -------------------------------------------------------------------------------- 1 | /journal.beancount 2 | + 3 | +2013-12-02 * "NATIONAL FEDERAL DES:TRNSFR" 4 | + Assets:Checking -66.88 USD 5 | + date: 2013-12-02 6 | + source_desc: "NATIONAL FEDERAL DES:TRNSFR" 7 | + [0]Expenses:FIXME 66.88 USD 8 | + 9 | +2013-12-02 open Expenses:FIXME USD 10 | -------------------------------------------------------------------------------- /testdata/source/venmo/balances.csv: -------------------------------------------------------------------------------- 1 | "Start Date","End Date","Start Balance","End Balance" 2 | "2017-01-05","2017-04-04","unknown","unknown" 3 | "2017-04-05","2017-07-03","$0.00","$0.00" 4 | "2017-07-04","2017-10-01","$0.00","$0.00" 5 | "2017-10-02","2017-12-30","$0.00","$1528.25" 6 | "2017-12-31","2018-01-20","$1528.25","$0.00" 7 | "2018-01-21","2018-01-26","unknown","unknown" 8 | -------------------------------------------------------------------------------- /testdata/reconcile/test_basic/1/pending.beancount: -------------------------------------------------------------------------------- 1 | ;; source: mint 2 | ;; date: 2016-08-10 3 | ;; info: {"filename": "/source/mint/mint.csv", "line": 1, "type": "text/csv"} 4 | 5 | 2016-08-10 * "STARBUCKS STORE 12345" 6 | Liabilities:Credit-Card -2.45 USD 7 | date: 2016-08-10 8 | source_desc: "STARBUCKS STORE 12345" 9 | Expenses:FIXME 2.45 USD 10 | -------------------------------------------------------------------------------- /testdata/source/ofx/test_vanguard_roth_ira_matching/training_examples.json: -------------------------------------------------------------------------------- 1 | [ 2 | [ 3 | { 4 | "amount": "31.704 TYCDT", 5 | "date": "2018-06-21", 6 | "key_value_pairs": { 7 | "ofx_type": "REINVEST" 8 | }, 9 | "source_account": "Assets:Retirement:Vanguard:Roth-IRA:TYCDT" 10 | }, 11 | "Income:Vanguard:Dividends:TYCDT" 12 | ] 13 | ] -------------------------------------------------------------------------------- /beancount_import/posting_date.py: -------------------------------------------------------------------------------- 1 | POSTING_DATE_KEY = 'date' 2 | 3 | POSTING_TRANSACTION_DATE_KEY = 'transaction_date' 4 | 5 | def get_posting_date(entry, posting): 6 | """Returns the date associated with a posting.""" 7 | return ((posting.meta and (posting.meta.get(POSTING_DATE_KEY) or 8 | posting.meta.get(POSTING_TRANSACTION_DATE_KEY))) or entry.date) 9 | -------------------------------------------------------------------------------- /testdata/reconcile/test_ignore/2/pending.beancount: -------------------------------------------------------------------------------- 1 | ;; source: mint 2 | ;; date: 2016-08-10 3 | ;; info: {"filename": "/source/mint/mint.csv", "line": 1, "type": "text/csv"} 4 | 5 | 2016-08-10 * "STARBUCKS STORE 12345" 6 | Liabilities:Credit-Card -2.45 USD 7 | date: 2016-08-10 8 | source_desc: "STARBUCKS STORE 12345" 9 | Expenses:FIXME 2.45 USD 10 | -------------------------------------------------------------------------------- /testdata/source/generic_importer/test_cost/import_results.beancount: -------------------------------------------------------------------------------- 1 | ;; date: 2020-01-01 2 | ;; info: {"filename": "/test_cost/input/generic_statement.beancount", "line": 2, "type": "text/plain"} 3 | 4 | ; features: [] 5 | 2020-01-01 * "convert currency" 6 | Assets:Bank -1 USD 7 | date: 2020-01-01 8 | source_desc: "convert currency" 9 | Assets:Saving 2 EUR @ 0.5 USD 10 | -------------------------------------------------------------------------------- /testdata/source/healthequity/data/1234567/cash-transactions-other.csv: -------------------------------------------------------------------------------- 1 | "Date","Transaction","Amount","Cash Balance" 2 | "2016-01-16","Investment: VIIIX","($300.00)","$500.00" 3 | "2016-01-31","Interest for Jan-16","$0.01","$500.01" 4 | "2016-02-12","Investment: VIIIX","$336.73","$836.74" 5 | "2016-02-29","Interest for Feb-16","$0.02","$836.76" 6 | "2016-03-11","Investment: VIIIX","($1,936.76)","$500.00" 7 | -------------------------------------------------------------------------------- /testdata/source/schwab_csv/test_lots/positions/lots/2020-09-25/IAU.csv: -------------------------------------------------------------------------------- 1 | "IAU Lot Details for XXXX-4321 as of 02:45 AM ET, 09/25/2020" 2 | 3 | "Open Date","Quantity","Price","Cost/Share","Market Value","Cost Basis","Gain/Loss $","Gain/Loss %","Holding Period", 4 | "09/24/2020 13:42:07","10","$10.00","$10.00","$100.00","$100.00","$0.00","+0.00%","Short Term", 5 | "Total","10","--","--","$100.00","$100.00","$0.00","+0.00%","--", 6 | -------------------------------------------------------------------------------- /testdata/source/schwab_csv/test_lots/positions/lots/2020-10-25/IAU.csv: -------------------------------------------------------------------------------- 1 | "IAU Lot Details for XXXX-4321 as of 02:45 AM ET, 10/25/2020" 2 | 3 | "Open Date","Quantity","Price","Cost/Share","Market Value","Cost Basis","Gain/Loss $","Gain/Loss %","Holding Period", 4 | "09/24/2020 13:42:07","5","$20.00","$20.00","$100.00","$100.00","$0.00","+0.00%","Short Term", 5 | "Total","5","--","--","$100.00","$100.00","$0.00","+0.00%","--", 6 | -------------------------------------------------------------------------------- /testdata/source/schwab_csv/test_lots/positions/lots/2020-08-25/FNDA.csv: -------------------------------------------------------------------------------- 1 | "FNDA Lot Details for XXXX-4321 as of 02:45 AM ET, 08/25/2020" 2 | 3 | "Open Date","Quantity","Price","Cost/Share","Market Value","Cost Basis","Gain/Loss $","Gain/Loss %","Holding Period", 4 | "08/24/2020 13:22:52","1","$33.89","$34.89","$33.89","$34.89","-$1.00","-2.9%","Short Term", 5 | "Total","1","--","--","$33.89","$34.89","-$1.00","-2.9%","--", 6 | -------------------------------------------------------------------------------- /testdata/source/schwab_csv/test_lots/positions/lots/2020-09-25/FNDA.csv: -------------------------------------------------------------------------------- 1 | "FNDA Lot Details for XXXX-4321 as of 02:46 AM ET, 09/25/2020" 2 | 3 | "Open Date","Quantity","Price","Cost/Share","Market Value","Cost Basis","Gain/Loss $","Gain/Loss %","Holding Period", 4 | "08/24/2020 13:22:52","1","$33.89","$34.89","$33.89","$34.89","-$1.00","-2.9%","Short Term", 5 | "Total","1","--","--","$33.89","$34.89","-$1.00","-2.9%","--", 6 | -------------------------------------------------------------------------------- /examples/data/importers/bank.csv: -------------------------------------------------------------------------------- 1 | "Date","Description","Amount" 2 | 2020-01-01,by debit card-OTHPG 063441 GOOGLE CLOUD,-1 3 | 2020-01-01,by debit card-OTHPG 063444 GOOGLE CLOUD,-1 4 | 2020-01-02,BULK POSTING- 00000008237 250120 GOOGLE,1 5 | 2020-01-02,ATM-WD Some Random ATM Machine,-500 6 | 2020-01-02,BULK POSTING- 00000008237 250120 GOOGLE,1 7 | 2020-01-05,Transfer to 1234567890123,300 8 | 2020-01-14,Transfer to Amex 431145642232,-30 9 | -------------------------------------------------------------------------------- /testdata/source/ofx/test_vanguard_matching/training_examples.json: -------------------------------------------------------------------------------- 1 | [ 2 | [ 3 | { 4 | "amount": "-42.123 VFINX", 5 | "date": "2011-07-15", 6 | "key_value_pairs": { 7 | "desc": "THIS IS A MEMO", 8 | "ofx_memo": "THIS IS A MEMO", 9 | "ofx_type": "SELLMF" 10 | }, 11 | "source_account": "Assets:Investment:Vanguard:VFINX" 12 | }, 13 | "Assets:Checking" 14 | ] 15 | ] -------------------------------------------------------------------------------- /testdata/source/schwab_csv/test_lots/positions/lots/2020-08-25/SCHA.csv: -------------------------------------------------------------------------------- 1 | "SCHA Lot Details for XXXX-4321 as of 02:45 AM ET, 08/25/2020" 2 | 3 | "Open Date","Quantity","Price","Cost/Share","Market Value","Cost Basis","Gain/Loss $","Gain/Loss %","Holding Period", 4 | "08/24/2020 13:42:07","10","$71.39","$71.35","$713.90","$713.50","$0.40","+0.05%","Short Term", 5 | "Total","10","--","--","$713.90","$713.50","$0.40","+0.05%","--", 6 | -------------------------------------------------------------------------------- /testdata/source/schwab_csv/test_lots/positions/lots/2020-10-25/SCHA.csv: -------------------------------------------------------------------------------- 1 | "SCHA Lot Details for XXXX-4321 as of 02:45 AM ET, 10/25/2020" 2 | 3 | "Open Date","Quantity","Price","Cost/Share","Market Value","Cost Basis","Gain/Loss $","Gain/Loss %","Holding Period", 4 | "09/24/2020 13:42:07","10.5","$70.50","$72.56","$740.25","$761.88","-$21.63","-1.05%","Short Term", 5 | "Total","10","--","--","$713.90","$713.50","$0.40","+0.05%","--", 6 | -------------------------------------------------------------------------------- /testdata/source/ofx/test_vanguard401k/journal.beancount: -------------------------------------------------------------------------------- 1 | 1900-01-01 commodity VANGUARD-92202V351 2 | cusip: "92202V351" 3 | 4 | 1900-01-01 open Assets:Retirement:Vanguard:Company401k 5 | ofx_org: "Vanguard" 6 | ofx_broker_id: "vanguard.com" 7 | ofx_account_type: "securities_only" 8 | account_id: "0123456" 9 | capital_gains_account: "Income:Vanguard:Capital-Gains" 10 | match_contribution_account: "Income:Company:Match" 11 | -------------------------------------------------------------------------------- /testdata/source/google_purchases/test_matching/journal.beancount: -------------------------------------------------------------------------------- 1 | plugin "beancount.plugins.auto_accounts" 2 | 3 | 2017-10-15 * "AutoZone" "Relay - Blower Motor" ^google_purchase.88348393419580772365 4 | Expenses:Car 21.84 USD 5 | Assets:Checking -21.84 USD 6 | 7 | 2018-07-23 * "Square - Some merchant" "Some purchase" ^google_purchase.79184124027478022589 8 | Expenses:Miscellaneous 10.00 USD 9 | Assets:Checking -10.00 USD 10 | -------------------------------------------------------------------------------- /testdata/reconcile/test_ofx_cleared/0/candidates.diff: -------------------------------------------------------------------------------- 1 | /journal.beancount 2 | + 3 | +2018-06-21 * "REINVEST - DIV" 4 | + Assets:Retirement:Vanguard:Roth-IRA:TYCDT 31.704 TYCDT {2.94 USD} 5 | + date: 2018-06-21 6 | + ofx_fitid: "7c9254b784a.a9bd.edcfa27b.b" 7 | + ofx_type: "REINVEST" 8 | + Income:Vanguard:Dividends:TYCDT -93.21 USD 9 | + 10 | +2018-06-21 open Income:Vanguard:Dividends:TYCDT USD 11 | -------------------------------------------------------------------------------- /testdata/webserver/test_check_modification/1/transactions.beancount: -------------------------------------------------------------------------------- 1 | 2013-12-02 * "NATIONAL FEDERAL DES:TRNSFR" 2 | Assets:Checking -66.88 USD 3 | date: 2013-12-02 4 | source_desc: "NATIONAL FEDERAL DES:TRNSFR" 5 | Expenses:FIXME 66.88 USD 6 | 7 | 2013-12-03 * "NATIONAL FEDERAL DES:TRNSFR" 8 | Assets:Checking -22.44 USD 9 | date: 2013-12-03 10 | source_desc: "NATIONAL FEDERAL DES:TRNSFR" 11 | Expenses:FIXME 22.44 USD 12 | -------------------------------------------------------------------------------- /testdata/webserver/test_check_modification/2/transactions.beancount: -------------------------------------------------------------------------------- 1 | 2013-12-02 * "NATIONAL FEDERAL DES:TRNSFR" 2 | Assets:Checking -66.88 USD 3 | date: 2013-12-02 4 | source_desc: "NATIONAL FEDERAL DES:TRNSFR" 5 | Expenses:FIXME 66.88 USD 6 | 7 | 2013-12-03 * "NATIONAL FEDERAL DES:TRNSFR" 8 | Assets:Checking -22.44 USD 9 | date: 2013-12-03 10 | source_desc: "NATIONAL FEDERAL DES:TRNSFR" 11 | Expenses:FIXME 22.44 USD 12 | -------------------------------------------------------------------------------- /testdata/webserver/test_check_modification/3/transactions.beancount: -------------------------------------------------------------------------------- 1 | 2013-12-02 * "NATIONAL FEDERAL DES:TRNSFR" 2 | Assets:Checking -66.88 USD 3 | date: 2013-12-02 4 | source_desc: "NATIONAL FEDERAL DES:TRNSFR" 5 | Expenses:FIXME 66.88 USD 6 | 7 | 2013-12-03 * "NATIONAL FEDERAL DES:TRNSFR" 8 | Assets:Checking -22.44 USD 9 | date: 2013-12-03 10 | source_desc: "NATIONAL FEDERAL DES:TRNSFR" 11 | Expenses:FIXME 22.44 USD 12 | -------------------------------------------------------------------------------- /testdata/webserver/test_check_modification/4/transactions.beancount: -------------------------------------------------------------------------------- 1 | 2013-12-02 * "NATIONAL FEDERAL DES:TRNSFR" 2 | Assets:Checking -66.88 USD 3 | date: 2013-12-02 4 | source_desc: "NATIONAL FEDERAL DES:TRNSFR" 5 | Expenses:FIXME 66.88 USD 6 | 7 | 2013-12-03 * "NATIONAL FEDERAL DES:TRNSFR" 8 | Assets:Checking -22.44 USD 9 | date: 2013-12-03 10 | source_desc: "NATIONAL FEDERAL DES:TRNSFR" 11 | Expenses:FIXME 22.44 USD 12 | -------------------------------------------------------------------------------- /testdata/source/ofx/test_checking2_matching/training_examples.json: -------------------------------------------------------------------------------- 1 | [ 2 | [ 3 | { 4 | "amount": "-33.72 USD", 5 | "date": "2018-06-08", 6 | "key_value_pairs": { 7 | "desc": "DIRECT DEBIT WELLSFARGO CRCARDPMT", 8 | "ofx_memo": "DIRECT DEBIT WELLSFARGO CRCARDPMT", 9 | "ofx_type": "INVBANKTRAN" 10 | }, 11 | "source_account": "Assets:Checking:MyBank" 12 | }, 13 | "Liabilities:Credit-Card" 14 | ] 15 | ] -------------------------------------------------------------------------------- /testdata/source/generic_importer/csv/generic_statement.csv: -------------------------------------------------------------------------------- 1 | "Date","Description","Amount" 2 | 2020-01-01,by debit card-OTHPG 063441 GOOGLE CLOUD INDIA PVTTHANE-,-1 3 | 2020-01-01,by debit card-OTHPG 063444 GOOGLE CLOUD INDIA PVTTHANE-,-1 4 | 2020-01-02,BULK POSTING- 00000008237 250120 GOOGLE CLOUD INDIA PVT-,1 5 | 2020-01-02,ATM-WD Some Random ATM Machine,500 6 | 2020-01-02,BULK POSTING- 00000008237 250120 GOOGLE CLOUD INDIA PVT-,1 7 | 2020-01-05,Transfer to 1234567890123,300 8 | -------------------------------------------------------------------------------- /testdata/source/ofx/test_multiple_accounts/import_results.beancount: -------------------------------------------------------------------------------- 1 | ;; date: 2012-06-03 2 | ;; info: {"filename": "/multiple_accounts.ofx", "type": "application/x-ofx"} 3 | 4 | 2012-06-03 balance Assets:Checking 111 USD 5 | 6 | ;; date: 2012-06-03 7 | ;; info: {"filename": "/multiple_accounts.ofx", "type": "application/x-ofx"} 8 | 9 | 2012-06-03 balance Assets:Savings 222 USD 10 | -------------------------------------------------------------------------------- /testdata/source/ofx/test_vanguard_roth_ira_matching/import_results.beancount: -------------------------------------------------------------------------------- 1 | ;; date: 2018-07-03 2 | ;; info: {"filename": "/vanguard_roth_ira.ofx", "type": "application/x-ofx"} 3 | 4 | 2018-07-03 balance Assets:Retirement:Vanguard:Roth-IRA:TYCDT 46.872 TYCDT 5 | 6 | ;; date: 2018-07-03 7 | ;; info: {"filename": "/vanguard_roth_ira.ofx", "type": "application/x-ofx"} 8 | 9 | 2018-07-03 price TYCDT 1.554232804232804232804232804 USD 10 | -------------------------------------------------------------------------------- /testdata/source/ofx/test_vanguard_with_cash_account_matching_missing_transfer/training_examples.json: -------------------------------------------------------------------------------- 1 | [ 2 | [ 3 | { 4 | "amount": "-42.123 VFINX", 5 | "date": "2011-07-15", 6 | "key_value_pairs": { 7 | "desc": "THIS IS A MEMO", 8 | "ofx_memo": "THIS IS A MEMO", 9 | "ofx_type": "SELLMF" 10 | }, 11 | "source_account": "Assets:Investment:Vanguard:VFINX" 12 | }, 13 | "Assets:Investment:Vanguard:Cash" 14 | ] 15 | ] -------------------------------------------------------------------------------- /testdata/webserver/test_check_modification/3/additional/transactions.beancount: -------------------------------------------------------------------------------- 1 | 2013-12-04 * "NATIONAL FEDERAL DES:TRNSFR" #additional 2 | Assets:Checking -11.22 USD 3 | date: 2013-12-04 4 | source_desc: "NATIONAL FEDERAL DES:TRNSFR" 5 | Expenses:FIXME 11.22 USD 6 | 7 | 2013-12-04 * "NATIONAL FEDERAL DES:TRNSFR" #additional 8 | Assets:Checking -5.10 USD 9 | date: 2013-12-04 10 | source_desc: "NATIONAL FEDERAL DES:TRNSFR" 11 | Expenses:FIXME 5.10 USD 12 | -------------------------------------------------------------------------------- /testdata/reconcile/test_basic/1/journal.beancount: -------------------------------------------------------------------------------- 1 | 1900-01-01 open Liabilities:Credit-Card USD 2 | mint_id: "My Credit Card" 3 | 4 | 1900-01-01 open Assets:Checking USD 5 | mint_id: "My Checking" 6 | 7 | 2013-11-27 * "CR CARD PAYMENT ALEXANDRIA VA" 8 | Liabilities:Credit-Card 66.88 USD 9 | date: 2013-11-27 10 | source_desc: "CR CARD PAYMENT ALEXANDRIA VA" 11 | Assets:Checking -66.88 USD 12 | date: 2013-12-02 13 | source_desc: "NATIONAL FEDERAL DES:TRNSFR" 14 | -------------------------------------------------------------------------------- /testdata/source/mint/mint.csv: -------------------------------------------------------------------------------- 1 | "Date","Description","Original Description","Amount","Transaction Type","Category","Account Name","Labels","Notes" 2 | "8/10/2016","Starbucks","STARBUCKS STORE 12345","2.45","debit","Coffee Shops","My Credit Card","","" 3 | "11/27/2013","Transfer from My Checking","CR CARD PAYMENT ALEXANDRIA VA","66.88","credit","Credit Card Payment","My Credit Card","","" 4 | "12/02/2013","National Federal Des","NATIONAL FEDERAL DES:TRNSFR","66.88","debit","Transfer","My Checking","","" 5 | -------------------------------------------------------------------------------- /testdata/source/ofx/test_non_default_capital_gains/training_examples.json: -------------------------------------------------------------------------------- 1 | [ 2 | [ 3 | { 4 | "amount": "-0.04241 VANGUARD-92202V351", 5 | "date": "2013-09-05", 6 | "key_value_pairs": { 7 | "desc": "Investment Expense", 8 | "ofx_memo": "Investment Expense", 9 | "ofx_type": "TRANSFER" 10 | }, 11 | "source_account": "Assets:Retirement:Vanguard:Company401k:Match:VANGUARD-92202V351" 12 | }, 13 | "Expenses:Fees:Vanguard" 14 | ] 15 | ] -------------------------------------------------------------------------------- /testdata/reconcile/test_ofx_basic/0/candidates.diff: -------------------------------------------------------------------------------- 1 | /journal.beancount 2 | + 3 | +2018-06-21 * "REINVEST - DIV" 4 | + Assets:Retirement:Vanguard:Roth-IRA:TYCDT 31.704 TYCDT {2.94 USD} 5 | + date: 2018-06-21 6 | + ofx_fitid: "7c9254b784a.a9bd.edcfa27b.b" 7 | + ofx_type: "REINVEST" 8 | + Income:Vanguard:Dividends:TYCDT -93.21 USD 9 | + 10 | +2018-06-21 open Assets:Retirement:Vanguard:Roth-IRA:TYCDT TYCDT 11 | + 12 | +2018-06-21 open Income:Vanguard:Dividends:TYCDT USD 13 | -------------------------------------------------------------------------------- /testdata/source/schwab_csv/test_lots/positions/lots/2020-09-25/HYLB.csv: -------------------------------------------------------------------------------- 1 | "HYLB Lot Details for XXXX-4321 as of 02:45 AM ET, 09/25/2020" 2 | 3 | "Open Date","Quantity","Price","Cost/Share","Market Value","Cost Basis","Gain/Loss $","Gain/Loss %","Holding Period", 4 | "08/31/2020 13:42:07","12","$10.00","$10.00","$120.00","$120.00","$0.00","+0.00%","Short Term", 5 | "08/30/2020 13:42:07","8","$10.00","$20.00","$80.00","$160.00","-$80.00","-50.00%","Short Term", 6 | "Total","20","--","--","$200.00","$280.00","$0.40","-28.5%","--", 7 | -------------------------------------------------------------------------------- /testdata/source/waveapps/12345678.json: -------------------------------------------------------------------------------- 1 | { 2 | "account_pk": null, 3 | "active": false, 4 | "currency_code": "USD", 5 | "date": "2019-01-10", 6 | "id": 12345678, 7 | "merchant": "Solar4America Ice", 8 | "modified_at": "2019-01-11T19:14:06-05:00", 9 | "note": "", 10 | "payment_account_pk": null, 11 | "receipt_type": "standard", 12 | "source": "android", 13 | "status": "Ready", 14 | "submitted_at": "2019-01-11T19:12:59-05:00", 15 | "subtotal": null, 16 | "taxes": [], 17 | "total": "34.00" 18 | } 19 | -------------------------------------------------------------------------------- /testdata/source/schwab_csv/test_lots/positions/lots/2020-09-25/SCHA.csv: -------------------------------------------------------------------------------- 1 | "SCHA Lot Details for XXXX-4321 as of 02:45 AM ET, 09/25/2020" 2 | 3 | "Open Date","Quantity","Price","Cost/Share","Market Value","Cost Basis","Gain/Loss $","Gain/Loss %","Holding Period", 4 | "09/24/2020 13:42:07","20","$72.56","$72.56","$1451.20","$1451.20","$0.00","+0.05%","Short Term", 5 | "08/24/2020 13:42:07","10","$72.56","$71.35","$725.60","$713.50","$12.10","+1.69%","Short Term", 6 | "Total","10","--","--","$713.90","$713.50","$0.40","+0.05%","--", 7 | -------------------------------------------------------------------------------- /testdata/reconcile/test_ofx_ignore_balance/0/candidates.diff: -------------------------------------------------------------------------------- 1 | /journal.beancount 2 | + 3 | +2018-06-21 * "REINVEST - DIV" 4 | + Assets:Retirement:Vanguard:Roth-IRA:TYCDT 31.704 TYCDT {2.94 USD} 5 | + date: 2018-06-21 6 | + ofx_fitid: "7c9254b784a.a9bd.edcfa27b.b" 7 | + ofx_type: "REINVEST" 8 | + Income:Vanguard:Dividends:TYCDT -93.21 USD 9 | + 10 | +2018-06-21 open Assets:Retirement:Vanguard:Roth-IRA:TYCDT TYCDT 11 | + 12 | +2018-06-21 open Income:Vanguard:Dividends:TYCDT USD 13 | -------------------------------------------------------------------------------- /testdata/reconcile/test_ofx_ignore_price/0/candidates.diff: -------------------------------------------------------------------------------- 1 | /journal.beancount 2 | + 3 | +2018-06-21 * "REINVEST - DIV" 4 | + Assets:Retirement:Vanguard:Roth-IRA:TYCDT 31.704 TYCDT {2.94 USD} 5 | + date: 2018-06-21 6 | + ofx_fitid: "7c9254b784a.a9bd.edcfa27b.b" 7 | + ofx_type: "REINVEST" 8 | + Income:Vanguard:Dividends:TYCDT -93.21 USD 9 | + 10 | +2018-06-21 open Assets:Retirement:Vanguard:Roth-IRA:TYCDT TYCDT 11 | + 12 | +2018-06-21 open Income:Vanguard:Dividends:TYCDT USD 13 | -------------------------------------------------------------------------------- /testdata/source/waveapps/test_matching/import_results.beancount: -------------------------------------------------------------------------------- 1 | ;; date: 2019-01-19 2 | ;; info: {"filename": "/10000001.jpg", "type": "image/jpeg"} 3 | 4 | ; features: [ 5 | ; null, 6 | ; null 7 | ; ] 8 | 2019-01-19 * "Robee's Falafel" "Falafel plate" ^waveapps.10000001 9 | associated_data0: "{\"description\": \"Receipt image\", \"link\": \"waveapps.10000001\", \"path\": \"/10000001.jpg\", \"type\": \"image/jpeg\"}" 10 | Expenses:FIXME 13.50 USD 11 | Expenses:FIXME -13.50 USD 12 | -------------------------------------------------------------------------------- /testdata/reconcile/test_amazon_large/0/journal.beancount: -------------------------------------------------------------------------------- 1 | plugin "beancount.plugins.auto_accounts" 2 | 3 | 2021-08-29 * "Transaction 1" "Order" 4 | Expenses:FIXME 5 | Liabilities:CreditCard -5.00 USD 6 | 7 | 2021-08-31 * "Transaction 2" "Order" 8 | Expenses:FIXME 9 | Liabilities:CreditCard -60.35 USD 10 | 11 | 2021-09-11 * "Transaction 3" "Order" 12 | Expenses:FIXME 13 | Liabilities:CreditCard -7.00 USD 14 | 15 | 2021-09-14 * "Transaction 4" "Order" 16 | Expenses:Groceries 17 | Liabilities:CreditCard -149.81 USD 18 | -------------------------------------------------------------------------------- /testdata/source/schwab_csv/test_lots/journal.beancount: -------------------------------------------------------------------------------- 1 | 1900-01-01 open Income:Dividend:Schwab 2 | 1900-01-01 open Income:Capital-Gains:Schwab 3 | 1900-01-01 open Expenses:Brokerage-Fees:Schwab 4 | 1900-01-01 open Assets:Schwab:Intelligent-4321 5 | schwab_account: "Intelligent XXXX-4321" 6 | div_income_account: "Income:Dividend:Schwab" 7 | interest_income_account: "Income:Interest:Schwab" 8 | capital_gains_account: "Income:Capital-Gains:Schwab" 9 | fees_account: "Expenses:Brokerage-Fees:Schwab" 10 | 1900-01-01 open Assets:Schwab:Intelligent-4321:Cash 11 | -------------------------------------------------------------------------------- /examples/README.md: -------------------------------------------------------------------------------- 1 | To run these example, first ensure you have installed Beancount-import into your 2 | current Python 3 environment (a virtualenv is recommended). 3 | 4 | Then change your current directory to one of the following example directories, 5 | and type `./run.py` or `python3 ./run.py` and open the URL that is printed in a 6 | web browser. 7 | 8 | Examples: 9 | 10 | - `fresh`: Example of importing transactions starting with an empty journal. 11 | - `manually_entered`: Example of importing transactions corresponding to 12 | existing, manually-entered transactions. 13 | -------------------------------------------------------------------------------- /frontend/third_party/fava/codemirror/helpers.js: -------------------------------------------------------------------------------- 1 | import CodeMirror from 'codemirror/lib/codemirror'; 2 | import { fuzzytest } from '../helpers'; 3 | 4 | export function getCurrentWord(cursor, line) { 5 | return line.slice(0, cursor.ch).match(/(\S*)$/)[0]; 6 | } 7 | 8 | export function fuzzyMatch(cursor, currentWord, completions) { 9 | const search = currentWord.toLowerCase(); 10 | return { 11 | list: completions.filter(completion => fuzzytest(search, completion)), 12 | from: new CodeMirror.Pos(cursor.line, cursor.ch - currentWord.length), 13 | to: cursor, 14 | }; 15 | } 16 | -------------------------------------------------------------------------------- /testdata/source/ofx/test_investment_buy_sell_income/journal.beancount: -------------------------------------------------------------------------------- 1 | 1900-01-01 open Assets:Investment:MyBank 2 | ofx_org: "MyBank" 3 | ofx_broker_id: "MyBank" 4 | ofx_account_type: "securities_and_cash" 5 | account_id: "123456789" 6 | div_income_account: "Income:MyBank:Dividends" 7 | interest_income_account: "Income:MyBank:Interest" 8 | capital_gains_account: "Income:MyBank:Capital-Gains" 9 | fees_account: "Expenses:Investment:MyBank:Fees" 10 | commission_account: "Expenses:Investment:MyBank:Commission" 11 | 12 | 1900-01-01 commodity QTSAQ 13 | equivalent_currency: "USD" 14 | -------------------------------------------------------------------------------- /testdata/reconcile/test_ignore/2/ignore.beancount: -------------------------------------------------------------------------------- 1 | 2013-11-27 * "CR CARD PAYMENT ALEXANDRIA VA" 2 | Liabilities:Credit-Card 66.88 USD 3 | date: 2013-11-27 4 | source_desc: "CR CARD PAYMENT ALEXANDRIA VA" 5 | Expenses:FIXME -66.88 USD 6 | 2013-11-27 open Expenses:FIXME USD 7 | 8 | 2013-12-02 * "NATIONAL FEDERAL DES:TRNSFR" 9 | Assets:Checking -66.88 USD 10 | date: 2013-12-02 11 | source_desc: "NATIONAL FEDERAL DES:TRNSFR" 12 | Expenses:FIXME 66.88 USD 13 | 14 | 2013-12-02 open Expenses:FIXME USD 15 | -------------------------------------------------------------------------------- /testdata/source/ofx/test_checking2_matching/journal.beancount: -------------------------------------------------------------------------------- 1 | plugin "beancount.plugins.auto_accounts" 2 | 3 | 1900-01-01 open Assets:Checking:MyBank 4 | ofx_org: "MyBank" 5 | ofx_broker_id: "MyBank" 6 | ofx_account_type: "cash_only" 7 | account_id: "123456789" 8 | 9 | 2018-06-08 * "INVBANKTRAN - DIRECT DEBIT WELLSFARGO CRCARDPMT" 10 | Assets:Checking:MyBank -33.72 USD 11 | date: 2018-06-08 12 | ofx_fitid: "46f2144d0ce515a855234ec" 13 | ofx_memo: "DIRECT DEBIT WELLSFARGO CRCARDPMT" 14 | ofx_type: "INVBANKTRAN" 15 | cleared: TRUE 16 | Liabilities:Credit-Card 33.72 USD 17 | -------------------------------------------------------------------------------- /testdata/reconcile/test_ofx_ignore_balance/0/pending.beancount: -------------------------------------------------------------------------------- 1 | ;; source: ofx 2 | ;; date: 2018-06-21 3 | ;; info: {"filename": "/source/ofx/vanguard_roth_ira.ofx", "type": "application/x-ofx"} 4 | 5 | 2018-06-21 * "REINVEST - DIV" 6 | Assets:Retirement:Vanguard:Roth-IRA:TYCDT 31.704 TYCDT {2.94 USD} 7 | date: 2018-06-21 8 | ofx_fitid: "7c9254b784a.a9bd.edcfa27b.b" 9 | ofx_type: "REINVEST" 10 | Income:Vanguard:Dividends:TYCDT -93.21 USD 11 | 12 | ;; source: ofx 13 | ;; date: 2018-07-03 14 | ;; info: null 15 | 16 | 2018-07-03 price TYCDT 1.554232804232804232804232804 USD 17 | -------------------------------------------------------------------------------- /testdata/source/ofx/test_vanguard_with_cash_account_matching_missing_primary/journal.beancount: -------------------------------------------------------------------------------- 1 | plugin "beancount.plugins.auto_accounts" 2 | 1900-01-01 open Assets:Investment:Vanguard 3 | ofx_org: "The Vanguard Group" 4 | ofx_broker_id: "vanguard.com" 5 | ofx_account_type: "securities_and_pending_cash" 6 | account_id: "01234567890" 7 | capital_gains_account: "Income:Vanguard:Capital-Gains" 8 | 9 | 2011-07-15 * "Transfer due to: SELLMF - THIS IS A MEMO" 10 | Assets:Investment:Vanguard:Cash -4212.30 USD 11 | ofx_fitid: ">01234567890.0123.07152011.0" 12 | cleared: TRUE 13 | Expenses:FIXME 4212.30 USD 14 | -------------------------------------------------------------------------------- /testdata/source/google_purchases/test_invalid/journal.beancount: -------------------------------------------------------------------------------- 1 | plugin "beancount.plugins.auto_accounts" 2 | 3 | 2017-10-15 * "AutoZone" "Relay - Blower Motor" ^google_purchase.88348393419580772365 4 | invalid0: "1 extra" 5 | Expenses:Car 21.84 USD 6 | Assets:Checking -21.84 USD 7 | 8 | 2017-10-15 * "AutoZone" "Relay - Blower Motor" ^google_purchase.88348393419580772365 9 | invalid0: "1 extra" 10 | Expenses:Car 21.84 USD 11 | Assets:Checking -21.84 USD 12 | 13 | 2018-07-23 * "Square - Some merchant" "Some purchase" ^google_purchase.79184124027478022589 14 | Expenses:Miscellaneous 10.00 USD 15 | Assets:Checking -10.00 USD 16 | -------------------------------------------------------------------------------- /testdata/source/healthequity/data/1234567/investment-transactions.csv: -------------------------------------------------------------------------------- 1 | "Date","Fund","Category","Description","Price","Amount","Shares","Total Shares","Total Value" 2 | "2016-01-19","VIIIX","Buy","Investment: VIIIX","$170.11","$300.00","1.763","1.763","$300.00" 3 | "2016-02-12","VIIIX","Sell","Investment: VIIIX","$191.00","($336.73)","-1.763","0.000","$0.00" 4 | "2016-03-11","VIIIX","Buy","Investment: VIIIX","$185.58","$1,936.76","10.436","10.436","$1,936.76" 5 | "2016-03-16","VIIIX","Dividend","Investment: VIIIX","$185.71","$10.40","0.056","10.492","$1,948.47" 6 | "2016-06-16","VIIIX","Dividend","Investment: VIIIX","$191.57","$9.77","0.051","10.543","$2019.72" 7 | -------------------------------------------------------------------------------- /testdata/source/ofx/test_investment_buy_sell_income/accounts.txt: -------------------------------------------------------------------------------- 1 | Assets:Investment:MyBank 2 | Assets:Investment:MyBank:Cash 3 | Assets:Investment:MyBank:DGTGU 4 | Assets:Investment:MyBank:DSNTH 5 | Assets:Investment:MyBank:EEBHF 6 | Assets:Investment:MyBank:FCSNO 7 | Assets:Investment:MyBank:IQVJK 8 | Assets:Investment:MyBank:MCYFM 9 | Assets:Investment:MyBank:MXMUK 10 | Assets:Investment:MyBank:OMCNS 11 | Assets:Investment:MyBank:RDTAF 12 | Assets:Investment:MyBank:SDVMV 13 | Assets:Investment:MyBank:SVDIE 14 | Assets:Investment:MyBank:URMFO 15 | Assets:Investment:MyBank:WDUZQ 16 | Assets:Investment:MyBank:WKPSD 17 | Assets:Investment:MyBank:XBFMS 18 | -------------------------------------------------------------------------------- /testdata/source/ofx/test_vanguard_roth_ira_matching/journal.beancount: -------------------------------------------------------------------------------- 1 | plugin "beancount.plugins.auto_accounts" 2 | 3 | 1900-01-01 open Assets:Retirement:Vanguard:Roth-IRA 4 | ofx_org: "MyBank" 5 | ofx_broker_id: "MyBank" 6 | ofx_account_type: "securities_only" 7 | account_id: "123456789" 8 | div_income_account: "Income:Vanguard:Dividends" 9 | 10 | 2018-06-21 * "REINVEST - DIV" 11 | Assets:Retirement:Vanguard:Roth-IRA:TYCDT 31.704 TYCDT {2.94 USD} 12 | date: 2018-06-21 13 | ofx_fitid: "7c9254b784a.a9bd.edcfa27b.b" 14 | ofx_type: "REINVEST" 15 | cleared: TRUE 16 | Income:Vanguard:Dividends:TYCDT -93.21 USD 17 | -------------------------------------------------------------------------------- /beancount_import/sorted_entry_printer.py: -------------------------------------------------------------------------------- 1 | import beancount.parser.printer 2 | 3 | 4 | class SortedEntryPrinter(beancount.parser.printer.EntryPrinter): 5 | """A subclass of EntryPrinter that sorts the meta keys before printing. 6 | 7 | This preserves the behavior of EntryPrinter from Beancount 2.3.5 and 8 | earlier. 9 | 10 | """ 11 | def __init__(self, **kwargs): 12 | super().__init__(**kwargs) 13 | 14 | def write_metadata(self, meta, oss, prefix=None): 15 | if meta is None: 16 | sorted_meta = None 17 | else: 18 | sorted_meta = dict(sorted(meta.items())) 19 | super().write_metadata(sorted_meta, oss, prefix) 20 | -------------------------------------------------------------------------------- /testdata/source/schwab_csv/test_lots/positions/lots/2020-10-25/HYLB.csv: -------------------------------------------------------------------------------- 1 | "HYLB Lot Details for XXXX-4321 as of 02:45 AM ET, 10/25/2020" 2 | 3 | "Open Date","Transaction Open","Quantity","Price","Cost/Share","Transaction CPS","Market Value","Cost Basis","Transaction CB","Gain/Loss $","Transaction G/L $","Gain/Loss %","Transaction G/L %","Holding Period","Disallowed Loss", 4 | "08/31/2020 00:00:00","--","24","$1.00","$5.00","$24.00","--","$120.00","$0.00","--","+0.00%","--","Short Term","--", 5 | "08/30/2020 13:42:07","--","16","$1.00","$10.00","$16.00","--","$160.00","$0.00","--","+0.00%","--","Short Term","--", 6 | "Total","--","20","--","--","--","$40.00","$280.00","--","$0.00","--","+0.00%","--","--","--", 7 | -------------------------------------------------------------------------------- /testdata/reconcile/test_ofx_basic/0/pending.beancount: -------------------------------------------------------------------------------- 1 | ;; source: ofx 2 | ;; date: 2018-06-21 3 | ;; info: {"filename": "/source/ofx/vanguard_roth_ira.ofx", "type": "application/x-ofx"} 4 | 5 | 2018-06-21 * "REINVEST - DIV" 6 | Assets:Retirement:Vanguard:Roth-IRA:TYCDT 31.704 TYCDT {2.94 USD} 7 | date: 2018-06-21 8 | ofx_fitid: "7c9254b784a.a9bd.edcfa27b.b" 9 | ofx_type: "REINVEST" 10 | Income:Vanguard:Dividends:TYCDT -93.21 USD 11 | 12 | ;; source: ofx 13 | ;; date: 2018-07-03 14 | ;; info: null 15 | 16 | 2018-07-03 balance Assets:Retirement:Vanguard:Roth-IRA:TYCDT 46.872 TYCDT 17 | 18 | 2018-07-03 price TYCDT 1.554232804232804232804232804 USD 19 | -------------------------------------------------------------------------------- /testdata/reconcile/test_ofx_cleared/0/pending.beancount: -------------------------------------------------------------------------------- 1 | ;; source: ofx 2 | ;; date: 2018-06-21 3 | ;; info: {"filename": "/source/ofx/vanguard_roth_ira.ofx", "type": "application/x-ofx"} 4 | 5 | 2018-06-21 * "REINVEST - DIV" 6 | Assets:Retirement:Vanguard:Roth-IRA:TYCDT 31.704 TYCDT {2.94 USD} 7 | date: 2018-06-21 8 | ofx_fitid: "7c9254b784a.a9bd.edcfa27b.b" 9 | ofx_type: "REINVEST" 10 | Income:Vanguard:Dividends:TYCDT -93.21 USD 11 | 12 | ;; source: ofx 13 | ;; date: 2018-07-03 14 | ;; info: null 15 | 16 | 2018-07-03 balance Assets:Retirement:Vanguard:Roth-IRA:TYCDT 46.872 TYCDT 17 | 18 | 2018-07-03 price TYCDT 1.554232804232804232804232804 USD 19 | -------------------------------------------------------------------------------- /testdata/reconcile/test_ofx_ignore_price/0/pending.beancount: -------------------------------------------------------------------------------- 1 | ;; source: ofx 2 | ;; date: 2018-06-21 3 | ;; info: {"filename": "/source/ofx/vanguard_roth_ira.ofx", "type": "application/x-ofx"} 4 | 5 | 2018-06-21 * "REINVEST - DIV" 6 | Assets:Retirement:Vanguard:Roth-IRA:TYCDT 31.704 TYCDT {2.94 USD} 7 | date: 2018-06-21 8 | ofx_fitid: "7c9254b784a.a9bd.edcfa27b.b" 9 | ofx_type: "REINVEST" 10 | Income:Vanguard:Dividends:TYCDT -93.21 USD 11 | 12 | ;; source: ofx 13 | ;; date: 2018-07-03 14 | ;; info: null 15 | 16 | 2018-07-03 balance Assets:Retirement:Vanguard:Roth-IRA:TYCDT 46.872 TYCDT 17 | 18 | 2018-07-03 price TYCDT 1.554232804232804232804232804 USD 19 | -------------------------------------------------------------------------------- /testdata/reconcile/test_ignore/1/pending.beancount: -------------------------------------------------------------------------------- 1 | ;; source: mint 2 | ;; date: 2013-12-02 3 | ;; info: {"filename": "/source/mint/mint.csv", "line": 3, "type": "text/csv"} 4 | 5 | 2013-12-02 * "NATIONAL FEDERAL DES:TRNSFR" 6 | Assets:Checking -66.88 USD 7 | date: 2013-12-02 8 | source_desc: "NATIONAL FEDERAL DES:TRNSFR" 9 | Expenses:FIXME 66.88 USD 10 | 11 | ;; source: mint 12 | ;; date: 2016-08-10 13 | ;; info: {"filename": "/source/mint/mint.csv", "line": 1, "type": "text/csv"} 14 | 15 | 2016-08-10 * "STARBUCKS STORE 12345" 16 | Liabilities:Credit-Card -2.45 USD 17 | date: 2016-08-10 18 | source_desc: "STARBUCKS STORE 12345" 19 | Expenses:FIXME 2.45 USD 20 | -------------------------------------------------------------------------------- /testdata/reconcile/test_basic/0/candidates.diff: -------------------------------------------------------------------------------- 1 | /journal.beancount 2 | + 3 | +2013-11-27 * "CR CARD PAYMENT ALEXANDRIA VA" 4 | + Liabilities:Credit-Card 66.88 USD 5 | + date: 2013-11-27 6 | + source_desc: "CR CARD PAYMENT ALEXANDRIA VA" 7 | + Assets:Checking -66.88 USD 8 | + date: 2013-12-02 9 | + source_desc: "NATIONAL FEDERAL DES:TRNSFR" 10 | 11 | 12 | /journal.beancount 13 | + 14 | +2013-11-27 * "CR CARD PAYMENT ALEXANDRIA VA" 15 | + Liabilities:Credit-Card 66.88 USD 16 | + date: 2013-11-27 17 | + source_desc: "CR CARD PAYMENT ALEXANDRIA VA" 18 | + [0]Expenses:FIXME -66.88 USD 19 | + 20 | +2013-11-27 open Expenses:FIXME USD 21 | -------------------------------------------------------------------------------- /testdata/reconcile/test_ignore/0/candidates.diff: -------------------------------------------------------------------------------- 1 | /journal.beancount 2 | + 3 | +2013-11-27 * "CR CARD PAYMENT ALEXANDRIA VA" 4 | + Liabilities:Credit-Card 66.88 USD 5 | + date: 2013-11-27 6 | + source_desc: "CR CARD PAYMENT ALEXANDRIA VA" 7 | + Assets:Checking -66.88 USD 8 | + date: 2013-12-02 9 | + source_desc: "NATIONAL FEDERAL DES:TRNSFR" 10 | 11 | 12 | /journal.beancount 13 | + 14 | +2013-11-27 * "CR CARD PAYMENT ALEXANDRIA VA" 15 | + Liabilities:Credit-Card 66.88 USD 16 | + date: 2013-11-27 17 | + source_desc: "CR CARD PAYMENT ALEXANDRIA VA" 18 | + [0]Expenses:FIXME -66.88 USD 19 | + 20 | +2013-11-27 open Expenses:FIXME USD 21 | -------------------------------------------------------------------------------- /mypy.ini: -------------------------------------------------------------------------------- 1 | [mypy] 2 | warn_unused_configs = True 3 | ignore_missing_imports = True 4 | 5 | # modules with note 6 | # note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked] 7 | 8 | 9 | # modules with errors 10 | [mypy-beancount_import/source/stockplanconnect.*] 11 | ignore_errors = True 12 | [mypy-beancount_import/source/amazon_invoice_sanitize.*] 13 | ignore_errors = True 14 | #[mypy-beancount_import/source/amazon_invoice.*] 15 | #ignore_errors = True 16 | [mypy-beancount_import/source/schwab_csv.*] 17 | ignore_errors = True 18 | [mypy-beancount_import/source/ofx.*] 19 | ignore_errors = True 20 | [mypy-beancount_import/source/amazon.*] 21 | ignore_errors = True 22 | -------------------------------------------------------------------------------- /testdata/reconcile/test_ofx_cleared/0/journal.beancount: -------------------------------------------------------------------------------- 1 | plugin "beancount.plugins.auto_accounts" 2 | 3 | 1900-01-01 open Assets:Retirement:Vanguard:Roth-IRA 4 | ofx_org: "MyBank" 5 | ofx_broker_id: "MyBank" 6 | ofx_account_type: "securities_only" 7 | account_id: "123456789" 8 | div_income_account: "Income:Vanguard:Dividends" 9 | cleared_before: 2018-01-01 10 | 11 | 1900-01-01 open Assets:Retirement:Vanguard:Roth-IRA:TYCDT TYCDT 12 | 13 | 2017-12-31 * "Opening Balance" 14 | Assets:Retirement:Vanguard:Roth-IRA:TYCDT 10.168 TYCDT { 79.22 USD } 15 | Equity:Opening-Balances 16 | 17 | 2018-01-01 * "Mysterious gift" 18 | Assets:Retirement:Vanguard:Roth-IRA:TYCDT 5.000 TYCDT { 79.30 USD } 19 | uncleared: TRUE 20 | Equity:Opening-Balances 21 | -------------------------------------------------------------------------------- /testdata/reconcile/test_basic/2/journal.beancount: -------------------------------------------------------------------------------- 1 | 1900-01-01 open Liabilities:Credit-Card USD 2 | mint_id: "My Credit Card" 3 | 4 | 1900-01-01 open Assets:Checking USD 5 | mint_id: "My Checking" 6 | 7 | 2013-11-27 * "CR CARD PAYMENT ALEXANDRIA VA" 8 | Liabilities:Credit-Card 66.88 USD 9 | date: 2013-11-27 10 | source_desc: "CR CARD PAYMENT ALEXANDRIA VA" 11 | Assets:Checking -66.88 USD 12 | date: 2013-12-02 13 | source_desc: "NATIONAL FEDERAL DES:TRNSFR" 14 | 15 | 2016-08-10 * "STARBUCKS STORE 12345" 16 | Liabilities:Credit-Card -2.45 USD 17 | date: 2016-08-10 18 | source_desc: "STARBUCKS STORE 12345" 19 | Expenses:Coffee 2.45 USD 20 | 21 | 2016-08-10 open Expenses:Coffee USD 22 | -------------------------------------------------------------------------------- /testdata/reconcile/test_ofx_matching/0/journal.beancount: -------------------------------------------------------------------------------- 1 | plugin "beancount.plugins.auto_accounts" 2 | 3 | 1900-01-01 open Assets:Retirement:Vanguard:Roth-IRA 4 | ofx_org: "MyBank" 5 | ofx_broker_id: "MyBank" 6 | ofx_account_type: "securities_only" 7 | account_id: "123456789" 8 | div_income_account: "Income:Vanguard:Dividends" 9 | 10 | 2018-06-21 * "REINVEST - DIV" 11 | Assets:Retirement:Vanguard:Roth-IRA:TYCDT 31.704 TYCDT {2.94 USD} 12 | date: 2018-06-21 13 | ofx_fitid: "7c9254b784a.a9bd.edcfa27b.b" 14 | ofx_type: "REINVEST" 15 | Income:Vanguard:Dividends:TYCDT -93.21 USD 16 | 17 | 2018-07-03 balance Assets:Retirement:Vanguard:Roth-IRA:TYCDT 31.704 TYCDT 18 | 19 | 2018-07-03 price TYCDT 84.20 USD 20 | -------------------------------------------------------------------------------- /testdata/source/ofx/test_vanguard_invalid/training_examples.json: -------------------------------------------------------------------------------- 1 | [ 2 | [ 3 | { 4 | "amount": "-42.123 VFINX", 5 | "date": "2011-07-15", 6 | "key_value_pairs": { 7 | "desc": "THIS IS A MEMO", 8 | "ofx_memo": "THIS IS A MEMO", 9 | "ofx_type": "SELLMF" 10 | }, 11 | "source_account": "Assets:Investment:Vanguard:VFINX" 12 | }, 13 | "Assets:Checking" 14 | ], 15 | [ 16 | { 17 | "amount": "-42.123 VFINX", 18 | "date": "2011-07-15", 19 | "key_value_pairs": { 20 | "desc": "THIS IS A MEMO", 21 | "ofx_memo": "THIS IS A MEMO", 22 | "ofx_type": "SELLMF" 23 | }, 24 | "source_account": "Assets:Investment:Vanguard:VFINX" 25 | }, 26 | "Assets:Checking" 27 | ] 28 | ] -------------------------------------------------------------------------------- /beancount_import/source/waveapps_test.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | import pytest 4 | 5 | from .source_test import check_source_example 6 | 7 | testdata_dir = os.path.realpath( 8 | os.path.join( 9 | os.path.dirname(__file__), '..', '..', 'testdata', 'source', 10 | 'waveapps')) 11 | 12 | examples = [ 13 | 'test_basic', 14 | 'test_matching', 15 | ] 16 | 17 | 18 | @pytest.mark.parametrize('name', examples) 19 | def test_source(name: str): 20 | check_source_example( 21 | example_dir=os.path.join(testdata_dir, name), 22 | source_spec={ 23 | 'module': 'beancount_import.source.waveapps', 24 | 'receipt_directory': testdata_dir, 25 | 'link_prefix': 'waveapps.', 26 | }, 27 | replacements=[(testdata_dir, '')]) 28 | -------------------------------------------------------------------------------- /beancount_import/source/healthequity_test.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | import pytest 4 | 5 | from .source_test import check_source_example 6 | 7 | testdata_dir = os.path.realpath( 8 | os.path.join( 9 | os.path.dirname(__file__), '..', '..', 'testdata', 'source', 10 | 'healthequity')) 11 | 12 | examples = [ 13 | 'test_basic', 14 | 'test_matching', 15 | 'test_invalid', 16 | ] 17 | 18 | 19 | @pytest.mark.parametrize('name', examples) 20 | def test_source(name: str): 21 | check_source_example( 22 | example_dir=os.path.join(testdata_dir, name), 23 | source_spec={ 24 | 'module': 'beancount_import.source.healthequity', 25 | 'directory': os.path.join(testdata_dir, 'data'), 26 | }, 27 | replacements=[(testdata_dir, '')]) 28 | -------------------------------------------------------------------------------- /beancount_import/source/venmo_test.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | import pytest 4 | 5 | from .source_test import check_source_example 6 | 7 | testdata_dir = os.path.realpath( 8 | os.path.join( 9 | os.path.dirname(__file__), '..', '..', 'testdata', 'source', 'venmo')) 10 | 11 | examples = [ 12 | 'test_basic', 13 | 'test_matching', 14 | 'test_invalid_references', 15 | ] 16 | 17 | 18 | @pytest.mark.parametrize('name', examples) 19 | def test_source(name: str): 20 | check_source_example( 21 | example_dir=os.path.join(testdata_dir, name), 22 | source_spec={ 23 | 'module': 'beancount_import.source.venmo', 24 | 'directory': testdata_dir, 25 | 'assets_account': 'Assets:Venmo', 26 | }, 27 | replacements=[(testdata_dir, '')]) 28 | -------------------------------------------------------------------------------- /testdata/source/mint/test_training_examples/journal.beancount: -------------------------------------------------------------------------------- 1 | plugin "beancount.plugins.auto_accounts" 2 | 3 | 1900-01-01 open Liabilities:Credit-Card USD 4 | mint_id: "My Credit Card" 5 | 6 | 1900-01-01 open Assets:Checking USD 7 | mint_id: "My Checking" 8 | 9 | 2013-11-27 * "CR CARD PAYMENT ALEXANDRIA VA" 10 | Liabilities:Credit-Card 66.88 USD 11 | date: 2013-11-27 12 | source_desc: "CR CARD PAYMENT ALEXANDRIA VA" 13 | cleared: TRUE 14 | Assets:Checking -66.88 USD 15 | date: 2013-12-02 16 | source_desc: "NATIONAL FEDERAL DES:TRNSFR" 17 | cleared: TRUE 18 | 19 | 2016-08-10 * "STARBUCKS STORE 12345" 20 | Liabilities:Credit-Card -2.45 USD 21 | date: 2016-08-10 22 | source_desc: "STARBUCKS STORE 12345" 23 | cleared: TRUE 24 | Expenses:Coffee 2.45 USD 25 | -------------------------------------------------------------------------------- /testdata/source/ofx/test_vanguard_invalid/import_results.beancount: -------------------------------------------------------------------------------- 1 | ;; date: 2011-07-26 2 | ;; info: {"filename": "/vanguard.ofx", "type": "application/x-ofx"} 3 | 4 | 2011-07-26 balance Assets:Investment:Vanguard:VFINX 102.0 VFINX 5 | 6 | ;; date: 2011-07-26 7 | ;; info: {"filename": "/vanguard.ofx", "type": "application/x-ofx"} 8 | 9 | 2011-07-26 price VFINX 100.00 USD 10 | 11 | ;; date: 2011-07-26 12 | ;; info: {"filename": "/vanguard.ofx", "type": "application/x-ofx"} 13 | 14 | 2011-07-26 balance Assets:Investment:Vanguard:VFIAX 142.2 VFIAX 15 | 16 | ;; date: 2011-07-26 17 | ;; info: {"filename": "/vanguard.ofx", "type": "application/x-ofx"} 18 | 19 | 2011-07-26 price VFIAX 100.42 USD 20 | -------------------------------------------------------------------------------- /testdata/source/ofx/test_vanguard_matching/import_results.beancount: -------------------------------------------------------------------------------- 1 | ;; date: 2011-07-26 2 | ;; info: {"filename": "/vanguard.ofx", "type": "application/x-ofx"} 3 | 4 | 2011-07-26 balance Assets:Investment:Vanguard:VFINX 102.0 VFINX 5 | 6 | ;; date: 2011-07-26 7 | ;; info: {"filename": "/vanguard.ofx", "type": "application/x-ofx"} 8 | 9 | 2011-07-26 price VFINX 100.00 USD 10 | 11 | ;; date: 2011-07-26 12 | ;; info: {"filename": "/vanguard.ofx", "type": "application/x-ofx"} 13 | 14 | 2011-07-26 balance Assets:Investment:Vanguard:VFIAX 142.2 VFIAX 15 | 16 | ;; date: 2011-07-26 17 | ;; info: {"filename": "/vanguard.ofx", "type": "application/x-ofx"} 18 | 19 | 2011-07-26 price VFIAX 100.42 USD 20 | -------------------------------------------------------------------------------- /beancount_import/thread_helpers.py: -------------------------------------------------------------------------------- 1 | import concurrent.futures 2 | import threading 3 | 4 | class DaemonThreadExecutor(concurrent.futures.Executor): 5 | """Launches each task in a separate daemon thread.""" 6 | 7 | def submit(self, fn, *args, **kwargs): 8 | f = concurrent.futures.Future() 9 | def wrapper(): 10 | if not f.set_running_or_notify_cancel(): 11 | return 12 | try: 13 | f.set_result(fn(*args, **kwargs)) 14 | except Exception as e: 15 | f.set_exception(e) 16 | 17 | t = threading.Thread(target = wrapper) 18 | t.daemon = True 19 | t.start() 20 | return f 21 | 22 | 23 | def call_in_new_thread(f, *args, **kwargs): 24 | executor = DaemonThreadExecutor() 25 | return executor.submit(f, *args, **kwargs) 26 | -------------------------------------------------------------------------------- /testdata/source/schwab_csv/test_basic/accounts.txt: -------------------------------------------------------------------------------- 1 | Assets:Schwab:Brokerage-1234 2 | Assets:Schwab:Brokerage-1234:Cash 3 | Assets:Schwab:Brokerage-1234:FB 4 | Assets:Schwab:Brokerage-1234:QQZ 5 | Assets:Schwab:Brokerage-1234:SMAL0331202012400P 6 | Assets:Schwab:Brokerage-1234:SMAL0331202018400C 7 | Assets:Schwab:Brokerage-1234:SMAL033120208400P 8 | Assets:Schwab:Brokerage-1234:SPAC1 9 | Assets:Schwab:Brokerage-1234:SPY0331202028400P 10 | Assets:Schwab:Checking 11 | Assets:Schwab:Intelligent-4321 12 | Assets:Schwab:Intelligent-4321:Cash 13 | Assets:Schwab:Intelligent-4321:FNDA 14 | Assets:Schwab:Intelligent-4321:GOOG 15 | Assets:Schwab:Intelligent-4321:HYLB 16 | Assets:Schwab:Intelligent-4321:SCHA 17 | Assets:Schwab:Intelligent-4321:SMAL040120203200P 18 | Assets:Schwab:Intelligent-4321:SMAL040320208300C 19 | Assets:Schwab:Intelligent-4321:SMAL061920201000P 20 | -------------------------------------------------------------------------------- /testdata/reconcile/test_ignore/3/ignore.beancount: -------------------------------------------------------------------------------- 1 | 2013-11-27 * "CR CARD PAYMENT ALEXANDRIA VA" 2 | Liabilities:Credit-Card 66.88 USD 3 | date: 2013-11-27 4 | source_desc: "CR CARD PAYMENT ALEXANDRIA VA" 5 | Expenses:FIXME -66.88 USD 6 | 2013-11-27 open Expenses:FIXME USD 7 | 8 | 2013-12-02 * "NATIONAL FEDERAL DES:TRNSFR" 9 | Assets:Checking -66.88 USD 10 | date: 2013-12-02 11 | source_desc: "NATIONAL FEDERAL DES:TRNSFR" 12 | Expenses:FIXME 66.88 USD 13 | 14 | 2013-12-02 open Expenses:FIXME USD 15 | 16 | 2016-08-10 * "STARBUCKS STORE 12345" 17 | Liabilities:Credit-Card -2.45 USD 18 | date: 2016-08-10 19 | source_desc: "STARBUCKS STORE 12345" 20 | Expenses:FIXME 2.45 USD 21 | 22 | 2016-08-10 open Expenses:FIXME USD 23 | -------------------------------------------------------------------------------- /testdata/source/ofx/test_vanguard_matching/journal.beancount: -------------------------------------------------------------------------------- 1 | plugin "beancount.plugins.auto_accounts" 2 | 3 | 1900-01-01 open Assets:Investment:Vanguard 4 | ofx_org: "The Vanguard Group" 5 | ofx_broker_id: "vanguard.com" 6 | ofx_account_type: "securities_only" 7 | account_id: "01234567890" 8 | capital_gains_account: "Income:Vanguard:Capital-Gains" 9 | 10 | 2011-07-01 * "Manually added BUY transaction" 11 | Assets:Investment:Vanguard:VFINX 100 VFINX {90.00 USD} 12 | Assets:Investment:Vanguard:Cash 13 | 14 | 2011-07-15 * "SELLMF - THIS IS A MEMO" 15 | Assets:Investment:Vanguard:VFINX -42.123 VFINX {} @ 100 USD 16 | date: 2011-07-15 17 | ofx_fitid: "01234567890.0123.07152011.0" 18 | ofx_memo: "THIS IS A MEMO" 19 | ofx_type: "SELLMF" 20 | cleared: TRUE 21 | Income:Vanguard:Capital-Gains:VFINX 22 | Assets:Checking 4212.30 USD 23 | -------------------------------------------------------------------------------- /testdata/source/ofx/test_vanguard_roth_ira/import_results.beancount: -------------------------------------------------------------------------------- 1 | ;; date: 2018-06-21 2 | ;; info: {"filename": "/vanguard_roth_ira.ofx", "type": "application/x-ofx"} 3 | 4 | ; features: [] 5 | 2018-06-21 * "REINVEST - DIV" 6 | Assets:Retirement:Vanguard:Roth-IRA:TYCDT 31.704 TYCDT {2.94 USD} 7 | date: 2018-06-21 8 | ofx_fitid: "7c9254b784a.a9bd.edcfa27b.b" 9 | ofx_type: "REINVEST" 10 | Income:Vanguard:Dividends:TYCDT -93.21 USD 11 | 12 | ;; date: 2018-07-03 13 | ;; info: {"filename": "/vanguard_roth_ira.ofx", "type": "application/x-ofx"} 14 | 15 | 2018-07-03 balance Assets:Retirement:Vanguard:Roth-IRA:TYCDT 46.872 TYCDT 16 | 17 | ;; date: 2018-07-03 18 | ;; info: {"filename": "/vanguard_roth_ira.ofx", "type": "application/x-ofx"} 19 | 20 | 2018-07-03 price TYCDT 1.554232804232804232804232804 USD 21 | -------------------------------------------------------------------------------- /beancount_import/source/google_purchases_test.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | import pytest 4 | 5 | from .source_test import check_source_example 6 | 7 | testdata_dir = os.path.realpath( 8 | os.path.join( 9 | os.path.dirname(__file__), '..', '..', 'testdata', 'source', 10 | 'google_purchases')) 11 | 12 | examples = [ 13 | 'test_basic', 14 | 'test_matching', 15 | 'test_invalid', 16 | ] 17 | 18 | 19 | @pytest.mark.parametrize('name', examples) 20 | def test_source(name: str): 21 | check_source_example( 22 | example_dir=os.path.join(testdata_dir, name), 23 | source_spec={ 24 | 'module': 'beancount_import.source.google_purchases', 25 | 'directory': testdata_dir, 26 | 'link_prefix': 'google_purchase.', 27 | 'time_zone': 'US/Pacific', 28 | }, 29 | replacements=[(testdata_dir, '')]) 30 | -------------------------------------------------------------------------------- /frontend/third_party/fava/codemirror/hint-query.js: -------------------------------------------------------------------------------- 1 | import CodeMirror from 'codemirror/lib/codemirror'; 2 | 3 | import { fuzzyMatch, getCurrentWord } from './helpers'; 4 | import { columns, functions, keywords } from './bql-grammar.json'; 5 | 6 | const functionCompletions = functions.map(f => `${f}(`); 7 | const commands = ['select']; 8 | 9 | CodeMirror.registerHelper('hint', 'beancount-query', (cm) => { 10 | const cursor = cm.getCursor(); 11 | const line = cm.getLine(cursor.line); 12 | const currentWord = getCurrentWord(cursor, line); 13 | 14 | // keywords at the start of the line 15 | if (currentWord === line) { 16 | return { 17 | list: commands.filter(d => d.startsWith(currentWord)), 18 | from: new CodeMirror.Pos(cursor.line, 0), 19 | to: cursor, 20 | }; 21 | } 22 | 23 | return fuzzyMatch(cursor, currentWord, columns.concat(functionCompletions, keywords)); 24 | }); 25 | -------------------------------------------------------------------------------- /testdata/source/mint/test_training_examples/training_examples.json: -------------------------------------------------------------------------------- 1 | [ 2 | [ 3 | { 4 | "amount": "66.88 USD", 5 | "date": "2013-11-27", 6 | "key_value_pairs": { 7 | "desc": "CR CARD PAYMENT ALEXANDRIA VA" 8 | }, 9 | "source_account": "Liabilities:Credit-Card" 10 | }, 11 | "Assets:Checking" 12 | ], 13 | [ 14 | { 15 | "amount": "-66.88 USD", 16 | "date": "2013-12-02", 17 | "key_value_pairs": { 18 | "desc": "NATIONAL FEDERAL DES:TRNSFR" 19 | }, 20 | "source_account": "Assets:Checking" 21 | }, 22 | "Liabilities:Credit-Card" 23 | ], 24 | [ 25 | { 26 | "amount": "-2.45 USD", 27 | "date": "2016-08-10", 28 | "key_value_pairs": { 29 | "desc": "STARBUCKS STORE 12345" 30 | }, 31 | "source_account": "Liabilities:Credit-Card" 32 | }, 33 | "Expenses:Coffee" 34 | ] 35 | ] -------------------------------------------------------------------------------- /testdata/source/ofx/test_vanguard_401k_matching/journal.beancount: -------------------------------------------------------------------------------- 1 | 1900-01-01 commodity VANGUARD-92202V351 2 | cusip: "92202V351" 3 | 4 | 1900-01-01 open Assets:Retirement:Vanguard:Company401k 5 | ofx_org: "Vanguard" 6 | ofx_broker_id: "vanguard.com" 7 | ofx_account_type: "securities_only" 8 | account_id: "0123456" 9 | capital_gains_account: "Income:Vanguard:Capital-Gains" 10 | match_contribution_account: "Income:Company:Match" 11 | 12 | 2014-09-26 * "BUYMF - PRETAX" 13 | Assets:Retirement:Vanguard:Company401k:PreTax:VANGUARD-92202V351 14.61137 VANGUARD-92202V351 {46.06 USD} 14 | date: 2014-09-26 15 | ofx_fitid: "1234567890123456790AAA" 16 | ofx_type: "BUYMF" 17 | cleared: TRUE 18 | Expenses:FIXME -673.00 USD 19 | 2014-09-26 open Assets:Retirement:Vanguard:Company401k:PreTax:VANGUARD-92202V351 20 | 2014-09-26 open Expenses:FIXME 21 | -------------------------------------------------------------------------------- /beancount_import/source/description_based_source_test.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | 3 | from beancount.core.amount import Amount 4 | from beancount.core.data import Posting 5 | from beancount.core.number import D 6 | 7 | from .description_based_source import DescriptionBasedSource 8 | 9 | 10 | class DescriptionBasedSourceTest(unittest.TestCase): 11 | def test_merged_posting_is_cleared(self): 12 | postings = [ 13 | Posting(account="a", units=Amount(D(10), "USD"), cost=None, 14 | price=None, flag=None, meta=None), 15 | Posting(account="a", units=Amount(D(10), "USD"), cost=None, 16 | price=None, flag=None, meta={"merge": True}), 17 | ] 18 | source = DescriptionBasedSource(lambda s: None) 19 | self.assertEqual(source.is_posting_cleared(postings[0]), False) 20 | self.assertEqual(source.is_posting_cleared(postings[1]), True) 21 | -------------------------------------------------------------------------------- /frontend/third_party/fava/codemirror/fold-beancount.js: -------------------------------------------------------------------------------- 1 | import CodeMirror from 'codemirror'; 2 | 3 | CodeMirror.registerHelper('fold', 'beancount', (cm, start) => { 4 | const maxDepth = 100; 5 | 6 | function headerLevel(lineNo) { 7 | const line = cm.getLine(lineNo); 8 | const match = line && line.match(/^\*+/); 9 | if (match) { 10 | return match[0].length; 11 | } 12 | return maxDepth; 13 | } 14 | 15 | const level = headerLevel(start.line); 16 | 17 | if (level === maxDepth) { 18 | return undefined; 19 | } 20 | 21 | const lastLineNo = cm.lastLine(); 22 | let end = start.line; 23 | 24 | while (end < lastLineNo) { 25 | if (headerLevel(end + 1) <= level) { 26 | break; 27 | } 28 | end += 1; 29 | } 30 | 31 | return { 32 | from: new CodeMirror.Pos(start.line, cm.getLine(start.line).length), 33 | to: new CodeMirror.Pos(end, cm.getLine(end).length), 34 | }; 35 | }); 36 | -------------------------------------------------------------------------------- /beancount_import/sorted_list.py: -------------------------------------------------------------------------------- 1 | from decimal import Decimal 2 | from typing import TypeVar, Generic, Tuple, Iterable 3 | import bisect 4 | import itertools 5 | 6 | 7 | K = TypeVar('K', bound=Decimal) 8 | V = TypeVar('V') 9 | 10 | 11 | class SortedList(Generic[K, V]): 12 | def __init__(self, items: Iterable[Tuple[K, V]]) -> None: 13 | entries = sorted(items, key=lambda x: x[0]) 14 | self.keys = [x[0] for x in entries] 15 | self.values = [x[1] for x in entries] 16 | 17 | def __repr__(self) -> str: 18 | return repr(list(zip(self.keys, self.values))) 19 | 20 | def find(self, lower_bound: K, upper_bound: K) -> Iterable[V]: 21 | keys = self.keys 22 | begin_pos = bisect.bisect_left(keys, lower_bound) 23 | end_pos = bisect.bisect_right(keys, upper_bound) 24 | if begin_pos == end_pos: 25 | return () 26 | return itertools.islice(self.values, begin_pos, end_pos) 27 | -------------------------------------------------------------------------------- /testdata/source/ofx/test_vanguard_with_cash_account_matching_missing_transfer/journal.beancount: -------------------------------------------------------------------------------- 1 | plugin "beancount.plugins.auto_accounts" 2 | 1900-01-01 open Assets:Investment:Vanguard 3 | ofx_org: "The Vanguard Group" 4 | ofx_broker_id: "vanguard.com" 5 | ofx_account_type: "securities_and_pending_cash" 6 | account_id: "01234567890" 7 | capital_gains_account: "Income:Vanguard:Capital-Gains" 8 | 9 | 1900-01-01 * "Fake buy" 10 | Assets:Investment:Vanguard:VFINX 42.123 VFINX {80.00 USD} 11 | Expenses:FIXME 12 | 13 | 2011-07-15 * "SELLMF - THIS IS A MEMO" 14 | Assets:Investment:Vanguard:VFINX -42.123 VFINX {} @ 100 USD 15 | date: 2011-07-15 16 | ofx_fitid: "01234567890.0123.07152011.0" 17 | ofx_memo: "THIS IS A MEMO" 18 | ofx_type: "SELLMF" 19 | cleared: TRUE 20 | Income:Vanguard:Capital-Gains:VFINX 21 | Assets:Investment:Vanguard:Cash 4212.30 USD 22 | ofx_fitid: "01234567890.0123.07152011.0" 23 | cleared: TRUE 24 | -------------------------------------------------------------------------------- /examples/fresh/accounts.beancount: -------------------------------------------------------------------------------- 1 | 1900-01-01 open Liabilities:Credit-Card USD 2 | mint_id: "My Credit Card" 3 | 4 | 1900-01-01 open Assets:Checking USD 5 | mint_id: "My Checking" 6 | 7 | 1900-01-01 open Assets:Other-Checking USD 8 | ofx_org: "MyBank" 9 | ofx_broker_id: "MyBank" 10 | account_id: "123456789" 11 | ofx_account_type: "cash_only" 12 | 13 | 1900-01-01 open Assets:Investment:MyBank USD 14 | ofx_org: "MyBank" 15 | ofx_broker_id: "MyBank" 16 | account_id: "X1234" 17 | ofx_account_type: "securities_and_cash" 18 | fees_account: "Expenses:MyBank:Fees" 19 | commission_account: "Expenses:MyBank:Fees" 20 | div_income_account: "Income:MyBank:Dividends" 21 | interest_income_account: "Income:MyBank:Interest" 22 | capital_gains_account: "Income:MyBank:Capital-Gains" 23 | 24 | 1900-01-01 open Liabilities:Amazon-Store-Card USD 25 | mint_id: "Amazon Store Card" 26 | 27 | 1900-01-01 open Assets:FooBarBank EUR 28 | 29 | 1900-01-01 open Liabilities:Amex-Credit-Card EUR 30 | -------------------------------------------------------------------------------- /testdata/source/waveapps/test_basic/import_results.beancount: -------------------------------------------------------------------------------- 1 | ;; date: 2019-01-10 2 | ;; info: {"filename": "/12345678.jpg", "type": "image/jpeg"} 3 | 4 | ; features: [ 5 | ; null, 6 | ; null 7 | ; ] 8 | 2019-01-10 * "Solar4America Ice" ^waveapps.12345678 9 | associated_data0: "{\"description\": \"Receipt image\", \"link\": \"waveapps.12345678\", \"path\": \"/12345678.jpg\", \"type\": \"image/jpeg\"}" 10 | Expenses:FIXME 34.00 USD 11 | Expenses:FIXME -34.00 USD 12 | 13 | ;; date: 2019-01-19 14 | ;; info: {"filename": "/10000001.jpg", "type": "image/jpeg"} 15 | 16 | ; features: [ 17 | ; null, 18 | ; null 19 | ; ] 20 | 2019-01-19 * "Robee's Falafel" "Falafel plate" ^waveapps.10000001 21 | associated_data0: "{\"description\": \"Receipt image\", \"link\": \"waveapps.10000001\", \"path\": \"/10000001.jpg\", \"type\": \"image/jpeg\"}" 22 | Expenses:FIXME 13.50 USD 23 | Expenses:FIXME -13.50 USD 24 | -------------------------------------------------------------------------------- /testdata/source/ofx/test_anzcc/import_results.beancount: -------------------------------------------------------------------------------- 1 | ;; date: 2017-05-08 2 | ;; info: {"filename": "/anzcc.ofx", "type": "application/x-ofx"} 3 | 4 | ; features: [ 5 | ; { 6 | ; "amount": "-5.50 AUD", 7 | ; "date": "2017-05-08", 8 | ; "key_value_pairs": { 9 | ; "desc": "SOME MEMO", 10 | ; "ofx_memo": "SOME MEMO", 11 | ; "ofx_type": "STMTTRN" 12 | ; }, 13 | ; "source_account": "Liabilities:Credit-Card" 14 | ; } 15 | ; ] 16 | 2017-05-08 * "STMTTRN - SOME MEMO" 17 | Liabilities:Credit-Card -5.50 AUD 18 | date: 2017-05-08 19 | ofx_fitid: "201705080001" 20 | ofx_memo: "SOME MEMO" 21 | ofx_type: "STMTTRN" 22 | Expenses:FIXME 5.50 AUD 23 | 24 | ;; date: 2017-05-10 25 | ;; info: {"filename": "/anzcc.ofx", "type": "application/x-ofx"} 26 | 27 | 2017-05-10 balance Liabilities:Credit-Card -123.45 AUD 28 | -------------------------------------------------------------------------------- /testdata/source/waveapps/10000001.json: -------------------------------------------------------------------------------- 1 | { 2 | "account_pk": null, 3 | "active": true, 4 | "currency_code": "USD", 5 | "date": "2019-01-19", 6 | "id": 10000001, 7 | "images": [ 8 | { 9 | "file": "https://wave-prod-recpt.s3.amazonaws.com/media/receipt_images/19224701/cee01e10-3e69-44e5-b6ff-beab5a9aa11f.jpg", 10 | "medium_size": "https://wave-prod-recpt.s3.amazonaws.com/media/receipt_images/19224701/cee01e10-3e69-44e5-b6ff-beab5a9aa11f.jpg.400x0_q85.jpg", 11 | "thumbnail": "https://wave-prod-recpt.s3.amazonaws.com/media/receipt_images/19224701/cee01e10-3e69-44e5-b6ff-beab5a9aa11f.jpg.100x100_q85.jpg" 12 | } 13 | ], 14 | "merchant": "Robee's Falafel", 15 | "modified_at": "2019-01-20T11:52:07-05:00", 16 | "note": "Falafel plate", 17 | "payment_account_pk": null, 18 | "receipt_type": "standard", 19 | "source": "android", 20 | "status": "Ready", 21 | "submitted_at": "2019-01-20T11:51:00-05:00", 22 | "subtotal": null, 23 | "taxes": [], 24 | "total": "13.50" 25 | } 26 | -------------------------------------------------------------------------------- /testdata/source/ofx/test_td_ameritrade/import_results.beancount: -------------------------------------------------------------------------------- 1 | ;; date: 2017-12-03 2 | ;; info: {"filename": "/td_ameritrade.ofx", "type": "application/x-ofx"} 3 | 4 | 2017-12-03 balance Assets:Investment:TD-Ameritrade:Cash 0 USD 5 | 6 | ;; date: 2017-12-03 7 | ;; info: {"filename": "/td_ameritrade.ofx", "type": "application/x-ofx"} 8 | 9 | 2017-12-03 balance Assets:Investment:TD-Ameritrade:AMZN 1 AMZN 10 | 11 | ;; date: 2017-12-03 12 | ;; info: {"filename": "/td_ameritrade.ofx", "type": "application/x-ofx"} 13 | 14 | 2017-12-03 price AMZN 1000 USD 15 | 16 | ;; date: 2017-12-03 17 | ;; info: {"filename": "/td_ameritrade.ofx", "type": "application/x-ofx"} 18 | 19 | 2017-12-03 balance Assets:Investment:TD-Ameritrade:AMERITRADE-912810RW0 1000 AMERITRADE-912810RW0 20 | 21 | ;; date: 2017-12-03 22 | ;; info: {"filename": "/td_ameritrade.ofx", "type": "application/x-ofx"} 23 | 24 | 2017-12-03 price AMERITRADE-912810RW0 1 USD 25 | -------------------------------------------------------------------------------- /testdata/source/ofx/anzcc.ofx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 0 8 | INFO 9 | 10 | 20170510192849 11 | ENG 12 | 13 | 14 | 15 | 16 | 1 17 | 18 | 0 19 | INFO 20 | 21 | 22 | AUD 23 | 24 | 1234123412341234 25 | 26 | 27 | 20170311 28 | 20170509 29 | 30 | DEBIT 31 | 20170508000000 32 | 20170508000000 33 | -5.50 34 | 201705080001 35 | SOME MEMO 36 | 37 | 38 | 39 | -123.45 40 | 20170510192849 41 | 42 | 43 | 123.45 44 | 20170510192849 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /testdata/reconcile/test_basic/0/pending.beancount: -------------------------------------------------------------------------------- 1 | ;; source: mint 2 | ;; date: 2013-11-27 3 | ;; info: {"filename": "/source/mint/mint.csv", "line": 2, "type": "text/csv"} 4 | 5 | 2013-11-27 * "CR CARD PAYMENT ALEXANDRIA VA" 6 | Liabilities:Credit-Card 66.88 USD 7 | date: 2013-11-27 8 | source_desc: "CR CARD PAYMENT ALEXANDRIA VA" 9 | Expenses:FIXME -66.88 USD 10 | 11 | ;; source: mint 12 | ;; date: 2013-12-02 13 | ;; info: {"filename": "/source/mint/mint.csv", "line": 3, "type": "text/csv"} 14 | 15 | 2013-12-02 * "NATIONAL FEDERAL DES:TRNSFR" 16 | Assets:Checking -66.88 USD 17 | date: 2013-12-02 18 | source_desc: "NATIONAL FEDERAL DES:TRNSFR" 19 | Expenses:FIXME 66.88 USD 20 | 21 | ;; source: mint 22 | ;; date: 2016-08-10 23 | ;; info: {"filename": "/source/mint/mint.csv", "line": 1, "type": "text/csv"} 24 | 25 | 2016-08-10 * "STARBUCKS STORE 12345" 26 | Liabilities:Credit-Card -2.45 USD 27 | date: 2016-08-10 28 | source_desc: "STARBUCKS STORE 12345" 29 | Expenses:FIXME 2.45 USD 30 | -------------------------------------------------------------------------------- /testdata/reconcile/test_ignore/0/pending.beancount: -------------------------------------------------------------------------------- 1 | ;; source: mint 2 | ;; date: 2013-11-27 3 | ;; info: {"filename": "/source/mint/mint.csv", "line": 2, "type": "text/csv"} 4 | 5 | 2013-11-27 * "CR CARD PAYMENT ALEXANDRIA VA" 6 | Liabilities:Credit-Card 66.88 USD 7 | date: 2013-11-27 8 | source_desc: "CR CARD PAYMENT ALEXANDRIA VA" 9 | Expenses:FIXME -66.88 USD 10 | 11 | ;; source: mint 12 | ;; date: 2013-12-02 13 | ;; info: {"filename": "/source/mint/mint.csv", "line": 3, "type": "text/csv"} 14 | 15 | 2013-12-02 * "NATIONAL FEDERAL DES:TRNSFR" 16 | Assets:Checking -66.88 USD 17 | date: 2013-12-02 18 | source_desc: "NATIONAL FEDERAL DES:TRNSFR" 19 | Expenses:FIXME 66.88 USD 20 | 21 | ;; source: mint 22 | ;; date: 2016-08-10 23 | ;; info: {"filename": "/source/mint/mint.csv", "line": 1, "type": "text/csv"} 24 | 25 | 2016-08-10 * "STARBUCKS STORE 12345" 26 | Liabilities:Credit-Card -2.45 USD 27 | date: 2016-08-10 28 | source_desc: "STARBUCKS STORE 12345" 29 | Expenses:FIXME 2.45 USD 30 | -------------------------------------------------------------------------------- /beancount_import/source/google_purchases_sanitize.py: -------------------------------------------------------------------------------- 1 | """Strips identifying information from a Google Purchases JSON file. 2 | 3 | This is useful for creating test files. 4 | """ 5 | 6 | import os 7 | import re 8 | import random 9 | import json 10 | 11 | 12 | def make_random_number_replacement(x: str): 13 | return re.sub('[0-9]', lambda x: str(random.randint(0, 9)), x) 14 | 15 | 16 | def sanitize(input_path: str, output_directory: str): 17 | with open(input_path, 'r') as f: 18 | data = json.load(f) 19 | purchase_id = data['id'] = make_random_number_replacement(data['id']) 20 | with open(os.path.join(output_directory, purchase_id + '.json'), 'w') as f: 21 | f.write(json.dumps(data, indent=' ')) 22 | 23 | 24 | def main(): 25 | import argparse 26 | ap = argparse.ArgumentParser() 27 | ap.add_argument('input', help='Input JSON file.') 28 | ap.add_argument('output_directory', help='Output directory.') 29 | args = ap.parse_args() 30 | sanitize(args.input, args.output_directory) 31 | 32 | if __name__ == '__main__': 33 | main() 34 | -------------------------------------------------------------------------------- /testdata/source/schwab_csv/test_lots/positions/Intelligent-Positions-2020-10-25.CSV: -------------------------------------------------------------------------------- 1 | "Positions for account Intelligent XXXX-4321 as of 02:45 AM ET, 10/25/2020" 2 | 3 | "Symbol","Description","Quantity","Price","Price Change $","Price Change %","Market Value","Day Change $","Day Change %","Cost Basis","Gain/Loss $","Gain/Loss %","Reinvest Dividends?","Capital Gains?","% Of Account","Dividend Yield","Last Dividend","Ex-Dividend Date","P/E Ratio","52 Week Low","52 Week High","Volume","Intrinsic Value","In The Money","Security Type", 4 | "SCHA","SCHWAB US SMALL CAP ETF","10.5","$70.50","$0.00","0.00%","$740.25","$0.00","0.00%","$759.68","-$8.50","-0.1%","No","--","5.24%","+1%","$0.30","8/10/2020","--","$43.05","$89.52","431,291","--","--","ETFs & Closed End Funds", 5 | "Cash & Cash Investments","--","--","--","--","--","$10.00","$0.00","0%","--","--","--","--","--","0.00%","--","--","--","--","--","--","--","--","--","Cash and Money Market", 6 | "Account Total","--","--","--","--","--","$757.79","-$0.60","-0.08%","$717.39","-$0.60","-0.08%","--","--","--","--","--","--","--","--","--","--", 7 | -------------------------------------------------------------------------------- /testdata/source/schwab_csv/test_basic/positions/Intelligent-Positions-2020-11-30.CSV: -------------------------------------------------------------------------------- 1 | "Positions for account Intelligent XXXX-4321 as of 02:45 AM ET, 12/21/2020" 2 | 3 | "Symbol","Description","Quantity","Price","Price Change $","Price Change %","Market Value","Day Change $","Day Change %","Cost Basis","Gain/Loss $","Gain/Loss %","Reinvest Dividends?","Capital Gains?","% Of Account","Dividend Yield","Last Dividend","Ex-Dividend Date","P/E Ratio","52 Week Low","52 Week High","Volume","Intrinsic Value","In The Money","Security Type", 4 | "SCHA","SCHWAB US SMALL CAP ETF","110","$88.71","-$0.26","-0.29%","$9,758.10","-$2.86","-0.29%","$7,500.00","$2,258.10","+43.7%","No","--","5.24%","+1%","$0.30","12/10/2020","--","$43.05","$89.52","431,291","--","--","ETFs & Closed End Funds", 5 | "Cash & Cash Investments","--","--","--","--","--","$2,953.34","$0.00","0%","--","--","--","--","--","13.97%","--","--","--","--","--","--","--","--","--","Cash and Money Market", 6 | "Account Total","--","--","--","--","--","$12,711.44","-$2.86","-0.21%","$7,500.00","$2,258.10","+14.73%","--","--","--","--","--","--","--","--","--","--", 7 | -------------------------------------------------------------------------------- /frontend/codemirror-beancount/codemirror-fold-beancount.js: -------------------------------------------------------------------------------- 1 | const CodeMirror = require('codemirror/lib/codemirror'); 2 | 3 | CodeMirror.registerHelper('fold', 'beancount', (cm, start) => { 4 | const maxDepth = 100; 5 | 6 | function isHeader(lineNo) { 7 | const tokentype = cm.getTokenTypeAt(new CodeMirror.Pos(lineNo, 0)); 8 | return tokentype && /\bsection\b/.test(tokentype); 9 | } 10 | 11 | function headerLevel(lineNo) { 12 | const line = cm.getLine(lineNo); 13 | const match = line && line.match(/^\*+/); 14 | if (match && isHeader(lineNo)) { 15 | return match[0].length; 16 | } 17 | return maxDepth; 18 | } 19 | 20 | const level = headerLevel(start.line); 21 | 22 | if (level === maxDepth) { 23 | return undefined; 24 | } 25 | 26 | const lastLineNo = cm.lastLine(); 27 | let end = start.line; 28 | 29 | while (end < lastLineNo) { 30 | if (headerLevel(end + 1) <= level) { 31 | break; 32 | } 33 | ++end; 34 | } 35 | 36 | return { 37 | from: new CodeMirror.Pos(start.line, cm.getLine(start.line).length), 38 | to: new CodeMirror.Pos(end, cm.getLine(end).length), 39 | }; 40 | }); 41 | -------------------------------------------------------------------------------- /testdata/source/ofx/test_fidelity/training_examples.json: -------------------------------------------------------------------------------- 1 | [ 2 | [ 3 | { 4 | "amount": "-8 SPY", 5 | "date": "2012-07-27", 6 | "key_value_pairs": { 7 | "desc": "YOU SOLD", 8 | "ofx_memo": "YOU SOLD", 9 | "ofx_type": "SELLSTOCK" 10 | }, 11 | "source_account": "Assets:Investment:Fidelity:SPY" 12 | }, 13 | "Assets:Investment:Fidelity:Cash" 14 | ], 15 | [ 16 | { 17 | "amount": "-0.035 SPY", 18 | "date": "2012-08-01", 19 | "key_value_pairs": { 20 | "desc": "IN LIEU OF FRX SHARE", 21 | "ofx_memo": "IN LIEU OF FRX SHARE", 22 | "ofx_type": "SELLSTOCK" 23 | }, 24 | "source_account": "Assets:Investment:Fidelity:SPY" 25 | }, 26 | "Assets:Investment:Fidelity:Cash" 27 | ], 28 | [ 29 | { 30 | "amount": "0.911 INTC", 31 | "date": "2012-09-01", 32 | "key_value_pairs": { 33 | "desc": "REINVESTMENT", 34 | "ofx_memo": "REINVESTMENT", 35 | "ofx_type": "BUYSTOCK" 36 | }, 37 | "source_account": "Assets:Investment:Fidelity:INTC" 38 | }, 39 | "Assets:Investment:Fidelity:Cash" 40 | ] 41 | ] -------------------------------------------------------------------------------- /testdata/source/google_purchases/test_basic/import_results.beancount: -------------------------------------------------------------------------------- 1 | ;; date: 2017-10-15 2 | ;; info: {"filename": "/88348393419580772365.html", "type": "text/html"} 3 | 4 | ; features: [ 5 | ; null, 6 | ; null 7 | ; ] 8 | 2017-10-15 * "AutoZone" "Relay - Blower Motor" ^google_purchase.88348393419580772365 9 | associated_data0: "{\"description\": \"Purchase details\", \"link\": \"google_purchase.88348393419580772365\", \"path\": \"/88348393419580772365.html\", \"type\": \"text/html\"}" 10 | Expenses:FIXME 21.84 USD 11 | Expenses:FIXME -21.84 USD 12 | 13 | ;; date: 2018-07-23 14 | ;; info: {"filename": "/79184124027478022589.html", "type": "text/html"} 15 | 16 | ; features: [ 17 | ; null, 18 | ; null 19 | ; ] 20 | 2018-07-23 * "Square - Some merchant" "Some purchase" ^google_purchase.79184124027478022589 21 | associated_data0: "{\"description\": \"Purchase details\", \"link\": \"google_purchase.79184124027478022589\", \"path\": \"/79184124027478022589.html\", \"type\": \"text/html\"}" 22 | Expenses:FIXME 10.00 USD 23 | Expenses:FIXME -10.00 USD 24 | -------------------------------------------------------------------------------- /testdata/source/schwab_csv/test_basic/journal.beancount: -------------------------------------------------------------------------------- 1 | 1900-01-01 open Income:Dividend:Schwab 2 | 1900-01-01 open Income:Capital-Gains:Schwab 3 | 1900-01-01 open Expenses:Brokerage-Fees:Schwab 4 | 1900-01-01 open Assets:Schwab:Brokerage-1234 5 | schwab_account: "XXXX-1234" 6 | div_income_account: "Income:Dividend:Schwab" 7 | interest_income_account: "Income:Interest:Schwab" 8 | capital_gains_account: "Income:Capital-Gains:Schwab" 9 | fees_account: "Expenses:Brokerage-Fees:Schwab" 10 | 1900-01-01 open Assets:Schwab:Brokerage-1234:Cash 11 | 1900-01-01 open Assets:Schwab:Brokerage-1234:FB 12 | 1900-01-01 open Assets:Schwab:Checking 13 | schwab_account: "EAC" 14 | interest_income_account: "Income:Interest:Schwab" 15 | fees_account: "Expenses:Bank-Fees:Schwab" 16 | 1900-01-01 open Assets:Schwab:Intelligent-4321 17 | schwab_account: "Intelligent XXXX-4321" 18 | div_income_account: "Income:Dividend:Schwab" 19 | interest_income_account: "Income:Interest:Schwab" 20 | capital_gains_account: "Income:Capital-Gains:Schwab" 21 | fees_account: "Expenses:Brokerage-Fees:Schwab" 22 | 1900-01-01 open Assets:Schwab:Intelligent-4321:Cash 23 | -------------------------------------------------------------------------------- /beancount_import/source/mint_test.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | import pytest 4 | 5 | from .source_test import check_source_example 6 | 7 | testdata_dir = os.path.realpath( 8 | os.path.join( 9 | os.path.dirname(__file__), '..', '..', 'testdata', 'source', 'mint')) 10 | 11 | examples = [ 12 | 'test_basic', 13 | 'test_training_examples', 14 | 'test_invalid', 15 | ] 16 | 17 | 18 | @pytest.mark.parametrize('name', examples) 19 | def test_source(name: str): 20 | check_source_example( 21 | example_dir=os.path.join(testdata_dir, name), 22 | source_spec={ 23 | 'module': 'beancount_import.source.mint', 24 | 'filename': os.path.join(testdata_dir, 'mint.csv'), 25 | }, 26 | replacements=[(testdata_dir, '')]) 27 | 28 | def test_currency(): 29 | check_source_example( 30 | example_dir=os.path.join(testdata_dir, 'test_currency'), 31 | source_spec={ 32 | 'module': 'beancount_import.source.mint', 33 | 'filename': os.path.join(testdata_dir, 'mint.csv'), 34 | 'currency': 'CAD', 35 | }, 36 | replacements=[(testdata_dir, '')]) 37 | -------------------------------------------------------------------------------- /testdata/source/ofx/test_suncorp/import_results.beancount: -------------------------------------------------------------------------------- 1 | ;; date: 2013-12-15 2 | ;; info: {"filename": "/suncorp.ofx", "type": "application/x-ofx"} 3 | 4 | ; features: [ 5 | ; { 6 | ; "amount": "-16.85 AUD", 7 | ; "date": "2013-12-15", 8 | ; "key_value_pairs": { 9 | ; "desc": "EFTPOS WDL HANDYWAY ALDI STORE GEELONG WEST VICAU", 10 | ; "ofx_memo": "EFTPOS WDL HANDYWAY ALDI STORE GEELONG WEST VICAU", 11 | ; "ofx_type": "STMTTRN" 12 | ; }, 13 | ; "source_account": "Assets:Checking:Suncorp" 14 | ; } 15 | ; ] 16 | 2013-12-15 * "STMTTRN - EFTPOS WDL HANDYWAY ALDI STORE GEELONG WEST VICAU" 17 | Assets:Checking:Suncorp -16.85 AUD 18 | date: 2013-12-15 19 | ofx_fitid: "1" 20 | ofx_memo: "EFTPOS WDL HANDYWAY ALDI STORE GEELONG WEST VICAU" 21 | ofx_type: "STMTTRN" 22 | Expenses:FIXME 16.85 AUD 23 | 24 | ;; date: 2013-12-15 25 | ;; info: {"filename": "/suncorp.ofx", "type": "application/x-ofx"} 26 | 27 | 2013-12-15 balance Assets:Checking:Suncorp 1234.12 AUD 28 | -------------------------------------------------------------------------------- /testdata/source/amazon/de_DE/D22-9220967-2566135.json: -------------------------------------------------------------------------------- 1 | { 2 | "order_id": "D22-9220967-2566135", 3 | "order_date": "2020-05-31", 4 | "shipments": [ 5 | { 6 | "shipped_date": "2020-05-31", 7 | "items": [ 8 | { 9 | "description": "Audible Flexi-Abo [Digitales Abo]", 10 | "url": "https://www.amazon.de/dp/B08H5XW8SJ/ref=docs-os-doi_0", 11 | "sold_by": "Audible", 12 | "by": null, 13 | "price": { 14 | "number": "9.95", 15 | "currency": "EUR" 16 | } 17 | } 18 | ], 19 | "items_subtotal": null, 20 | "pretax_adjustments": [], 21 | "total_before_tax": null, 22 | "posttax_adjustments": [], 23 | "tax": [], 24 | "total": null, 25 | "errors": [ 26 | "expected total is 0.65 EUR, but parsed value is None" 27 | ] 28 | } 29 | ], 30 | "credit_card_transactions": [], 31 | "pretax_adjustments": [], 32 | "tax": null, 33 | "posttax_adjustments": [], 34 | "errors": [] 35 | } -------------------------------------------------------------------------------- /testdata/source/google_purchases/order_88348393419580772365.json: -------------------------------------------------------------------------------- 1 | { 2 | "merchantOrderId": "1234567890", 3 | "creationTime": { 4 | "usecSinceEpochUtc": "1508099580000000", 5 | "granularity": "MICROSECOND" 6 | }, 7 | "transactionMerchant": { 8 | "name": "AutoZone" 9 | }, 10 | "lineItem": [{ 11 | "purchase": { 12 | "status": "READY_FOR_PICKUP", 13 | "quantity": 1, 14 | "unitPrice": { 15 | "amountMicros": "19990000", 16 | "currencyCode": { 17 | "code": "USD" 18 | }, 19 | "displayString": "$ 19.99" 20 | }, 21 | "returnsInfo": { 22 | "isReturnable": true, 23 | "daysToReturn": 90 24 | }, 25 | "productInfo": { 26 | "name": "Relay - Blower Motor", 27 | "brand": "Duralast" 28 | } 29 | } 30 | }], 31 | "priceline": [{ 32 | "type": "SUBTOTAL", 33 | "amount": { 34 | "amountMicros": "19990000", 35 | "currencyCode": { 36 | "code": "USD" 37 | } 38 | } 39 | }, { 40 | "type": "TAX", 41 | "amount": { 42 | "amountMicros": "1850000", 43 | "currencyCode": { 44 | "code": "USD" 45 | }, 46 | "displayString": "$ 1.85" 47 | } 48 | }] 49 | } 50 | -------------------------------------------------------------------------------- /testdata/source/schwab_csv/test_basic/transactions/EAC_Checking_Transactions_20201223-160009.CSV: -------------------------------------------------------------------------------- 1 | Transactions for Checking account EAC as of 12/23/2020 16:00:10 ET 2 | "Date","Type","Check #","Description","Withdrawal (-)","Deposit (+)","RunningBalance" 3 | "Pending Transactions are not reflected within this sort criterion." 4 | "Posted Transactions" 5 | "07/30/2021","ATMREBATE","","ATM Fee Rebate","","$3.00","$20,053.01" 6 | "02/01/2021","WIRE","","Incoming Wire Transfer","","$20,000.00","$20,050.01" 7 | "11/13/2020","TRANSFER","","Funds Transfer to Brokerage -9999","$10,500.00","","$50.01" 8 | "11/13/2020","ACH","","JPMorgan Chase Ext Trnsfr","","$10,500.00","$10,550.01" 9 | "10/27/2020","ACH","","JPMorgan Chase Auth Debit","$1.10","","$2,550.00" 10 | "10/27/2020","ACH","","JPMorgan Chase Auth Crdt","","$1.56","$2,550.55" 11 | "10/26/2020","ACH","","Electronic Deposit","","$2,500.00","$11,550.00" 12 | "01/31/2020","INTADJUST","","Interest Paid","","$0.09","$1133.94" 13 | "01/12/2020","VISA","","COMPASS VENDING BURNABY BC #000000190","$6.14","","$1133.85" 14 | "01/10/2020","ATM","","ATM AT SOME BANK","$16.69","","$1139.99" 15 | "11/22/2019","CHECK","1002","Check Paid #1002","$1,234.11","","$1,111.81" 16 | "11/01/2021","DEPOSIT","","Deposit Mobile Banking","","$1,234.56","$7,890.00" 17 | -------------------------------------------------------------------------------- /testdata/source/ofx/test_vanguard_invalid/journal.beancount: -------------------------------------------------------------------------------- 1 | plugin "beancount.plugins.auto_accounts" 2 | 3 | 1900-01-01 open Assets:Investment:Vanguard 4 | ofx_org: "The Vanguard Group" 5 | ofx_broker_id: "vanguard.com" 6 | ofx_account_type: "securities_only" 7 | account_id: "01234567890" 8 | capital_gains_account: "Income:Vanguard:Capital-Gains" 9 | 10 | 2011-07-01 * "Manually added BUY transaction" 11 | Assets:Investment:Vanguard:VFINX 100 VFINX {90.00 USD} 12 | Assets:Investment:Vanguard:Cash 13 | 14 | 2011-07-15 * "SELLMF - THIS IS A MEMO" 15 | Assets:Investment:Vanguard:VFINX -42.123 VFINX {} @ 100 USD 16 | invalid0: "1 extra" 17 | date: 2011-07-15 18 | ofx_fitid: "01234567890.0123.07152011.0" 19 | ofx_memo: "THIS IS A MEMO" 20 | ofx_type: "SELLMF" 21 | cleared: TRUE 22 | Income:Vanguard:Capital-Gains:VFINX 23 | Assets:Checking 4212.30 USD 24 | 25 | 2011-07-15 * "SELLMF - THIS IS A MEMO" 26 | Assets:Investment:Vanguard:VFINX -42.123 VFINX {} @ 100 USD 27 | invalid0: "1 extra" 28 | date: 2011-07-15 29 | ofx_fitid: "01234567890.0123.07152011.0" 30 | ofx_memo: "THIS IS A MEMO" 31 | ofx_type: "SELLMF" 32 | cleared: TRUE 33 | Income:Vanguard:Capital-Gains:VFINX 34 | Assets:Checking 4212.30 USD 35 | -------------------------------------------------------------------------------- /testdata/source/amazon/de_DE/D60-9825125-4795642.json: -------------------------------------------------------------------------------- 1 | { 2 | "order_id": "D60-9825125-4795642", 3 | "order_date": "2019-12-22", 4 | "shipments": [ 5 | { 6 | "shipped_date": "2019-12-22", 7 | "items": [ 8 | { 9 | "description": "Das erstaunliche Leben des Walter Mitty [dt./OV]", 10 | "url": "https://www.amazon.de/dp/B00JZPPGNC/ref=docs-os-doi_0", 11 | "sold_by": "Amazon Digital Germany GmbH", 12 | "by": "Ben Stiller, Kristen Wiig, Jon Daly", 13 | "price": { 14 | "number": "4.98", 15 | "currency": "EUR" 16 | } 17 | } 18 | ], 19 | "items_subtotal": null, 20 | "pretax_adjustments": [], 21 | "total_before_tax": null, 22 | "posttax_adjustments": [], 23 | "tax": [], 24 | "total": null, 25 | "errors": [ 26 | "expected total is 0.80 EUR, but parsed value is None" 27 | ] 28 | } 29 | ], 30 | "credit_card_transactions": [], 31 | "pretax_adjustments": [], 32 | "tax": null, 33 | "posttax_adjustments": [], 34 | "errors": [] 35 | } -------------------------------------------------------------------------------- /examples/data/venmo/balances.csv: -------------------------------------------------------------------------------- 1 | "Start Date","End Date","Start Balance","End Balance" 2 | "2014-01-21","2014-04-20","unknown","unknown" 3 | "2014-04-21","2014-07-19","unknown","unknown" 4 | "2014-07-20","2014-10-17","unknown","unknown" 5 | "2014-10-18","2015-01-15","unknown","unknown" 6 | "2015-01-16","2015-04-15","unknown","unknown" 7 | "2015-04-16","2015-07-14","unknown","unknown" 8 | "2015-07-15","2015-10-12","unknown","unknown" 9 | "2015-10-13","2016-01-10","unknown","unknown" 10 | "2016-01-11","2016-04-09","unknown","unknown" 11 | "2016-04-10","2016-07-08","unknown","unknown" 12 | "2016-07-09","2016-10-06","unknown","unknown" 13 | "2016-10-07","2017-01-04","unknown","unknown" 14 | "2017-01-05","2017-04-04","unknown","unknown" 15 | "2017-04-05","2017-07-03","$0.00","$0.00" 16 | "2017-07-04","2017-10-01","$0.00","$0.00" 17 | "2017-10-02","2017-12-30","$0.00","$1528.25" 18 | "2017-12-31","2018-01-20","$1528.25","$0.00" 19 | "2018-01-21","2018-01-26","unknown","unknown" 20 | "2018-01-27","2018-03-29","$0.00","$0.00" 21 | "2018-03-30","2018-04-13","$0.00","$0.00" 22 | "2018-04-14","2018-05-27","$0.00","$0.00" 23 | "2018-05-28","2018-06-09","$0.00","$1350.00" 24 | "2018-06-10","2018-06-16","unknown","unknown" 25 | "2018-06-17","2018-07-03","$1350.00","$0.00" 26 | "2018-07-04","2018-08-03","$0.00","$0.00" 27 | -------------------------------------------------------------------------------- /testdata/source/schwab_csv/test_lots/transactions/Intelligent_Transactions_20201115-180120.CSV: -------------------------------------------------------------------------------- 1 | "Transactions for account Intelligent XXXX-4321 as of 11/15/2020 18:01:20 ET" 2 | "Date","Action","Symbol","Description","Quantity","Price","Fees & Comm","Amount", 3 | "10/22/2020","Reverse Split","IAU","ISHARES GOLD ETF","5","","","", 4 | "10/22/2020","Reverse Split","464285105","ISHARES GOLD ETF XXXREVERSE SPLIT EFF: 10/21/20","-10","","","", 5 | "10/19/2020","Sell","SCHA","SCHWAB US SMALL CAP ETF","19.5","$74.23","","$1447.49", 6 | "10/19/2020","Sell","FNDA","SCHWAB FUNDAMENTAL US SMALL CAP ETF","1","$35.00","","$35.00", 7 | "10/14/2020 as of 10/13/2020","Stock Split","HYLB","XTRACKERS USD HIGH YIELDCOR BND ETF","20","$5.00","","", 8 | "09/24/2020","Buy","SCHA","SCHWAB US SMALL CAP ETF","20","$72.56","","-$1451.20", 9 | "09/24/2020","Buy","IAU","ISHARES GOLD ETF","10","$10.00","","-$100.00", 10 | "08/31/2020","Buy","HYLB","XTRACKERS USD HIGH YIELDCOR BND ETF","12","$10.00","","-$120.00", 11 | "08/30/2020","Buy","HYLB","XTRACKERS USD HIGH YIELDCOR BND ETF","8","$20.00","","-$160.00", 12 | "08/24/2020","Buy","SCHA","SCHWAB US SMALL CAP ETF","10","$71.35","","-$713.50", 13 | "08/24/2020","Buy","FNDA","SCHWAB FUNDAMENTAL US SMALL COM ETF","1","$34.89","","-$34.89", 14 | Transactions Total,"","","","","","",-$897.10 15 | -------------------------------------------------------------------------------- /testdata/source/schwab_csv/test_lots/positions/Intelligent-Positions-2020-08-25.CSV: -------------------------------------------------------------------------------- 1 | "Positions for account Intelligent XXXX-4321 as of 02:45 AM ET, 08/25/2020" 2 | 3 | "Symbol","Description","Quantity","Price","Price Change $","Price Change %","Market Value","Day Change $","Day Change %","Cost Basis","Gain/Loss $","Gain/Loss %","Reinvest Dividends?","Capital Gains?","% Of Account","Dividend Yield","Last Dividend","Ex-Dividend Date","P/E Ratio","52 Week Low","52 Week High","Volume","Intrinsic Value","In The Money","Security Type", 4 | "FNDA","SCHWAB FUNDAMENTAL US SMALL COM ETF","1","$33.89","-$1.00","-2.9%","$33.89","-$1.00","-2.9%","$34.89","-$1.00","-2.9%","No","--","3.11%","+1.2%","$0.16","8/10/2020","--","$21.80","$42.93","158,508","--","--","ETFs & Closed End Funds", 5 | "SCHA","SCHWAB US SMALL CAP ETF","10","$71.39","$0.04","0.05%","$713.90","$0.40","0.05%","$713.50","$0.40","+0.05%","No","--","5.24%","+1%","$0.30","8/10/2020","--","$43.05","$89.52","431,291","--","--","ETFs & Closed End Funds", 6 | "Cash & Cash Investments","--","--","--","--","--","$10.00","$0.00","0%","--","--","--","--","--","0.00%","--","--","--","--","--","--","--","--","--","Cash and Money Market", 7 | "Account Total","--","--","--","--","--","$757.79","-$0.60","-0.08%","$717.39","-$0.60","-0.08%","--","--","--","--","--","--","--","--","--","--", 8 | -------------------------------------------------------------------------------- /testdata/source/schwab_csv/test_lots/positions/Intelligent-Positions-2020-09-25.CSV: -------------------------------------------------------------------------------- 1 | "Positions for account Intelligent XXXX-4321 as of 02:45 AM ET, 09/25/2020" 2 | 3 | "Symbol","Description","Quantity","Price","Price Change $","Price Change %","Market Value","Day Change $","Day Change %","Cost Basis","Gain/Loss $","Gain/Loss %","Reinvest Dividends?","Capital Gains?","% Of Account","Dividend Yield","Last Dividend","Ex-Dividend Date","P/E Ratio","52 Week Low","52 Week High","Volume","Intrinsic Value","In The Money","Security Type", 4 | "FNDA","SCHWAB FUNDAMENTAL US SMALL COM ETF","1","$33.89","$0.00","0.0%","$33.89","$0.00","0.0%","$34.89","-$1.00","-2.9%","No","--","3.11%","+1.2%","$0.16","8/10/2020","--","$21.80","$42.93","158,508","--","--","ETFs & Closed End Funds", 5 | "SCHA","SCHWAB US SMALL CAP ETF","30","$72.56","$0.00","0.00%","$2,176.80","$0.00","0.00%","$2,164.70","$12.10","+0.09%","No","--","5.24%","+1%","$0.30","8/10/2020","--","$43.05","$89.52","431,291","--","--","ETFs & Closed End Funds", 6 | "Cash & Cash Investments","--","--","--","--","--","$10.00","$0.00","0%","--","--","--","--","--","0.00%","--","--","--","--","--","--","--","--","--","Cash and Money Market", 7 | "Account Total","--","--","--","--","--","$757.79","-$0.60","-0.08%","$717.39","-$0.60","-0.08%","--","--","--","--","--","--","--","--","--","--", 8 | -------------------------------------------------------------------------------- /beancount_import/source/amazon_test.py: -------------------------------------------------------------------------------- 1 | import os 2 | from typing import Dict, Any 3 | 4 | import pytest 5 | 6 | from .amazon_invoice_test import testdata_dir 7 | from .source_test import check_source_example 8 | from ..source import SourceSpec 9 | 10 | source_spec_without_posttax_accounts = { 11 | 'module': 'beancount_import.source.amazon', 12 | 'directory': testdata_dir, 13 | 'amazon_account': 'name@domain.com', 14 | } 15 | 16 | source_spec_with_posttax_accounts = { 17 | **source_spec_without_posttax_accounts, 18 | 'posttax_adjustment_accounts': { 19 | 'Gift Card Amount': 'Assets:Gift-Cards:Amazon', 20 | 'Rewards Points': 'Income:Amazon:Cashback', 21 | }, 22 | } # type: Dict[str, Any] 23 | 24 | examples = [ 25 | ('test_basic', source_spec_with_posttax_accounts), 26 | ('test_credit_card_transactions', source_spec_with_posttax_accounts), 27 | ('test_cleared_and_invalid', source_spec_with_posttax_accounts), 28 | ('test_prediction', source_spec_without_posttax_accounts), 29 | ] 30 | 31 | 32 | @pytest.mark.parametrize('name,source_spec', examples) 33 | def test_source(name: str, source_spec: SourceSpec): 34 | check_source_example( 35 | example_dir=os.path.join(testdata_dir, name), 36 | source_spec=source_spec, 37 | replacements=[(testdata_dir, '')]) 38 | -------------------------------------------------------------------------------- /testdata/matching_test/match_many_merged/pending.beancount: -------------------------------------------------------------------------------- 1 | 2017-03-24 * "AMAZON MARKETPLACE SEATTLE WA<br/>MUJI Gel Ink Ballpoint Pens 0.<br/>Suncatchers Colorful Bird Stai<br/>Cynthia Rowley File Folders, 3<br/>Rifle Paper Co. Jardin Weekly<br/>SHIPPING AND TAX" 2 | Liabilities:Amazon-Store-Card -58.93 USD 3 | date: 2017-03-24 4 | cleared: TRUE 5 | Expenses:FIXME 58.93 USD 6 | 7 | 2017-03-24 * "AMAZON MARKETPLACE SEATTLE WA<br/>Design Ideas 8758616-DI 875861<br/>SHIPPING AND TAX" 8 | Liabilities:Amazon-Store-Card -16.21 USD 9 | date: 2017-03-24 10 | cleared: TRUE 11 | Expenses:FIXME 16.21 USD 12 | 13 | 2017-03-24 * "AMAZON MARKETPLACE SEATTLE WA<br/>C.R. Gibson 9-Count Coloring F<br/>Skydue Floral Printed Accordio<br/>Bloom Daily Planners All In On<br/>V&A William Morris Garden File<br/>Cynthia Rowley File Folders, 3<br/>SHIPP" 14 | Liabilities:Amazon-Store-Card -71.06 USD 15 | date: 2017-03-24 16 | cleared: TRUE 17 | Expenses:FIXME 71.06 USD 18 | 19 | 2017-03-27 * "AMAZON MARKETPLACE SEATTLE WA<br/>Skydue Letter A4 Paper Expandi" 20 | Liabilities:Amazon-Store-Card -7.99 USD 21 | date: 2017-03-27 22 | cleared: TRUE 23 | Expenses:FIXME 7.99 USD 24 | -------------------------------------------------------------------------------- /testdata/source/ofx/test_non_default_capital_gains/journal.beancount: -------------------------------------------------------------------------------- 1 | plugin "beancount.plugins.auto_accounts" 2 | 3 | 1900-01-01 commodity VANGUARD-92202V351 4 | cusip: "92202V351" 5 | 6 | ; The capital gains account is ":CapitalGains" instead of the customary 7 | ; ":Capital-Gains". 8 | 1900-01-01 open Assets:Retirement:Vanguard:Company401k 9 | ofx_org: "Vanguard" 10 | ofx_broker_id: "vanguard.com" 11 | ofx_account_type: "securities_only" 12 | account_id: "0123456" 13 | capital_gains_account: "Income:Vanguard:CapitalGains" 14 | match_contribution_account: "Income:Company:Match" 15 | 16 | ; This is need so that the expense transaction doesn't reduce below zero. 17 | 2013-09-04 * "Initial value" 18 | Assets:Retirement:Vanguard:Company401k:Match:VANGUARD-92202V351 1 VANGUARD-92202V351 {39.37 USD} 19 | Equity:Opening-Balances 20 | 21 | ; Again, ":CapitalGains" without the hyphen. 22 | 2013-09-05 * "TRANSFER - MATCH - Investment Expense" 23 | Assets:Retirement:Vanguard:Company401k:Match:VANGUARD-92202V351 -0.04241 VANGUARD-92202V351 {} @ 39.37 USD 24 | date: 2013-09-05 25 | ofx_fitid: "1234567890123456795AAA" 26 | ofx_memo: "Investment Expense" 27 | ofx_type: "TRANSFER" 28 | cleared: TRUE 29 | Income:Vanguard:CapitalGains:VANGUARD-92202V351 30 | Expenses:Fees:Vanguard 1.67 USD 31 | -------------------------------------------------------------------------------- /frontend/third_party/fava/codemirror/mode-query.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable no-useless-escape */ 2 | // To keep the regular expressions in sync with Beancount, they might contain 3 | // some superfluous escape characters. 4 | 5 | import CodeMirror from 'codemirror/lib/codemirror'; 6 | 7 | // Import the autogenerated (by a script in the 'contrib' directory) lists 8 | import { columns, functions, keywords } from './bql-grammar.json'; 9 | 10 | // This should match the grammar defined in Beancount (`query/query_parser.py`). 11 | CodeMirror.defineSimpleMode('beancount-query', { 12 | start: [ 13 | { 14 | regex: new RegExp(`(?=^|\\s)(${keywords.join('|')})(?=\\s|$)`, 'i'), 15 | token: 'keyword', 16 | }, 17 | { 18 | regex: /(\"[^\"]*\"|\'[^\']*\')/, 19 | token: 'string', 20 | }, 21 | { 22 | regex: /(?:\#(?:\"[^\"]*\"|\'[^\']*\')|\d\d\d\d-\d\d-\d\d)/, 23 | token: 'date', 24 | }, 25 | { 26 | regex: /[-+]?([0-9]+\.[0-9]*|[0-9]*\.[0-9]+)/, 27 | token: 'number', 28 | }, 29 | { 30 | regex: /[-+]?[0-9]+/, 31 | token: 'number', 32 | }, 33 | { 34 | regex: new RegExp(`(${columns.join('|')})(?=\\)|\\s|,|$)`, 'i'), 35 | token: 'variable-2', 36 | }, 37 | { 38 | regex: new RegExp(`(${functions.join('|')})(?=\\()`, 'i'), 39 | token: 'variable-3', 40 | }, 41 | ], 42 | }); 43 | -------------------------------------------------------------------------------- /testdata/source/ofx/test_vanguard_with_cash_account_matching_missing_primary/import_results.beancount: -------------------------------------------------------------------------------- 1 | ;; date: 2011-07-15 2 | ;; info: {"filename": "/vanguard.ofx", "type": "application/x-ofx"} 3 | 4 | ; features: [] 5 | 2011-07-15 * "SELLMF - THIS IS A MEMO" 6 | Assets:Investment:Vanguard:VFINX -42.123 VFINX {} @ 100 USD 7 | date: 2011-07-15 8 | ofx_fitid: "01234567890.0123.07152011.0" 9 | ofx_memo: "THIS IS A MEMO" 10 | ofx_type: "SELLMF" 11 | Income:Vanguard:Capital-Gains:VFINX 12 | Assets:Investment:Vanguard:Cash 4212.30 USD 13 | ofx_fitid: "01234567890.0123.07152011.0" 14 | 15 | ;; date: 2011-07-26 16 | ;; info: {"filename": "/vanguard.ofx", "type": "application/x-ofx"} 17 | 18 | 2011-07-26 balance Assets:Investment:Vanguard:VFINX 102.0 VFINX 19 | 20 | ;; date: 2011-07-26 21 | ;; info: {"filename": "/vanguard.ofx", "type": "application/x-ofx"} 22 | 23 | 2011-07-26 price VFINX 100.00 USD 24 | 25 | ;; date: 2011-07-26 26 | ;; info: {"filename": "/vanguard.ofx", "type": "application/x-ofx"} 27 | 28 | 2011-07-26 balance Assets:Investment:Vanguard:VFIAX 142.2 VFIAX 29 | 30 | ;; date: 2011-07-26 31 | ;; info: {"filename": "/vanguard.ofx", "type": "application/x-ofx"} 32 | 33 | 2011-07-26 price VFIAX 100.42 USD 34 | -------------------------------------------------------------------------------- /beancount_import/source/paypal_sanitize.py: -------------------------------------------------------------------------------- 1 | """Strips identifying information from a Paypal transaction JSON file. 2 | 3 | This is useful for creating test files. 4 | 5 | WARNING: This may not always strip all identifying information. You should 6 | always manually inspect the output. 7 | 8 | Currently, this only replaces the transaction id. 9 | """ 10 | 11 | import os 12 | import random 13 | 14 | 15 | def sanitize(input_path: str, output_directory: str): 16 | txn_id = os.path.splitext(os.path.basename(input_path))[0] 17 | with open(input_path, 'r', encoding='utf-8', newline='\n') as f: 18 | content = f.read() 19 | base_36_chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ' 20 | new_txn_id = ''.join(base_36_chars[random.randint(0, 35)] for _ in txn_id) 21 | content = content.replace(txn_id, new_txn_id) 22 | output_path = os.path.join(output_directory, new_txn_id + '.json') 23 | with open(output_path, 'w', encoding='utf-8', newline='\n') as f: 24 | f.write(content) 25 | print('Wrote: %s' % output_path) 26 | 27 | 28 | def main(): 29 | import argparse 30 | ap = argparse.ArgumentParser() 31 | ap.add_argument('input') 32 | ap.add_argument('output_directory') 33 | args = ap.parse_args() 34 | sanitize( 35 | args.input, 36 | args.output_directory, 37 | ) 38 | 39 | 40 | if __name__ == '__main__': 41 | main() 42 | -------------------------------------------------------------------------------- /frontend/third_party/fava/README.md: -------------------------------------------------------------------------------- 1 | This directory contains code copied from 2 | [Fava](https://github.com/beancount/fava) (primarily related to Codemirror). 3 | 4 | It is subject to the following license: 5 | 6 | The MIT License (MIT) 7 | 8 | Copyright (c) 2015-2016 Dominik Aumayr 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining a copy 11 | of this software and associated documentation files (the "Software"), to deal 12 | in the Software without restriction, including without limitation the rights 13 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the Software is 15 | furnished to do so, subject to the following conditions: 16 | 17 | The above copyright notice and this permission notice shall be included in all 18 | copies or substantial portions of the Software. 19 | 20 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | SOFTWARE. 27 | -------------------------------------------------------------------------------- /testdata/source/ofx/bank_medium.ofx: -------------------------------------------------------------------------------- 1 | OFXHEADER:100 2 | DATA:OFXSGML 3 | VERSION:102 4 | SECURITY:NONE 5 | ENCODING:USASCII 6 | CHARSET:1252 7 | COMPRESSION:NONE 8 | OLDFILEUID:NONE 9 | NEWFILEUID:NONE 10 | 11 | 0INFOOK20090523122017ENG200905231220172009052312201700024 12 | 200905231220170INFOOK 13 | CAD1600001000012300 000012345678CHECKING 14 | 2009040120090523122017 15 | POS20090401122017.000[-5:EST]-6.600000123456782009040100001MCDONALD'S #112POS MERCHANDISE;MCDONALD'S #112 16 | CHECK20090402122017.000[-5:EST]-316.6700001234567820090402000040Joe's Bald HairstylesMISCELLANEOUS PAYMENTS;Joe's Bald Hairstyles 17 | POS20090403122017.000[-5:EST]-22.000000123456782009040300005CONNIE'S HAIR DPOS MERCHANDISE;CONNIE'S HAIR D 18 | 382.3420090523122017682.3420090523122017 19 | -------------------------------------------------------------------------------- /examples/data/mint/mint.csv: -------------------------------------------------------------------------------- 1 | "Date","Description","Original Description","Amount","Transaction Type","Category","Account Name","Labels","Notes" 2 | "3/27/2017","Amazon","AMAZON MARKETPLACE SEATTLE WA<br/>Skydue Letter A4 Paper Expandi","7.99","debit","Shopping","Amazon Store Card","","" 3 | "3/24/2017","Amazon","AMAZON MARKETPLACE SEATTLE WA<br/>C.R. Gibson 9-Count Coloring F<br/>Skydue Floral Printed Accordio<br/>Bloom Daily Planners All In On<br/>V&A William Morris Garden File<br/>Cynthia Rowley File Folders, 3<br/>SHIPP","71.06","debit","Shopping","Amazon Store Card","","" 4 | "3/24/2017","Amazon","AMAZON MARKETPLACE SEATTLE WA<br/>Design Ideas 8758616-DI 875861<br/>SHIPPING AND TAX","16.21","debit","Shopping","Amazon Store Card","","" 5 | "3/24/2017","Amazon","AMAZON MARKETPLACE SEATTLE WA<br/>MUJI Gel Ink Ballpoint Pens 0.<br/>Suncatchers Colorful Bird Stai<br/>Cynthia Rowley File Folders, 3<br/>Rifle Paper Co. Jardin Weekly<br/>SHIPPING AND TAX","58.93","debit","Shopping","Amazon Store Card","","" 6 | "8/10/2016","Starbucks","STARBUCKS STORE 12345","2.45","debit","Coffee Shops","My Credit Card","","" 7 | "11/27/2013","Transfer from My Checking","CR CARD PAYMENT ALEXANDRIA VA","66.88","credit","Credit Card Payment","My Credit Card","","" 8 | "12/02/2013","National Federal Des","NATIONAL FEDERAL DES:TRNSFR","66.88","debit","Transfer","My Checking","","" 9 | -------------------------------------------------------------------------------- /testdata/source/mint/test_invalid/training_examples.json: -------------------------------------------------------------------------------- 1 | [ 2 | [ 3 | { 4 | "amount": "66.88 USD", 5 | "date": "2013-11-27", 6 | "key_value_pairs": { 7 | "desc": "CR CARD PAYMENT ALEXANDRIA VA" 8 | }, 9 | "source_account": "Liabilities:Credit-Card" 10 | }, 11 | "Assets:Checking" 12 | ], 13 | [ 14 | { 15 | "amount": "-66.88 USD", 16 | "date": "2013-12-02", 17 | "key_value_pairs": { 18 | "desc": "NATIONAL FEDERAL DES:TRNSFR" 19 | }, 20 | "source_account": "Assets:Checking" 21 | }, 22 | "Liabilities:Credit-Card" 23 | ], 24 | [ 25 | { 26 | "amount": "-2.45 USD", 27 | "date": "2016-08-10", 28 | "key_value_pairs": { 29 | "desc": "STARBUCKS STORE 12345" 30 | }, 31 | "source_account": "Liabilities:Credit-Card" 32 | }, 33 | "Expenses:Coffee" 34 | ], 35 | [ 36 | { 37 | "amount": "-2.45 USD", 38 | "date": "2016-08-10", 39 | "key_value_pairs": { 40 | "desc": "STARBUCKS STORE 12345" 41 | }, 42 | "source_account": "Liabilities:Credit-Card" 43 | }, 44 | "Expenses:Coffee" 45 | ], 46 | [ 47 | { 48 | "amount": "-2.45 USD", 49 | "date": "2016-08-10", 50 | "key_value_pairs": { 51 | "desc": "STARBUCKS STORE 12345" 52 | }, 53 | "source_account": "Liabilities:Credit-Card" 54 | }, 55 | "Expenses:Coffee" 56 | ] 57 | ] -------------------------------------------------------------------------------- /testdata/source/amazon/de_DE/447-6209054-6766419.json: -------------------------------------------------------------------------------- 1 | { 2 | "order_id": "447-6209054-6766419", 3 | "order_date": "2017-07-27", 4 | "shipments": [ 5 | { 6 | "shipped_date": null, 7 | "items": [ 8 | { 9 | "quantity": "1", 10 | "description": "Amazon-Konto aufgeladen", 11 | "sold_by": null, 12 | "condition": null, 13 | "price": { 14 | "number": "100.00", 15 | "currency": "EUR" 16 | } 17 | } 18 | ], 19 | "items_subtotal": null, 20 | "pretax_adjustments": [], 21 | "total_before_tax": { 22 | "number": "100.00", 23 | "currency": "EUR" 24 | }, 25 | "posttax_adjustments": [], 26 | "tax": [], 27 | "total": { 28 | "number": "100.00", 29 | "currency": "EUR" 30 | }, 31 | "errors": [] 32 | } 33 | ], 34 | "credit_card_transactions": [ 35 | { 36 | "date": "2017-07-27", 37 | "card_description": "Visa / Electron", 38 | "card_ending_in": "1234", 39 | "amount": { 40 | "number": "100.00", 41 | "currency": "EUR" 42 | } 43 | } 44 | ], 45 | "pretax_adjustments": [], 46 | "tax": null, 47 | "posttax_adjustments": [], 48 | "errors": [] 49 | } -------------------------------------------------------------------------------- /testdata/source/amazon/de_DE/071-4816388-0694813.json: -------------------------------------------------------------------------------- 1 | { 2 | "order_id": "071-4816388-0694813", 3 | "order_date": "2020-08-12", 4 | "shipments": [ 5 | { 6 | "shipped_date": null, 7 | "items": [ 8 | { 9 | "quantity": "1", 10 | "description": "Geschenkgutschein johndoe@mail.com", 11 | "sold_by": null, 12 | "condition": null, 13 | "price": { 14 | "number": "50.00", 15 | "currency": "EUR" 16 | } 17 | } 18 | ], 19 | "items_subtotal": null, 20 | "pretax_adjustments": [], 21 | "total_before_tax": { 22 | "number": "50.00", 23 | "currency": "EUR" 24 | }, 25 | "posttax_adjustments": [], 26 | "tax": [], 27 | "total": { 28 | "number": "50.00", 29 | "currency": "EUR" 30 | }, 31 | "errors": [] 32 | } 33 | ], 34 | "credit_card_transactions": [ 35 | { 36 | "date": "2020-08-12", 37 | "card_description": "Visa / Electron", 38 | "card_ending_in": "1234", 39 | "amount": { 40 | "number": "50.00", 41 | "currency": "EUR" 42 | } 43 | } 44 | ], 45 | "pretax_adjustments": [], 46 | "tax": null, 47 | "posttax_adjustments": [], 48 | "errors": [] 49 | } -------------------------------------------------------------------------------- /testdata/source/amazon/de_DE/075-2225405-7594823.json: -------------------------------------------------------------------------------- 1 | { 2 | "order_id": "075-2225405-7594823", 3 | "order_date": "2020-03-01", 4 | "shipments": [ 5 | { 6 | "shipped_date": null, 7 | "items": [ 8 | { 9 | "quantity": "1", 10 | "description": "Geschenkgutschein johndoe@mail.com", 11 | "sold_by": null, 12 | "condition": null, 13 | "price": { 14 | "number": "99.00", 15 | "currency": "EUR" 16 | } 17 | } 18 | ], 19 | "items_subtotal": null, 20 | "pretax_adjustments": [], 21 | "total_before_tax": { 22 | "number": "99.00", 23 | "currency": "EUR" 24 | }, 25 | "posttax_adjustments": [], 26 | "tax": [], 27 | "total": { 28 | "number": "99.00", 29 | "currency": "EUR" 30 | }, 31 | "errors": [] 32 | } 33 | ], 34 | "credit_card_transactions": [ 35 | { 36 | "date": "2020-03-01", 37 | "card_description": "Visa / Electron", 38 | "card_ending_in": "1234", 39 | "amount": { 40 | "number": "99.00", 41 | "currency": "EUR" 42 | } 43 | } 44 | ], 45 | "pretax_adjustments": [], 46 | "tax": null, 47 | "posttax_adjustments": [], 48 | "errors": [] 49 | } -------------------------------------------------------------------------------- /testdata/source/ofx/README.md: -------------------------------------------------------------------------------- 1 | - anzcc.ofx 2 | Source: https://github.com/jseutter/ofxparse/tree/master/tests/fixtures 3 | - bank_medium.ofx 4 | Source: https://github.com/jseutter/ofxparse/tree/master/tests/fixtures 5 | - checking.ofx 6 | Source: https://github.com/jseutter/ofxparse/tree/master/tests/fixtures 7 | - checking-emptyledgerbal.ofx 8 | Copied from checking.ofx, with LEDGERBAL entries modified to test 9 | https://github.com/jbms/beancount-import/issues/18 10 | - fidelity-savings.ofx 11 | Source: https://github.com/jseutter/ofxparse/tree/master/tests/fixtures 12 | - fidelity.ofx 13 | Source: https://github.com/jseutter/ofxparse/tree/master/tests/fixtures 14 | - investment_401k.ofx 15 | Source: https://github.com/jseutter/ofxparse/tree/master/tests/fixtures 16 | - multiple_accounts.ofx 17 | Source: https://github.com/jseutter/ofxparse/tree/master/tests/fixtures 18 | - suncorp.ofx 19 | Source: https://github.com/jseutter/ofxparse/tree/master/tests/fixtures 20 | - td_ameritrade.ofx 21 | Source: https://github.com/jseutter/ofxparse/tree/master/tests/fixtures 22 | - vanguard.ofx 23 | Source: https://github.com/jseutter/ofxparse/tree/master/tests/fixtures 24 | Fixed UNIQUEID fields to be different for the two securities referenced. 25 | - vanguard401k.ofx 26 | Source: https://github.com/jseutter/ofxparse/tree/master/tests/fixtures 27 | - investment_buy_sell_income.ofx 28 | Generated using `beancount_import.source.ofx_sanitize`. 29 | - checking2.ofx 30 | Generated using `beancount_import.source.ofx_sanitize`. 31 | -------------------------------------------------------------------------------- /testdata/source/paypal/5TO8EO8C4DZE4QCC7.json: -------------------------------------------------------------------------------- 1 | { 2 | "fptiTag": "paymentrec", 3 | "counterparty": { 4 | "detailsCounterpartyText": "Bank Account", 5 | "name": "Bank Account", 6 | "url": "", 7 | "isBusiness": true 8 | }, 9 | "links": { 10 | "reportDispute": { 11 | "target": "_blank", 12 | "linkUrl": "/cgi-bin/webscr?cmd=_comres_flow&trans_id=5TO8EO8C4DZE4QCC7&select_dispute_type=1" 13 | }, 14 | "sellerProtectionPolicy": { 15 | "target": "_blank", 16 | "linkUrl": "/webapps/mpp/ua/useragreement-full#11" 17 | } 18 | }, 19 | "showClassicDetails": false, 20 | "viewContext": "activity", 21 | "displayStatus": "", 22 | "transactionTypeEnum": "MONEY_TRANSFER", 23 | "transactionType": "MONEY_TRANSFER", 24 | "txnTypeServiceKey": "MONEY_TRANSFER", 25 | "status": "COMPLETED", 26 | "date": "April 29, 2013", 27 | "creationTimeBucket": "MoreThan3Months", 28 | "updateTimeBucket": "MoreThan3Months", 29 | "isCredit": true, 30 | "isBuyer": false, 31 | "isSeller": true, 32 | "transactionId": "5TO8EO8C4DZE4QCC7", 33 | "amount": { 34 | "grossAmount": "$700.00", 35 | "netAmount": "$700.00", 36 | "fullPageNetAmount": "$700.00", 37 | "feeAmount": "$0.00", 38 | "grossExceedsNet": false, 39 | "isZeroFee": true, 40 | "feeLabel": "Fee" 41 | }, 42 | "flags": { 43 | "isWinSMBEligible": true, 44 | "hasActions": true 45 | }, 46 | "printDetailsLink": { 47 | "linkUrl": "/myaccount/transactions/print-details/5TO8EO8C4DZE4QCC7", 48 | "target": "_blank" 49 | }, 50 | "partner": {} 51 | } -------------------------------------------------------------------------------- /beancount_import/source/paypal_test.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | import pytest 4 | 5 | from .source_test import check_source_example 6 | 7 | testdata_dir = os.path.realpath( 8 | os.path.join( 9 | os.path.dirname(__file__), '..', '..', 'testdata', 'source', 10 | 'paypal')) 11 | 12 | examples = [ 13 | 'test_basic', 14 | 'test_matching', 15 | ] 16 | 17 | 18 | @pytest.mark.parametrize('name', examples) 19 | def test_source_en_US(name: str): 20 | check_source_example( 21 | example_dir=os.path.join(testdata_dir, name), 22 | source_spec={ 23 | 'module': 'beancount_import.source.paypal', 24 | 'directory': testdata_dir, 25 | 'assets_account': 'Assets:Paypal', 26 | 'fee_account': 'Expenses:Financial:Paypal:Fees', 27 | 'prefix': 'paypal', 28 | }, 29 | replacements=[(testdata_dir, '')]) 30 | 31 | 32 | # locale DE 33 | examples = [ 34 | 'test_basic', 35 | # 'test_matching', 36 | ] 37 | 38 | 39 | @pytest.mark.parametrize('name', examples) 40 | def test_source_de_DE(name: str): 41 | check_source_example( 42 | example_dir=os.path.join(testdata_dir, 'de_DE', name), 43 | source_spec={ 44 | 'module': 'beancount_import.source.paypal', 45 | 'directory': os.path.join(testdata_dir, 'de_DE'), 46 | 'assets_account': 'Assets:Paypal', 47 | 'fee_account': 'Expenses:Financial:Paypal:Fees', 48 | 'prefix': 'paypal', 49 | 'locale': 'de_DE' 50 | }, 51 | replacements=[(testdata_dir, '')]) -------------------------------------------------------------------------------- /testdata/source/ultipro_google/test_20211223/20211223-1.txt: -------------------------------------------------------------------------------- 1 | Google LLC 2 | 1600 Amphitheatre Parkway 3 | Mountain View, CA 94043 4 | 650-253-0000 5 | Pay Statement 6 | Period Start Date 12/06/2021 7 | Period End Date 12/19/2021 8 | Pay Date 12/23/2021 9 | Document 98765432 10 | Net Pay $600.00 11 | Pay Details 12 | Bean Counter 13 | 123 Import St 14 | New York, NY 10001 15 | USA 16 | Employee Number 000123456 17 | SSN XXX-XX-XXXX 18 | Job Accountant 19 | Pay Rate $100.0000 20 | Pay Frequency Biweekly 21 | Pay Group Salaried Employees 22 | Location US-NYC-NYC 23 | Cost Center 111 - Finance - Accounting 24 | Earnings 25 | Pay Type Hours Pay Rate Current YTD 26 | Regular Pay 80.0000 $100.0000 $8,000.00 $16,000.00 27 | Total Hours Worked 80.0000 Total Hours 80.0000 28 | Deductions 29 | Deduction Based On Pre-Tax Employee Current Employee YTD Employer Current Employer YTD 30 | 401K Pretax $8,000.00 Yes $6,000.00 $12,000.00 $3,000.00 $6,000.00 31 | Medical $2.22 Yes $2.22 $4.44 $0.00 $0.00 32 | Taxes 33 | Tax Based On Current YTD 34 | Federal Income Tax $2,000.00 $200.00 $400.00 35 | Employee Medicare $8,000.00 $50.00 $100.00 36 | Social Security Employee Tax $8,000.00 $50.00 $150.00 37 | NY State Income Tax $3,000.00 $100.00 $100.00 38 | Paid Time Off 39 | Plan Current Balance 40 | Vacation 0.0000 0.0000 41 | Net Pay Distribution 42 | Account Number Account Type Amount 43 | xxxxxxxx1234 Checking $600.00 44 | Total $600.00 45 | Pay Summary 46 | Gross FIT Taxable Wages Taxes Deductions Net Pay 47 | Current $8,050.00 $2,000.00 $400.00 $6,056.66 $600.00 48 | YTD $16,000 $4,000.00 $800.00 $9,000.00 $1200.00 49 | 50 | -------------------------------------------------------------------------------- /frontend/README.md: -------------------------------------------------------------------------------- 1 | This directory contains the source code for the Beancount-import web frontend. 2 | 3 | The web frontend communicates with a Python server (typically running on the 4 | same machine) over a websocket. The Python server also serves a copy of the 5 | frontend code. 6 | 7 | # Development 8 | 9 | Building the frontend requires some additional setup: 10 | 11 | 1. A recent version of [Node.js](https://nodejs.org) is required to build the 12 | frontend. The recommended way to obtain Node.js is by installing NVM (node 13 | version manager) by following the instructions here: 14 | 15 | https://github.com/creationix/nvm 16 | 17 | 2. Install a recent version of Node.js by running: 18 | 19 | `nvm install stable` 20 | 21 | You can also specify a version manually. 22 | 23 | 3. From within this directory, install the dependencies required by this 24 | project: 25 | 26 | `npm install` 27 | 28 | 4. To build a development version of the frontend, run: 29 | 30 | `npm run builddev` 31 | 32 | Alternatively, you can run: 33 | 34 | `npm run builddev:watch` 35 | 36 | This watches the source tree and incrementally rebuilds as changes are made. 37 | This is the recommended command to use during development. 38 | 39 | 5. The build output is written to the 40 | (beancount_import/frontend_dist/)[../beancount_import/frontend_dist/] 41 | directory. When using the `builddev` or `builddev:watch` commands, the 42 | frontend is built in development mode. When using the `build` command, the 43 | frontend is built in production (minified) mode. 44 | -------------------------------------------------------------------------------- /testdata/source/mint/test_invalid/journal.beancount: -------------------------------------------------------------------------------- 1 | plugin "beancount.plugins.auto_accounts" 2 | 3 | 1900-01-01 open Liabilities:Credit-Card USD 4 | mint_id: "My Credit Card" 5 | 6 | 1900-01-01 open Assets:Checking USD 7 | mint_id: "My Checking" 8 | 9 | 2013-11-27 * "CR CARD PAYMENT ALEXANDRIA VA" 10 | Liabilities:Credit-Card 66.88 USD 11 | invalid0: "1 extra" 12 | date: 2013-11-27 13 | source_desc: "CR CARD PAYMENT ALEXANDRIA VA" 14 | cleared: TRUE 15 | Assets:Checking -66.88 USD 16 | date: 2013-12-02 17 | source_desc: "NATIONAL FEDERAL DES:TRNSFR" 18 | cleared: TRUE 19 | 20 | 2013-11-27 * "CR CARD PAYMENT ALEXANDRIA VA" 21 | Liabilities:Credit-Card 66.88 USD 22 | invalid0: "1 extra" 23 | date: 2013-11-27 24 | source_desc: "CR CARD PAYMENT ALEXANDRIA VA" 25 | cleared: TRUE 26 | Expenses:FIXME -66.88 USD 27 | 28 | 2016-08-10 * "STARBUCKS STORE 12345" 29 | Liabilities:Credit-Card -2.45 USD 30 | invalid1: "2 extra" 31 | date: 2016-08-10 32 | source_desc: "STARBUCKS STORE 12345" 33 | cleared: TRUE 34 | Expenses:Coffee 2.45 USD 35 | 36 | 2016-08-10 * "STARBUCKS STORE 12345" 37 | Liabilities:Credit-Card -2.45 USD 38 | invalid1: "2 extra" 39 | date: 2016-08-10 40 | source_desc: "STARBUCKS STORE 12345" 41 | cleared: TRUE 42 | Expenses:Coffee 2.45 USD 43 | 44 | 2016-08-10 * "STARBUCKS STORE 12345" 45 | Liabilities:Credit-Card -2.45 USD 46 | invalid1: "2 extra" 47 | date: 2016-08-10 48 | source_desc: "STARBUCKS STORE 12345" 49 | cleared: TRUE 50 | Expenses:Coffee 2.45 USD 51 | -------------------------------------------------------------------------------- /testdata/source/venmo/test_matching/import_results.beancount: -------------------------------------------------------------------------------- 1 | ;; date: 2017-04-05 2 | ;; info: {"filename": "/balances.csv", "line": 2, "type": "text/csv"} 3 | 4 | 2017-04-05 balance Assets:Venmo 0.00 USD 5 | 6 | ;; date: 2017-07-04 7 | ;; info: {"filename": "/balances.csv", "line": 2, "type": "text/csv"} 8 | 9 | 2017-07-04 balance Assets:Venmo 0.00 USD 10 | 11 | ;; date: 2017-07-04 12 | ;; info: {"filename": "/balances.csv", "line": 3, "type": "text/csv"} 13 | 14 | 2017-07-04 balance Assets:Venmo 0.00 USD 15 | 16 | ;; date: 2017-10-02 17 | ;; info: {"filename": "/balances.csv", "line": 3, "type": "text/csv"} 18 | 19 | 2017-10-02 balance Assets:Venmo 0.00 USD 20 | 21 | ;; date: 2017-10-02 22 | ;; info: {"filename": "/balances.csv", "line": 4, "type": "text/csv"} 23 | 24 | 2017-10-02 balance Assets:Venmo 0.00 USD 25 | 26 | ;; date: 2017-12-31 27 | ;; info: {"filename": "/balances.csv", "line": 4, "type": "text/csv"} 28 | 29 | 2017-12-31 balance Assets:Venmo 1528.25 USD 30 | 31 | ;; date: 2017-12-31 32 | ;; info: {"filename": "/balances.csv", "line": 5, "type": "text/csv"} 33 | 34 | 2017-12-31 balance Assets:Venmo 1528.25 USD 35 | 36 | ;; date: 2018-01-21 37 | ;; info: {"filename": "/balances.csv", "line": 5, "type": "text/csv"} 38 | 39 | 2018-01-21 balance Assets:Venmo 0.00 USD 40 | -------------------------------------------------------------------------------- /testdata/source/ultipro_google/test_20220107/20220107-1.txt: -------------------------------------------------------------------------------- 1 | Google LLC 2 | 1600 Amphitheatre Parkway 3 | Mountain View, CA 94043 4 | 650-253-0000 5 | Pay Statement 6 | Period Start Date 12/20/2021 7 | Period End Date 01/02/2022 8 | Pay Date 01/07/2022 9 | Document 19260817 10 | Net Pay $600.00 11 | Pay Details 12 | Bean Counter 13 | 123 Import St 14 | New York, NY 10001 15 | USA 16 | Employee Number 000123456 17 | SSN XXX-XX-XXXX 18 | Job Accountant 19 | Pay Rate $100.0000 20 | Pay Frequency Biweekly 21 | Pay Group Salaried Employees 22 | Location US-NYC-NYC 23 | Cost Center 111 - Finance - Accounting 24 | Earnings 25 | Pay Type Hours Pay Rate Current YTD 26 | Regular Pay 80.0000 $100.0000 $8,000.00 $16,000.00 27 | Total Hours Worked 80.0000 Total Hours 80.0000 28 | Deductions 29 | Deduction Based On Pre-Tax Employee Current Employee YTD Employer Current Employer YTD 30 | 401K Pretax $8,000.00 Yes $6,000.00 $12,000.00 $3,000.00 $6,000.00 31 | Medical $2.22 Yes $2.22 $4.44 $0.00 $0.00 32 | Accident Ins. $1.23 No $1.23 $1.23 $0.00 $0.00 33 | Taxes 34 | Tax Based On Current YTD 35 | Federal Income Tax $2,000.00 $200.00 $400.00 36 | Employee Medicare $8,000.00 $50.00 $100.00 37 | Social Security Employee Tax $8,000.00 $50.00 $150.00 38 | NY State Income Tax $3,000.00 $100.00 $100.00 39 | Paid Time Off 40 | Plan Current Balance 41 | Vacation 0.0000 0.0000 42 | Net Pay Distribution 43 | Account Number Account Type Amount 44 | xxxxxxxx1234 Checking $600.00 45 | Total $600.00 46 | Pay Summary 47 | Gross FIT Taxable Wages Taxes Deductions Net Pay 48 | Current $8,000.00 $2,000.00 $400.00 $6,003.45 $600.00 49 | YTD $16,000 $4,000.00 $800.00 $9,000.00 $1200.00 50 | 51 | -------------------------------------------------------------------------------- /testdata/source/venmo/test_invalid_references/import_results.beancount: -------------------------------------------------------------------------------- 1 | ;; date: 2017-04-05 2 | ;; info: {"filename": "/balances.csv", "line": 2, "type": "text/csv"} 3 | 4 | 2017-04-05 balance Assets:Venmo 0.00 USD 5 | 6 | ;; date: 2017-07-04 7 | ;; info: {"filename": "/balances.csv", "line": 2, "type": "text/csv"} 8 | 9 | 2017-07-04 balance Assets:Venmo 0.00 USD 10 | 11 | ;; date: 2017-07-04 12 | ;; info: {"filename": "/balances.csv", "line": 3, "type": "text/csv"} 13 | 14 | 2017-07-04 balance Assets:Venmo 0.00 USD 15 | 16 | ;; date: 2017-10-02 17 | ;; info: {"filename": "/balances.csv", "line": 3, "type": "text/csv"} 18 | 19 | 2017-10-02 balance Assets:Venmo 0.00 USD 20 | 21 | ;; date: 2017-10-02 22 | ;; info: {"filename": "/balances.csv", "line": 4, "type": "text/csv"} 23 | 24 | 2017-10-02 balance Assets:Venmo 0.00 USD 25 | 26 | ;; date: 2017-12-31 27 | ;; info: {"filename": "/balances.csv", "line": 4, "type": "text/csv"} 28 | 29 | 2017-12-31 balance Assets:Venmo 1528.25 USD 30 | 31 | ;; date: 2017-12-31 32 | ;; info: {"filename": "/balances.csv", "line": 5, "type": "text/csv"} 33 | 34 | 2017-12-31 balance Assets:Venmo 1528.25 USD 35 | 36 | ;; date: 2018-01-21 37 | ;; info: {"filename": "/balances.csv", "line": 5, "type": "text/csv"} 38 | 39 | 2018-01-21 balance Assets:Venmo 0.00 USD 40 | -------------------------------------------------------------------------------- /testdata/source/venmo/transactions.csv: -------------------------------------------------------------------------------- 1 | " ID","Datetime","Type","Status","Note","From","To","Amount (total)","Amount (fee)","Funding Source","Destination" 2 | "2394198259925614643","2017-04-25T03:15:53","Payment","Complete","Tutoring","Brian Taylor","Tom Johnson","- $220.00","","Visa Debit *1559","" 3 | "3483695350643256240","2017-09-02T01:04:09","Payment","Complete","Security deposit","Brian Taylor","Maria Anderson","- $559.00","","Visa Debit *1559","" 4 | "0454063333607815882","2017-09-06T05:10:45","Payment","Complete","Rent","Sally Smith","Brian Taylor","+ $1,150.00","","","Venmo balance" 5 | "355418184","2017-09-06T05:13:03","Standard Transfer","Issued","","","","- $1,150.00","","","Visa Debit *8967" 6 | "3641977597632667950","2018-04-05T18:22:13","Charge","Complete","Utilities","Maria Anderson","Brian Taylor","- $120.00","","Visa Debit *1559","" 7 | "4354205292885612406","2018-04-17T15:43:19","Payment","Complete","Bagels","Brian Taylor","Maria Anderson","- $3.00","","Visa Debit *1559","" 8 | "3083645406127028805","2018-05-01T14:49:07","Payment","Complete","Rent","Sally Smith","Brian Taylor","+ $1,423.73","","","Venmo balance" 9 | "1326234690911981511","2018-05-19T00:08:52","Charge","Complete","Utilities","Maria Anderson","Brian Taylor","- $82.50","","Venmo balance","" 10 | "7315187729","2018-05-19T00:09:15","Standard Transfer","Issued","","","","- $1,341.23","","","Visa Debit *8967" 11 | "1291991306506600548",2022-01-09T01:59:03,"Merchant Transaction","Complete","","Charlie Chow","Local Eats","- $2.24","","Venmo balance","" 12 | "1299175267271967461",2022-02-18T23:24:55,"Merchant Transaction","Complete","","Charlie Chow","Distant Treats","- $22.84","","Bank Checking*1234","" 13 | -------------------------------------------------------------------------------- /testdata/source/paypal/LZ63BPLO2CIA3MUIG.json: -------------------------------------------------------------------------------- 1 | { 2 | "fptiTag": "moneyrec", 3 | "counterparty": { 4 | "detailsCounterpartyText": "John Smith", 5 | "name": "John Smith", 6 | "email": "john.smith@example.com", 7 | "url": "", 8 | "isBusiness": false 9 | }, 10 | "links": { 11 | "reportDispute": { 12 | "target": "_blank", 13 | "linkUrl": "/cgi-bin/webscr?cmd=_comres_flow&trans_id=LZ63BPLO2CIA3MUIG&select_dispute_type=1" 14 | }, 15 | "sellerProtectionPolicy": { 16 | "target": "_blank", 17 | "linkUrl": "/webapps/mpp/ua/useragreement-full#11" 18 | } 19 | }, 20 | "showClassicDetails": false, 21 | "viewContext": "activity", 22 | "displayStatus": "", 23 | "transactionTypeEnum": "SEND_MONEY_RECEIVED", 24 | "transactionType": "Money Received", 25 | "txnTypeServiceKey": "PAYMENT", 26 | "status": "COMPLETED", 27 | "date": "April 29, 2013", 28 | "creationTimeBucket": "MoreThan3Months", 29 | "updateTimeBucket": "MoreThan3Months", 30 | "isCredit": true, 31 | "isBuyer": false, 32 | "isSeller": true, 33 | "transactionId": "LZ63BPLO2CIA3MUIG", 34 | "amount": { 35 | "grossAmount": "$700.00", 36 | "netAmount": "$700.00", 37 | "fullPageNetAmount": "$700.00", 38 | "feeAmount": "$0.00", 39 | "grossExceedsNet": false, 40 | "isZeroFee": true, 41 | "feeLabel": "Fee" 42 | }, 43 | "flags": { 44 | "isWinSMBEligible": true, 45 | "isP2PPersonal": true, 46 | "showPaymentDetails": true, 47 | "hasActions": true 48 | }, 49 | "printDetailsLink": { 50 | "linkUrl": "/myaccount/transactions/print-details/LZ63BPLO2CIA3MUIG", 51 | "target": "_blank" 52 | }, 53 | "partner": {} 54 | } 55 | -------------------------------------------------------------------------------- /testdata/source/generic_importer/test_training_examples/journal.beancount: -------------------------------------------------------------------------------- 1 | 1900-01-01 open Assets:Bank 2 | 1900-01-01 open Assets:Cash 3 | 1900-01-01 open Expenses:Misc 4 | 1900-01-01 open Liabilities:JohnDoe 5 | 6 | 7 | 2020-01-01 * "by debit card-OTHPG 063441 GOOGLE CLOUD INDIA PVTTHANE-" 8 | Assets:Bank -1 USD 9 | source_desc: "by debit card-OTHPG 063441 GOOGLE CLOUD INDIA PVTTHANE-" 10 | date: 2020-01-01 11 | cleared: TRUE 12 | Expenses:Misc 1 USD 13 | 14 | 2020-01-01 * "by debit card-OTHPG 063444 GOOGLE CLOUD INDIA PVTTHANE-" 15 | Assets:Bank -1 USD 16 | source_desc: "by debit card-OTHPG 063444 GOOGLE CLOUD INDIA PVTTHANE-" 17 | date: 2020-01-01 18 | cleared: TRUE 19 | Expenses:Misc 1 USD 20 | 21 | 2020-01-02 * "BULK POSTING- 00000008237 250120 GOOGLE CLOUD INDIA PVT-" 22 | Assets:Bank 1 USD 23 | source_desc: "BULK POSTING- 00000008237 250120 GOOGLE CLOUD INDIA PVT-" 24 | date: 2020-01-02 25 | cleared: TRUE 26 | Expenses:Misc -1 USD 27 | 28 | 2020-01-02 * "BULK POSTING- 00000008237 250120 GOOGLE CLOUD INDIA PVT-" 29 | Assets:Bank 1 USD 30 | source_desc: "BULK POSTING- 00000008237 250120 GOOGLE CLOUD INDIA PVT-" 31 | date: 2020-01-02 32 | cleared: TRUE 33 | Expenses:Misc -1 USD 34 | 35 | 2020-01-02 * "ATM-WD Some Random ATM Machine" 36 | Assets:Bank 500 USD 37 | source_desc: "ATM-WD Some Random ATM Machine" 38 | date: 2020-01-02 39 | cleared: TRUE 40 | Assets:Cash -500 USD 41 | 42 | 2020-01-05 * "Transfer to 1234567890123" 43 | Assets:Bank 300 USD 44 | source_desc: "Transfer to 1234567890123" 45 | date: 2020-01-05 46 | cleared: TRUE 47 | Liabilities:JohnDoe -300 USD 48 | -------------------------------------------------------------------------------- /testdata/source/amazon/de_DE/399-5779972-5007935.json: -------------------------------------------------------------------------------- 1 | { 2 | "order_id": "399-5779972-5007935", 3 | "order_date": "2021-11-21", 4 | "shipments": [ 5 | { 6 | "shipped_date": "2021-11-22", 7 | "items": [ 8 | { 9 | "quantity": "1", 10 | "description": "tiptoi\u00ae Mein gro\u00dfes Wimmelbuch, Friese, Inka", 11 | "sold_by": "Amazon EU S.a.r.L.", 12 | "condition": "Neu", 13 | "price": { 14 | "number": "16.99", 15 | "currency": "EUR" 16 | } 17 | } 18 | ], 19 | "items_subtotal": null, 20 | "pretax_adjustments": [], 21 | "total_before_tax": { 22 | "number": "16.99", 23 | "currency": "EUR" 24 | }, 25 | "posttax_adjustments": [], 26 | "tax": [], 27 | "total": { 28 | "number": "16.99", 29 | "currency": "EUR" 30 | }, 31 | "errors": [] 32 | } 33 | ], 34 | "credit_card_transactions": [ 35 | { 36 | "date": "2021-11-21", 37 | "card_description": "Bankeinzug", 38 | "card_ending_in": "600", 39 | "amount": { 40 | "number": "16.99", 41 | "currency": "EUR" 42 | } 43 | } 44 | ], 45 | "pretax_adjustments": [ 46 | { 47 | "description": "Verpackung & Versand", 48 | "amount": { 49 | "number": "0.00", 50 | "currency": "EUR" 51 | } 52 | } 53 | ], 54 | "tax": null, 55 | "posttax_adjustments": [], 56 | "errors": [] 57 | } -------------------------------------------------------------------------------- /testdata/source/ofx/test_vanguard_basic/import_results.beancount: -------------------------------------------------------------------------------- 1 | ;; date: 2011-07-15 2 | ;; info: {"filename": "/vanguard.ofx", "type": "application/x-ofx"} 3 | 4 | ; features: [ 5 | ; { 6 | ; "amount": "-42.123 VFINX", 7 | ; "date": "2011-07-15", 8 | ; "key_value_pairs": { 9 | ; "desc": "THIS IS A MEMO", 10 | ; "ofx_memo": "THIS IS A MEMO", 11 | ; "ofx_type": "SELLMF" 12 | ; }, 13 | ; "source_account": "Assets:Investment:Vanguard:VFINX" 14 | ; } 15 | ; ] 16 | 2011-07-15 * "SELLMF - THIS IS A MEMO" 17 | Assets:Investment:Vanguard:VFINX -42.123 VFINX {} @ 100 USD 18 | date: 2011-07-15 19 | ofx_fitid: "01234567890.0123.07152011.0" 20 | ofx_memo: "THIS IS A MEMO" 21 | ofx_type: "SELLMF" 22 | Income:Vanguard:Capital-Gains:VFINX 23 | Expenses:FIXME 4212.30 USD 24 | 25 | ;; date: 2011-07-26 26 | ;; info: {"filename": "/vanguard.ofx", "type": "application/x-ofx"} 27 | 28 | 2011-07-26 balance Assets:Investment:Vanguard:VFINX 102.0 VFINX 29 | 30 | ;; date: 2011-07-26 31 | ;; info: {"filename": "/vanguard.ofx", "type": "application/x-ofx"} 32 | 33 | 2011-07-26 price VFINX 100.00 USD 34 | 35 | ;; date: 2011-07-26 36 | ;; info: {"filename": "/vanguard.ofx", "type": "application/x-ofx"} 37 | 38 | 2011-07-26 balance Assets:Investment:Vanguard:VFIAX 142.2 VFIAX 39 | 40 | ;; date: 2011-07-26 41 | ;; info: {"filename": "/vanguard.ofx", "type": "application/x-ofx"} 42 | 43 | 2011-07-26 price VFIAX 100.42 USD 44 | -------------------------------------------------------------------------------- /testdata/source/ofx/test_vanguard_with_cash_account_matching_missing_transfer/import_results.beancount: -------------------------------------------------------------------------------- 1 | ;; date: 2011-07-15 2 | ;; info: {"filename": "/vanguard.ofx", "type": "application/x-ofx"} 3 | 4 | ; features: [ 5 | ; { 6 | ; "amount": "-4212.30 USD", 7 | ; "date": "2011-07-15", 8 | ; "key_value_pairs": { 9 | ; "desc": "THIS IS A MEMO", 10 | ; "ofx_memo": "THIS IS A MEMO", 11 | ; "ofx_type_transfer": "SELLMF" 12 | ; }, 13 | ; "source_account": "Assets:Investment:Vanguard:Cash" 14 | ; } 15 | ; ] 16 | 2011-07-15 * "Transfer due to: SELLMF - THIS IS A MEMO" 17 | Assets:Investment:Vanguard:Cash -4212.30 USD 18 | date: 2011-07-15 19 | ofx_fitid: ">01234567890.0123.07152011.0" 20 | ofx_memo: "THIS IS A MEMO" 21 | ofx_type_transfer: "SELLMF" 22 | Expenses:FIXME 4212.30 USD 23 | 24 | ;; date: 2011-07-26 25 | ;; info: {"filename": "/vanguard.ofx", "type": "application/x-ofx"} 26 | 27 | 2011-07-26 balance Assets:Investment:Vanguard:VFINX 102.0 VFINX 28 | 29 | ;; date: 2011-07-26 30 | ;; info: {"filename": "/vanguard.ofx", "type": "application/x-ofx"} 31 | 32 | 2011-07-26 price VFINX 100.00 USD 33 | 34 | ;; date: 2011-07-26 35 | ;; info: {"filename": "/vanguard.ofx", "type": "application/x-ofx"} 36 | 37 | 2011-07-26 balance Assets:Investment:Vanguard:VFIAX 142.2 VFIAX 38 | 39 | ;; date: 2011-07-26 40 | ;; info: {"filename": "/vanguard.ofx", "type": "application/x-ofx"} 41 | 42 | 2011-07-26 price VFIAX 100.42 USD 43 | -------------------------------------------------------------------------------- /examples/manually_entered/accounts.beancount: -------------------------------------------------------------------------------- 1 | 1900-01-01 open Liabilities:Credit-Card:National-Federal USD 2 | mint_id: "My Credit Card" 3 | 4 | 1900-01-01 open Assets:Checking:Wells-Fargo USD 5 | mint_id: "My Checking" 6 | 7 | 1900-01-01 open Assets:Checking:Chase USD 8 | ofx_org: "MyBank" 9 | ofx_broker_id: "MyBank" 10 | account_id: "123456789" 11 | ofx_account_type: "cash_only" 12 | 13 | 1900-01-01 open Assets:Investment:MyBank USD 14 | ofx_org: "MyBank" 15 | ofx_broker_id: "MyBank" 16 | account_id: "X1234" 17 | ofx_account_type: "securities_and_cash" 18 | fees_account: "Expenses:MyBank:Fees" 19 | commission_account: "Expenses:MyBank:Fees" 20 | div_income_account: "Income:MyBank:Dividends" 21 | interest_income_account: "Income:MyBank:Interest" 22 | capital_gains_account: "Income:MyBank:Capital-Gains" 23 | 24 | 2016-08-10 open Expenses:Coffee USD 25 | 26 | 2018-06-11 open Liabilities:Credit-Card:Chase USD 27 | 28 | 2018-06-11 open Expenses:Gas USD 29 | 30 | 2018-06-12 open Expenses:Miscellaneous USD 31 | 32 | 2018-06-12 open Expenses:Clothes USD 33 | 34 | 2010-06-13 open Expenses:Electronics USD 35 | 36 | 2010-06-13 open Assets:Receivable:Fred USD 37 | 38 | 2010-06-13 open Liabilities:Credit-Card:Wells-Fargo USD 39 | 40 | 2018-06-14 open Income:My-Company:Salary USD 41 | 42 | 1994-01-01 open Expenses:ImaginarySon:Education EUR 43 | 44 | 1900-01-01 open Assets:FooBarBank EUR 45 | 46 | 1900-01-01 open Expenses:Groceries 47 | 48 | 1900-01-01 open Liabilities:Amex-Credit-Card EUR 49 | -------------------------------------------------------------------------------- /beancount_import/api_proxies/beautifulsoup.py: -------------------------------------------------------------------------------- 1 | from bs4.element import Tag, PageElement, _FindMethodName, NavigableString 2 | 3 | from typing import Optional, Any, Union, cast, Pattern, Callable, Iterable 4 | from bs4._typing import ( 5 | _OneElement, 6 | _StrainableAttribute, 7 | _StrainableAttributes, 8 | _StrainableString, 9 | ) 10 | 11 | # 12 | # 13 | def require_find( 14 | tag: Tag, 15 | name: _FindMethodName = None, 16 | attrs: _StrainableAttributes = {}, 17 | recursive: bool = True, 18 | string: Optional[_StrainableString] = None, 19 | **kwargs: _StrainableAttribute, 20 | ) -> _OneElement: 21 | 22 | """ 23 | wrapper for Tag.find() that behaves like find() but raises if element is not found. 24 | Assumes the result is always a Tag (not NavigableString). 25 | """ 26 | result = tag.find( 27 | name=name, 28 | attrs=attrs, 29 | recursive=recursive, 30 | string=string, 31 | **kwargs, 32 | ) 33 | if result is None or not isinstance(result, Tag): 34 | raise ValueError(f"require_find: Element not found: {name!r}, {attrs!r}, {kwargs!r}") 35 | return cast(Tag, result) 36 | 37 | def require_find_parent( 38 | page_element: PageElement, 39 | name: _FindMethodName = None, 40 | attrs: _StrainableAttributes = {}, 41 | **kwargs: _StrainableAttribute, 42 | ) -> Tag: 43 | 44 | result = page_element.find_parent( 45 | name=name, 46 | attrs=attrs, 47 | **kwargs, 48 | ) 49 | if result is None or not isinstance(result, Tag): 50 | raise ValueError( 51 | f"require_find_parent: Element not found: {name!r}, {attrs!r}, {kwargs!r}") 52 | return cast(Tag, result) 53 | -------------------------------------------------------------------------------- /beancount_import/training_test.py: -------------------------------------------------------------------------------- 1 | import datetime 2 | 3 | from beancount.core.data import Amount 4 | from beancount.core.number import D 5 | from . import test_util 6 | from . import training 7 | 8 | 9 | def test_get_features(): 10 | date = datetime.date.min 11 | amount = Amount.from_string('3 USD') 12 | assert training.get_features( 13 | training.PredictionInput( 14 | date=date, 15 | amount=amount, 16 | source_account='Assets:Checking', 17 | key_value_pairs={ 18 | 'a': 'hello', 19 | 'b': 'foo bar' 20 | })) == { 21 | 'account:Assets:Checking': True, 22 | 'a:hello': True, 23 | 'b:foo': True, 24 | 'b:bar': True, 25 | 'b:foo bar': True, 26 | 'a': True, 27 | 'b': True, 28 | 'amount:USD': D(3) 29 | } 30 | 31 | 32 | def test_get_unknown_account_group_numbers(): 33 | entry, = test_util.parse(""" 34 | 1900-01-01 * "Narration" 35 | Expenses:A -40 USD 36 | Expenses:FIXME 3 USD 37 | Expenses:B 5 USD 38 | Expenses:FIXME:A 5 USD 39 | Expenses:FIXME:A 6 USD 40 | Expenses:FIXME:B 8 USD 41 | Expenses:FIXME:B 10 USD 42 | Expenses:FIXME 5 USD 43 | """) 44 | assert training.get_unknown_account_group_numbers(entry) == [ 45 | 0, 1, 1, 2, 2, 3 46 | ] 47 | assert training.get_unknown_account_names(entry) == [ 48 | 'Expenses:FIXME', 49 | 'Expenses:FIXME:A', 50 | 'Expenses:FIXME:A', 51 | 'Expenses:FIXME:B', 52 | 'Expenses:FIXME:B', 53 | 'Expenses:FIXME', 54 | ] 55 | -------------------------------------------------------------------------------- /beancount_import/unbook_test.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | 3 | from beancount.core.amount import Amount 4 | from beancount.core.data import Posting 5 | from beancount.core.number import D 6 | 7 | from . import unbook 8 | 9 | 10 | class UnbookTest(unittest.TestCase): 11 | def test_posting_no_merge(self): 12 | postings = [ 13 | Posting(account="a", units=Amount(D(10), "USD"), cost=None, 14 | price=None, flag=None, meta=None), 15 | Posting(account="a", units=Amount(D(20), "USD"), cost=None, 16 | price=None, flag=None, meta=None), 17 | ] 18 | result = list(unbook.group_postings_by_meta(postings)) 19 | assert len(result) == 2 20 | 21 | def test_posting_merge_first_posting_does_nothing(self): 22 | postings = [ 23 | Posting(account="a", units=Amount(D(10), "USD"), cost=None, 24 | price=None, flag=None, meta={"merge": True}), 25 | Posting(account="a", units=Amount(D(20), "USD"), cost=None, 26 | price=None, flag=None, meta=None), 27 | ] 28 | result = list(unbook.group_postings_by_meta(postings)) 29 | assert len(result) == 2 30 | 31 | def test_merge_posting_meta(self): 32 | postings = [ 33 | Posting(account="a", units=Amount(D(10), "USD"), cost=None, 34 | price=None, flag=None, meta=None), 35 | Posting(account="a", units=Amount(D(20), "USD"), cost=None, 36 | price=None, flag=None, meta={"merge": True}), 37 | ] 38 | result = list(unbook.group_postings_by_meta(postings)) 39 | assert len(result) == 1 40 | assert len(result[0]) == 2 41 | 42 | 43 | if __name__ == '__main__': 44 | unittest.main() 45 | -------------------------------------------------------------------------------- /testdata/source/generic_importer/test_training_examples/training_examples.json: -------------------------------------------------------------------------------- 1 | [ 2 | [ 3 | { 4 | "amount": "-1 USD", 5 | "date": "2020-01-01", 6 | "key_value_pairs": { 7 | "desc": "by debit card-OTHPG 063441 GOOGLE CLOUD INDIA PVTTHANE-" 8 | }, 9 | "source_account": "Assets:Bank" 10 | }, 11 | "Expenses:Misc" 12 | ], 13 | [ 14 | { 15 | "amount": "-1 USD", 16 | "date": "2020-01-01", 17 | "key_value_pairs": { 18 | "desc": "by debit card-OTHPG 063444 GOOGLE CLOUD INDIA PVTTHANE-" 19 | }, 20 | "source_account": "Assets:Bank" 21 | }, 22 | "Expenses:Misc" 23 | ], 24 | [ 25 | { 26 | "amount": "1 USD", 27 | "date": "2020-01-02", 28 | "key_value_pairs": { 29 | "desc": "BULK POSTING- 00000008237 250120 GOOGLE CLOUD INDIA PVT-" 30 | }, 31 | "source_account": "Assets:Bank" 32 | }, 33 | "Expenses:Misc" 34 | ], 35 | [ 36 | { 37 | "amount": "1 USD", 38 | "date": "2020-01-02", 39 | "key_value_pairs": { 40 | "desc": "BULK POSTING- 00000008237 250120 GOOGLE CLOUD INDIA PVT-" 41 | }, 42 | "source_account": "Assets:Bank" 43 | }, 44 | "Expenses:Misc" 45 | ], 46 | [ 47 | { 48 | "amount": "500 USD", 49 | "date": "2020-01-02", 50 | "key_value_pairs": { 51 | "desc": "ATM-WD Some Random ATM Machine" 52 | }, 53 | "source_account": "Assets:Bank" 54 | }, 55 | "Assets:Cash" 56 | ], 57 | [ 58 | { 59 | "amount": "300 USD", 60 | "date": "2020-01-05", 61 | "key_value_pairs": { 62 | "desc": "Transfer to 1234567890123" 63 | }, 64 | "source_account": "Assets:Bank" 65 | }, 66 | "Liabilities:JohnDoe" 67 | ] 68 | ] -------------------------------------------------------------------------------- /testdata/source/ultipro_google/test_basic/20210108-1.txt: -------------------------------------------------------------------------------- 1 | Google LLC 2 | 1600 Amphitheatre Parkway 3 | Mountain View, CA 94043 4 | 650-253-0000 5 | Pay Statement 6 | Period Start Date 12/21/2020 7 | Period End Date 01/03/2021 8 | Pay Date 01/08/2021 9 | Document 98765432 10 | Net Pay $600.00 11 | Pay Details 12 | Bean Counter 13 | 123 Import St 14 | New York, NY 10001 15 | USA 16 | Employee Number 000123456 17 | SSN XXX-XX-XXXX 18 | Job Accountant 19 | Pay Rate $100.0000 20 | Pay Frequency Biweekly 21 | Pay Group Salaried Employees 22 | Location US-NYC-NYC 23 | Cost Center 111 - Finance - Accounting 24 | Earnings 25 | Pay Type Hours Pay Rate Current YTD 26 | Dom Part $50.00 $100.00 27 | Regular Pay 8.0000 $100.0000 $800.00 28 | Regular Pay 72.0000 $100.0000 $7,200.00 $16,000.00 29 | Total Hours Worked 80.0000 Total Hours 80.0000 30 | Deductions 31 | Employee Employer 32 | Deduction Based On Pre-Tax Current YTD Current YTD 33 | 401K Pretax $8,000.00 Yes $6,000.00 $12,000.00 $3,000.00 $6,000.00 34 | Dental $1.11 Yes $1.11 $2.22 $0.00 $0.00 35 | Dmstc Part - NR $50.00 No $50.00 $100.00 $0.00 $0.00 36 | Medical $2.22 Yes $2.22 $4.44 $0.00 $0.00 37 | Vision $3.33 Yes $3.33 $6.66 $0.00 $0.00 38 | Taxes 39 | Tax Based On Current YTD 40 | Federal Income Tax $2,000.00 $200.00 $400.00 41 | Employee Medicare $8,000.00 $50.00 $100.00 42 | Social Security Employee Tax $8,000.00 $50.00 $150.00 43 | NY State Income Tax $3,000.00 $100.00 $100.00 44 | Paid Time Off 45 | Plan Current Balance 46 | Vacation 0.0000 0.0000 47 | Net Pay Distribution 48 | Account Number Account Type Amount 49 | xxxxxxxx1234 Checking $600.00 50 | Total $600.00 51 | Pay Summary 52 | Gross FIT Taxable Wages Taxes Deductions Net Pay 53 | Current $8,050.00 $2,000.00 $400.00 $6,056.66 $600.00 54 | YTD $16,000 $4,000.00 $800.00 $9,000.00 $1200.00 55 | 56 | -------------------------------------------------------------------------------- /testdata/source/amazon/de_DE/256-0244967-2403944.json: -------------------------------------------------------------------------------- 1 | { 2 | "order_id": "256-0244967-2403944", 3 | "order_date": "2021-09-27", 4 | "shipments": [ 5 | { 6 | "shipped_date": "2021-09-28", 7 | "items": [ 8 | { 9 | "quantity": "1", 10 | "description": "FC Bayern M\u00fcnchen Cuddly fleece blanket 150 x 200 cm", 11 | "sold_by": "Offizieller FC Bayern Store", 12 | "condition": "Neu", 13 | "price": { 14 | "number": "23.96", 15 | "currency": "EUR" 16 | } 17 | } 18 | ], 19 | "items_subtotal": null, 20 | "pretax_adjustments": [], 21 | "total_before_tax": { 22 | "number": "23.96", 23 | "currency": "EUR" 24 | }, 25 | "posttax_adjustments": [], 26 | "tax": [], 27 | "total": { 28 | "number": "23.96", 29 | "currency": "EUR" 30 | }, 31 | "errors": [] 32 | } 33 | ], 34 | "credit_card_transactions": [ 35 | { 36 | "date": "2021-09-28", 37 | "card_description": "Visa", 38 | "card_ending_in": "1234", 39 | "amount": { 40 | "number": "23.96", 41 | "currency": "EUR" 42 | } 43 | } 44 | ], 45 | "pretax_adjustments": [ 46 | { 47 | "description": "Verpackung & Versand", 48 | "amount": { 49 | "number": "0.00", 50 | "currency": "EUR" 51 | } 52 | } 53 | ], 54 | "tax": null, 55 | "posttax_adjustments": [], 56 | "errors": [] 57 | } -------------------------------------------------------------------------------- /testdata/source/paypal/266LYBQVWC7P8PXV0.json: -------------------------------------------------------------------------------- 1 | { 2 | "fundingSource": { 3 | "fundingSourceList": [ 4 | { 5 | "type": "BANK_ACCOUNT", 6 | "last4": "1234", 7 | "institution": "My Bank", 8 | "amount": "$70.00", 9 | "currencyCode": "USD" 10 | } 11 | ] 12 | }, 13 | "fptiTag": "trans2bank", 14 | "counterparty": { 15 | "detailsCounterpartyText": "Bank Account", 16 | "name": "Bank Account", 17 | "url": "", 18 | "isBusiness": true 19 | }, 20 | "links": { 21 | "reportDispute": { 22 | "target": "_blank", 23 | "linkUrl": "/cgi-bin/webscr?cmd=_comres_flow&trans_id=266LYBQVWC7P8PXV0&select_dispute_type=1" 24 | } 25 | }, 26 | "paidWithHeader": "Paid with", 27 | "showClassicDetails": false, 28 | "viewContext": "activity", 29 | "displayStatus": "", 30 | "transactionTypeEnum": "TRANSFER_TO_BANK", 31 | "transactionType": "Transfer to Bank", 32 | "txnTypeServiceKey": "MONEY_TRANSFER", 33 | "status": "COMPLETED", 34 | "date": "September 9, 2014", 35 | "creationTimeBucket": "MoreThan3Months", 36 | "updateTimeBucket": "MoreThan3Months", 37 | "isCredit": false, 38 | "isBuyer": true, 39 | "isSeller": false, 40 | "transactionId": "266LYBQVWC7P8PXV0", 41 | "amount": { 42 | "grossAmount": "$70.00", 43 | "netAmount": "$70.00", 44 | "fullPageNetAmount": "$70.00", 45 | "feeAmount": "$0.00", 46 | "grossExceedsNet": false, 47 | "isZeroFee": true, 48 | "feeLabel": "Fee" 49 | }, 50 | "flags": { 51 | "isWinSMBEligible": true, 52 | "hasActions": true, 53 | "isWithdrawToBank": true, 54 | "isBalanceTransfer": true 55 | }, 56 | "printDetailsLink": { 57 | "linkUrl": "/myaccount/transactions/print-details/266LYBQVWC7P8PXV0", 58 | "target": "_blank" 59 | }, 60 | "partner": {} 61 | } 62 | -------------------------------------------------------------------------------- /beancount_import/unbook.py: -------------------------------------------------------------------------------- 1 | """Facilities for reversing the booking process to recover the original posting.""" 2 | 3 | from typing import Iterable, List, Optional 4 | from beancount.core.data import Posting, CostSpec, Meta, Amount 5 | from beancount.core.number import ZERO, MISSING 6 | 7 | def group_postings_by_meta(postings: Iterable[Posting]) -> Iterable[List[Posting]]: 8 | """Groups postings that have identical, non-None meta values together OR where 9 | merge: TRUE is set in metadata for the posting. 10 | 11 | This is intended to group together multiple postings generated by the 12 | booking procedure that correspond to a single original posting. 13 | """ 14 | prev_meta = None # type: Optional[Meta] 15 | posting_list = [] 16 | for posting in postings: 17 | if posting.meta is not None and (posting.meta is prev_meta or 18 | posting.meta.get("merge")): 19 | posting_list.append(posting) 20 | continue 21 | if posting_list: 22 | yield posting_list 23 | prev_meta = posting.meta 24 | posting_list = [posting] 25 | if posting_list: 26 | yield posting_list 27 | 28 | 29 | def unbook_postings(postings: List[Posting]) -> Posting: 30 | """Unbooks a list of postings back into a single posting. 31 | 32 | The combined units are computed, the cost and price are left unspecified. 33 | """ 34 | if len(postings) == 1: 35 | return postings[0] 36 | number = sum((posting.units.number for posting in postings), ZERO) 37 | return postings[0]._replace( 38 | units=Amount(number=number, currency=postings[0].units.currency), 39 | cost=CostSpec( 40 | number_per=None, 41 | number_total=None, 42 | currency=None, 43 | date=None, 44 | label=None, 45 | merge=None)) 46 | -------------------------------------------------------------------------------- /testdata/source/ofx/suncorp.ofx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 0 8 | INFO 9 | 10 | 20131215 11 | ENG 12 | 13 | SUNCORP 14 | 484-799 15 | 16 | 17 | 18 | 19 | 20 | 1 21 | 22 | 0 23 | INFO 24 | 25 | 26 | AUD 27 | 28 | SUNCORP 29 | 123456789 30 | CHECKING 31 | 32 | 33 | 20130618 34 | 20131215 35 | 36 | DEBIT 37 | 20131215 38 | -16.85 39 | 1 40 | 0 41 | 42 | 43 | 44 | 45 | 46 | 1234.12 47 | 20131215 48 | 49 | 50 | 1234.12 51 | 20131215 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /testdata/source/amazon/de_DE/142-4912939-2196263.json: -------------------------------------------------------------------------------- 1 | { 2 | "order_id": "142-4912939-2196263", 3 | "order_date": "2022-02-19", 4 | "shipments": [ 5 | { 6 | "shipped_date": null, 7 | "items": [ 8 | { 9 | "quantity": "1", 10 | "description": "CS Labs W\u00e4rmeleitpaste & Pad Ersatz-Set, K5-PRO K4-PRO kompatibel mit iPhone, Mac PS4 PS3 Xbox Asus Dell usw.", 11 | "sold_by": "WWW.COMPUTER-SYSTEMS.GR", 12 | "condition": "Neu", 13 | "price": { 14 | "number": "15.99", 15 | "currency": "EUR" 16 | } 17 | } 18 | ], 19 | "items_subtotal": null, 20 | "pretax_adjustments": [], 21 | "total_before_tax": { 22 | "number": "15.99", 23 | "currency": "EUR" 24 | }, 25 | "posttax_adjustments": [], 26 | "tax": [], 27 | "total": { 28 | "number": "15.99", 29 | "currency": "EUR" 30 | }, 31 | "errors": [] 32 | } 33 | ], 34 | "credit_card_transactions": [ 35 | { 36 | "date": "2022-02-19", 37 | "card_description": "Bankeinzug", 38 | "card_ending_in": "600", 39 | "amount": { 40 | "number": "15.99", 41 | "currency": "EUR" 42 | } 43 | } 44 | ], 45 | "pretax_adjustments": [ 46 | { 47 | "description": "Verpackung & Versand", 48 | "amount": { 49 | "number": "0.00", 50 | "currency": "EUR" 51 | } 52 | } 53 | ], 54 | "tax": null, 55 | "posttax_adjustments": [], 56 | "errors": [] 57 | } -------------------------------------------------------------------------------- /testdata/source/amazon/de_DE/588-8509154-9761865.json: -------------------------------------------------------------------------------- 1 | { 2 | "order_id": "588-8509154-9761865", 3 | "order_date": "2022-02-19", 4 | "shipments": [ 5 | { 6 | "shipped_date": null, 7 | "items": [ 8 | { 9 | "quantity": "1", 10 | "description": "CS Labs W\u00e4rmeleitpaste & Pad Ersatz-Set, K5-PRO K4-PRO kompatibel mit iPhone, Mac PS4 PS3 Xbox Asus Dell usw.", 11 | "sold_by": "WWW.COMPUTER-SYSTEMS.GR", 12 | "condition": "Neu", 13 | "price": { 14 | "number": "15.99", 15 | "currency": "EUR" 16 | } 17 | } 18 | ], 19 | "items_subtotal": null, 20 | "pretax_adjustments": [], 21 | "total_before_tax": { 22 | "number": "15.99", 23 | "currency": "EUR" 24 | }, 25 | "posttax_adjustments": [], 26 | "tax": [], 27 | "total": { 28 | "number": "15.99", 29 | "currency": "EUR" 30 | }, 31 | "errors": [] 32 | } 33 | ], 34 | "credit_card_transactions": [ 35 | { 36 | "date": "2022-02-19", 37 | "card_description": "Bankeinzug", 38 | "card_ending_in": "600", 39 | "amount": { 40 | "number": "15.99", 41 | "currency": "EUR" 42 | } 43 | } 44 | ], 45 | "pretax_adjustments": [ 46 | { 47 | "description": "Verpackung & Versand", 48 | "amount": { 49 | "number": "0.00", 50 | "currency": "EUR" 51 | } 52 | } 53 | ], 54 | "tax": null, 55 | "posttax_adjustments": [], 56 | "errors": [] 57 | } -------------------------------------------------------------------------------- /testdata/source/ofx/multiple_accounts.ofx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 0 8 | INFO 9 | The operation succeeded. 10 | 11 | 20120603203135.547[-7:PDT] 12 | ENG 13 | 14 | blah 15 | 1000 16 | 17 | 18 | 19 | 20 | 21 | 1001 22 | 23 | 0 24 | INFO 25 | 26 | 27 | USD 28 | 29 | 123 30 | 00 31 | 9100 32 | CHECKING 33 | 34 | 35 | 111 36 | 20120603133220.000[-7:PDT] 37 | 38 | 39 | 40 | 41 | 1002 42 | 43 | 0 44 | INFO 45 | 46 | 47 | USD 48 | 49 | 123 50 | 00 51 | 9200 52 | SAVINGS 53 | 54 | 55 | 222 56 | 20120603133220.000[-7:PDT] 57 | 58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /testdata/source/ofx/test_vanguard_xfer_in/import_results.beancount: -------------------------------------------------------------------------------- 1 | ;; date: 2022-01-24 2 | ;; info: {"filename": "/vanguard_xfer_in.ofx", "type": "application/x-ofx"} 3 | 4 | ; features: [ 5 | ; { 6 | ; "amount": "223.828 PRBLX", 7 | ; "date": "2022-01-24", 8 | ; "key_value_pairs": { 9 | ; "desc": "TRANSFER OF ACCOUNTTRANSFER OF ACCOUNT", 10 | ; "ofx_memo": "TRANSFER OF ACCOUNTTRANSFER OF ACCOUNT", 11 | ; "ofx_type": "TRANSFER" 12 | ; }, 13 | ; "source_account": "Assets:Investment:Vanguard:PRBLX" 14 | ; } 15 | ; ] 16 | 2022-01-24 * "TRANSFER - TRANSFER OF ACCOUNTTRANSFER OF ACCOUNT" 17 | Assets:Investment:Vanguard:PRBLX 223.828 PRBLX {1 USD, "FIXME"} 18 | date: 2022-01-24 19 | ofx_fitid: "987654321" 20 | ofx_memo: "TRANSFER OF ACCOUNTTRANSFER OF ACCOUNT" 21 | ofx_type: "TRANSFER" 22 | Expenses:FIXME 23 | 24 | ;; date: 2022-01-24 25 | ;; info: {"filename": "/vanguard_xfer_in.ofx", "type": "application/x-ofx"} 26 | 27 | ; features: [ 28 | ; { 29 | ; "amount": "612.584 PARMX", 30 | ; "date": "2022-01-24", 31 | ; "key_value_pairs": { 32 | ; "desc": "TRANSFER OF ACCOUNTTRANSFER OF ACCOUNT", 33 | ; "ofx_memo": "TRANSFER OF ACCOUNTTRANSFER OF ACCOUNT", 34 | ; "ofx_type": "TRANSFER" 35 | ; }, 36 | ; "source_account": "Assets:Investment:Vanguard:PARMX" 37 | ; } 38 | ; ] 39 | 2022-01-24 * "TRANSFER - TRANSFER OF ACCOUNTTRANSFER OF ACCOUNT" 40 | Assets:Investment:Vanguard:PARMX 612.584 PARMX {1 USD, "FIXME"} 41 | date: 2022-01-24 42 | ofx_fitid: "123456789" 43 | ofx_memo: "TRANSFER OF ACCOUNTTRANSFER OF ACCOUNT" 44 | ofx_type: "TRANSFER" 45 | Expenses:FIXME 46 | --------------------------------------------------------------------------------