tx

Is a shell script that makes use of mostly awk and the aqbanking-cli tools to download all my bank account transactions, store, tag and make them easily filterable.

motivation

I wanted to start to record and analyze my consumer behaviour on a high level and have a practical way of overviewing my finances. My bank (postbank) has a nice but limited online banking interface. The big issue I have with it is that it only shows you transactions of the last 100 days. {INSERT RANT HERE}
Fortunately this bank supports the Homebanking Computer Interface (HBCI) aka FinTS which allowed me to start fetching my bank transfers so I could build my own backlog without the 100 days limitation.

outstanding features

Recurring places where I shop are identified by their transaction purpose fields and tagged accordingly automatically after every download. I do this because purpose fields are mostly to verbose and stuffed with cryptic numbers and misleading information which cannot be filtered and previewed to me in the end. Own tags or labels make this much easier. High level tags are things like "food" or "entertainment" and lower level are the names of the shops or restaurants. Auto tags are managed through the txtags file which has one entry per line.

food|some_string_that_is_matched_in_csv_line
salary|company_account_number
gym|fintess_center_company_name
Manual tagging can be done with the cli for onetime purchases I want to record.
Filtering can be done with regex against every information on a transaction including own tags.

showcase

% tx
...
331    2016/12/03     -230.00  office desk ikea
332    2016/12/05      -50.00  electricity
333    2016/12/06     3261.80  company1 salary
334    2016/12/07      -23.89  shop1 food
335    2016/12/07       -6.14  shop2 food
336    2016/12/08       -6.90  movies entertainment
337    2016/12/12       -6.67  restaurant1 food
338    2016/12/13      -12.71  amazon
                     +6874.07      
Invoking it without arguments will print all transactions with the sum of all values in the last line.

% tx "16/12.*food"
...
334    2016/12/07      -23.89  shop1 food
335    2016/12/07       -6.14  shop2 food
337    2016/12/12       -6.67  restaurant1 food
                       -36.70    
Print all transactions done in december 2016 which are tagged with food.

All options implemented in this script.
p|pull)     pull_tx;;
b|balance)  tail -n1 "$balfile" | cut -f2;;
e|expenses) print_tx "^-" "$2";;
r|revenue)  print_tx "^[0-9]" $2;; 
t|tag)      tag_tx "$@";;
s|show)     sed "$2q;d" "$txfile";;
*)          print_tx "^" "$1";;  
Now I can analyze which month I had the highest expanses.
for i in {01..12};do printf "$i/16 ";tx e | tail -n1;done

conclusion

This tool helps me a lot to make sure I'm not living over my standard and track down financial bottlenecks. To utilize this tool as much as possible I pay with my bank card and not in cash whenever possible. (I spent about 50 euro in cash per quarter). Find the full code of tx here.