Beancount advancement Thread

Sorry, still have not gotten that working yet.

Simplest form, I add:

include "prices.bean"

and inside that file I add

2020-09-05 price EUR 1.0694 CHF

correct?

Currently, that is the total content of my prices.bean. Nevertheless, no value in CHF shows in fava for Assets:Revolut:EUR. The commodity is defined:

2020-01-01 commodity EUR
name: “Euro”
asset-class: “cash”

Thanks!

Edit: Nevermind! I must change “at cost” to “convert to CHF” on the top right dropdown. :flushed:

1 Like

yes! there is a vscode plugin Beancount Formatter - Visual Studio Marketplace and the hotkey is discribed on the front page :slight_smile:

btw my commodities.bean starts with

; Stocks / ETFS

1970-01-01 commodity CHF
	name: "Swiss Franc"
	asset-class: "cash"
  
1970-01-01 commodity USD
	name: "US Dollar"
	asset-class: "cash"
  price: "CHF:yahoo/^CHFUSD=X"

1970-01-01 commodity EUR
	name: "Euro"
	asset-class: "cash"
  price: "CHF:yahoo/^CHFEUR=X"

1970-01-01 commodity VTI
	name: "VTI"
	asset-class: "stock"
	price: "USD:yahoo/VTI"

together with my main.bean, i can use the following script to fetch historic prices, in this example on a weekly basis:

#!/bin/bash
echo "my stock price fetching script"

datestart="2020-01-11"
dateend="2020-04-01"

date1="$datestart"
while [[ "$date1" < "$dateend" ]]; do
   date1="$(date -u --date="$date1 +1 week" '+%Y-%m-%d')"
   echo "$date1"
   
   bean-price main.bean --date "$date1" -i >> price.bean
   sleep 2
done

mind the sleep time to make yahoo not block you :slight_smile:

1 Like

Now my question!
is there a way to generate a folder tree according to the accounts tree? I start using the document directive, and I am too lazy to make the folder structure each time I attach a file to a new account^^

Thanks for the help so far. I know above in the thread the structure of assets/liabilities/expenses/income has already been discussed a bit, but I am still in doubt about my setup:

I went so far in a style the manual suggested, e.g. Assets:Revolut:EUR. I saw above people suggesting to add liquidity before, that could make sense I think.

But how do you go for expense accounts? Currently, I made a very detailed hierarchy, e.g.

Expenses:Taxes:Canton:Income:2018
Expenses:Taxes:Canton:Income:2019
Expenses:Taxes:Federal:Income:2018

etc.
But for fava, especially on the income statement → expenses treemap chart, this looks horrible. I have big coloured squares labeled as 2018/2019 and 2018 in a different colour again for federal. On the other hand, the actual table below looks really nice, summing up with lots of details.

Should I be simplyfing this to example

Expenses:Taxes

and using hashtags instead? Is there even a chart which takes the hashtags into consideration? Happy for any thoughts or inputs.

How about restructuring them to:
Expenses:Taxes:2018:Income:Canton
Expenses:Taxes:2019:Income:Canton
Expenses:Taxes:2018:Income:Federal

I personally only have one Expenses:Taxes account, but the detail level is up to each users likeing.

1 Like

I would not include years into the account structure, simply because fava (and beancount) provide simple binning functionality
image

hm i do not know how to tweak this other than get a “good” account tree.
As an example, for me it looks like
image
If I was taxed normally, I’d probably have something like

Expenses:Labortaxes:Federal
Expenses:Labortaxes:Canton
Expenses:Labortaxes:Municipality

I would not use Hashtags. As a matter of fact, I just removed all hashtags from my ledger becaused i solved theit usecase in a better way.

1 Like

Thanks for the examples. I will play around a bit with it in that case, seems that the core concept is correct which I followed.

Careful, the year you pay taxes is not the actual tax year, that is why I do it. In fact, it can spread over multiple years with expenses and income.

Care to eloborate more? I would be interested.

wrong year

indeed! i did not reflect that. In this case, I would (I seriously do this with other stuff) use Liabilities and Provisions accounts to separate the date of payment from the date of due/ consumption. Here an example for the calendar year 2016:

; It is now 2016, you factually owe taxes but the bill will only come in two years or so

