33
loading...
This website collects cookies to deliver better user experience
2021-01-01 * "AMAZON.DE"
Assets:MyBank -42.00 EUR
Expenses:Amazon 42.00 EUR
Assets:MyBank
) and added to an Amazon expense account.pip install beancount
.option "title" "Alice"
option "operating_currency" "EUR"
; Accounts
2021-01-01 open Assets:MyBank:Checking
2021-01-01 open Expenses:Rent
2021-01-01 * "Landlord" "Thanks for the rent"
Assets:MyBank:Checking -1000.00 EUR
Expenses:Rent 1000.00 EUR
.beancount
file contains close to 21,000 lines.~/Work/finances main ❯ wc -l goel.beancount
20996 goel.beancount
.beancount
file. This file acts as the single source of truth for all your financial data from all your banks.Importer
classes shipped with Beancount are more like protocols. The base class is literally called ImporterProtocol
. They define method signatures and leave the implementation up to you. This way, you can inherit the base ImporterProtocol
class for your own importer, override the relevant methods, and let Beancount know of the existence of these importer classes using a configuration file.from beancount.ingest.importer import ImporterProtocol
def convert_to_beancount_data_structs(line):
"""
Implement me!
"""
class MyBankImporter(ImporterProtocol):
def extract(self, file):
"""
Read and parse the file and convert the original data into Beancount
data structures
"""
entries = []
for line in file:
entries.append(convert_to_beancount_data_structs(line))
return entries
.beancount
file, and "balance" transactions.2021-01-01 * "Landlord" "Thanks for the rent"
Assets:MyBank:Checking -1000.00 EUR
Expenses:Rent
account.2021-01-01 * "Landlord" "Thanks for the rent"
Assets:MyBank:Checking -1000.00 EUR
Expenses:Rent 1000.00 EUR
.beancount
data contains all your financial transactions and is in good shape.bean-query
and Fava.bean-query
is a command line utility shipped with Beancount that lets you run SQL-ish queries on your financial data. The query language is specific to Beancount. But if you're familiar with SQL, you'll feel right at home with bean-query
.beancount> SELECT \
year, SUM(number) AS total \
WHERE account ~ 'Expenses:PublicTransport' AND year >= 2019 \
GROUP BY year;
year total
---- ------
2019 672.60
2020 328.02
2021 30.50
.beancount
file and provides all sorts of visualizations you'll find useful.bean-query
, I use Fava the most. I feel that the visualizations provided by Fava give me a really good sense of almost all the financial insights I'm looking for.