2016-01-01 * "Switzerland" "Taxes 2016"
  Expenses:Taxes                             1.00 CHF  
  Liabilities:Taxes                         -1.00 CHF ; we pay not with cash but with a liability
  Assets:Bank:GiroAccount:Checkings         -1.00 CHF ; at the same time we build up provisions so we guarantee to have the cash at hand once the bill arrives
  Assets:Bank:GiroAccount:Provisions:Taxes   1.00 CHF

You would use your best guess for the amount, for example based on the last tax bill and a forecast to the best of your knowledge. Note that with the above transaction your net worth decreases by the anticipated amount, but your Bank account sees no physical transaction.

Now fast forward 2 years, the bill finally arrives. You would then do the following:

; omg no, finally they issue me the correct bill! I have to pay!

2018-05-06 * "Switzerland" "Taxes 2016"
  Liabilities:Taxes                          1.00 CHF ; we pay the liabilities with the provisions made 2 years back
  Assets:Bank:GiroAccount:Provisions:Taxes  -1.00 CHF

Note that this transaction does not affect your Net worth, but your bank account sees the tax payment
I did not think about things like renovation costs that can be deducted over multiple years.

hastags

ok maybe i was abit quick here. The Hashtags are like strings from the data perspective. that means two things that mean the same can be different. This is an issue if you at a later stage want to aggrgate over hashtags.

My (so far only) use case was to tag expenses for on public transport accounts to the according activity, i.e. “#work” or “#hobbies”. I now fixed that by making sub-accounts of my public transport account. Hence I don’t know what i should use the hashtags for. any idea?^^

2 Likes

I would use them if, for example, you want to tag every payment you made for summer holidays 2020. E.g. Your train to the airport stays transport:hobbies, but by adding #vacation 2020 you can then view the total you spent in that trip.

1 Like

After playing around with ledger for a bit I’m now trying beancount. Does anyone know how I can generate a balance sheet like the one from ledger with bean-report? I’m especially talking about the totals of all the subaccounts.

try somethign like

bean-report /path/to/my/file.beancount balances

taken from
https://beancount.github.io/docs/running_beancount_and_generating_reports.html#bean-report or
https://beancount.github.io/docs/tutorial_example.html#generating-reports

Yes, balances is a decent start. But I’d like to see totals for every step. Example:

Assets:CheckingAccounts            600CHF
Assets:CheckingAccounts:Raiffeisen 400CHF
Assets:CheckingAccounts:UBS        200CHF

And maybe even the total for everything (Assets - Liabilities) included so I don’t have to pair it with
bean-report file networth

Just use fava instead?

1 Like

I totally get that that’s better looking, but I really like being limited only by input lag and not by having to start Firefox and waiting for MBs of JS to load. And I dislike web apps with a passion. Maybe I’ll go back to ledger.

Before you ask: No, I’m not that fun to be around at parties… :wink:

Exactly my cup of tea

You might want to look at bean-query

https://beancount.github.io/docs/beancount_query_language.html

@nugget Did you ever figure out a good way to handle things like VIAC / Fund of Funds you mentioned in the first post?
E.g. things without tickers and/or consisting of many sub-products. Manually updating the prices.bean of 1 item might be still ok, but even with the tickers you would still need to assign an amount of units per fund your 3a payment splits into.

It’s not even that I must track the performance, I just struggle to add the 3a to my net worth without having to pad it every time…

I actually posted that question on the beancount mailing list some time ago.
There’s a couple of ways you can do it, depending on what exactly you want to track and how often you want to track it.
I decided to keep it simple and do it similar to how I deal with physical assets (house, car, …)
Have an account for the 3a and then do once a year/how often you want update the value by doing bookings against an income acocunt. e.g.

2019-01-05 * "Transfer 3a"
  Assets:MyBank                -6500 CHF
  Assets:Viac

2019-12-31 * "Interest"
  Assets:Viac                    300 CHF
  Income:Interest              

2020-01-05 * "Transfer 3a"
  Assets:MyBank                -6500 CHF
  Assets:Viac

2020-12-31 * "Interest"
  Assets:Viac                   -150 CHF
  Income:Interest              

It’s a little bit of effort, but in the end it gives me the value of the account and the gains on it. This does not differentiate between paper gain and realized gain, but for this it’s good enough for me.

1 Like

no. I thought alot about it. I think there is no way unless they provide detailed account statements info (any transactions, fx conversion,…) like IB does. AFAIK status quo is PDFs with balances only. hence, my solution as of yet is a yearly manual update. If it is worth the effort to you, you can do it monthly. The transfers to viac should pop up on your checkings account.

Thanks, that is probably still much better then padding it every time.

1 Like