# Beancount advancement Thread

**URL:** https://forum.mustachianpost.com/t/beancount-advancement-thread/2786
**Category:** Life Hacking
**Created:** [November 20, 2019, 11:35am UTC](https://forum.mustachianpost.com/t/beancount-advancement-thread/2786 "2019-11-20T11:35:13Z")
**Posts on this page:** 20
**Page:** 9

<div class="post-metadata">

### Author: ![Beisat](https://forum.mustachianpost.com/letter_avatar_proxy/v4/letter/b/a88e4f/32.png) [@Beisat](https://forum.mustachianpost.com/u/Beisat)
#### Post date: [September 5, 2020, 12:28pm UTC](https://forum.mustachianpost.com/t/beancount-advancement-thread/2786/164 "2020-09-05T12:28:03Z")

</div>

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. 😳

---

<div class="post-metadata">

### Author: ![nugget](https://forum.mustachianpost.com/user_avatar/forum.mustachianpost.com/nugget/32/57_2.png) [@nugget](https://forum.mustachianpost.com/u/nugget)
#### Post date: [September 5, 2020, 2:03pm UTC](https://forum.mustachianpost.com/t/beancount-advancement-thread/2786/165 "2020-09-05T14:03:32Z")

</div>

> [@Beisat](#):
>
> Can I somehow have it refactor the file so it fits the suggested indentation perfectly?

yes! there is a vscode plugin [Beancount Formatter - Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=dongfg.vscode-beancount-formatter) and the hotkey is discribed on the front page 🙂

btw my commodities.bean starts with

```auto
; 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:

```auto
#!/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 🙂

---

<div class="post-metadata">

### Author: ![nugget](https://forum.mustachianpost.com/user_avatar/forum.mustachianpost.com/nugget/32/57_2.png) [@nugget](https://forum.mustachianpost.com/u/nugget)
#### Post date: [September 5, 2020, 2:42pm UTC](https://forum.mustachianpost.com/t/beancount-advancement-thread/2786/167 "2020-09-05T14:42:10Z")

</div>

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^^

---

<div class="post-metadata">

### Author: ![Beisat](https://forum.mustachianpost.com/letter_avatar_proxy/v4/letter/b/a88e4f/32.png) [@Beisat](https://forum.mustachianpost.com/u/Beisat)
#### Post date: [September 5, 2020, 4:52pm UTC](https://forum.mustachianpost.com/t/beancount-advancement-thread/2786/168 "2020-09-05T16:52:22Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![MrCheese](https://forum.mustachianpost.com/user_avatar/forum.mustachianpost.com/mrcheese/32/2500_2.png) [@MrCheese](https://forum.mustachianpost.com/u/MrCheese)
#### Post date: [September 5, 2020, 5:00pm UTC](https://forum.mustachianpost.com/t/beancount-advancement-thread/2786/169 "2020-09-05T17:00:45Z")

</div>

> [@Beisat](#):
>
> Expenses:Taxes:Canton:Income:2018  
> Expenses:Taxes:Canton:Income:2019  
> Expenses:Taxes:Federal:Income:2018

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.

---

<div class="post-metadata">

### Author: ![nugget](https://forum.mustachianpost.com/user_avatar/forum.mustachianpost.com/nugget/32/57_2.png) [@nugget](https://forum.mustachianpost.com/u/nugget)
#### Post date: [September 5, 2020, 5:02pm UTC](https://forum.mustachianpost.com/t/beancount-advancement-thread/2786/170 "2020-09-05T17:02:01Z")

</div>

> [@Beisat](#):
>
> But how do you go for expense accounts? Currently, I made a very detailed hierarchy, e.g.

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

 ![image](https://forum.mustachianpost.com/uploads/default/original/2X/0/037d6c873ecc079739de76aadf8c29a9f306ac92.png)

> [@Beisat](#):
>
> expenses treemap chart, this looks horrible.

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](https://forum.mustachianpost.com/uploads/default/original/2X/c/cffd93c2c996369f0e4a969c9e89e083a93a08b2.png)  
If I was taxed normally, I’d probably have something like

```auto
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.

---

<div class="post-metadata">

### Author: ![Beisat](https://forum.mustachianpost.com/letter_avatar_proxy/v4/letter/b/a88e4f/32.png) [@Beisat](https://forum.mustachianpost.com/u/Beisat)
#### Post date: [September 5, 2020, 5:23pm UTC](https://forum.mustachianpost.com/t/beancount-advancement-thread/2786/171 "2020-09-05T17:23:56Z")

</div>

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.

> [@nugget](#):
>
> I would not include years into the account structure, simply because fava (and beancount) provide simple binning functionality
> 
> ![image](https://forum.mustachianpost.com/uploads/default/original/2X/0/037d6c873ecc079739de76aadf8c29a9f306ac92.png)

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.

> [@](#):
>
> 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.

Care to eloborate more? I would be interested.

---

<div class="post-metadata">

### Author: ![nugget](https://forum.mustachianpost.com/user_avatar/forum.mustachianpost.com/nugget/32/57_2.png) [@nugget](https://forum.mustachianpost.com/u/nugget)
#### Post date: [September 5, 2020, 6:01pm UTC](https://forum.mustachianpost.com/t/beancount-advancement-thread/2786/172 "2020-09-05T18:01:41Z")

</div>

### wrong year

> [@Beisat](#):
>
> Careful, the year you pay taxes is not the actual tax 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:

```auto
; 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:

```auto
; 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?^^

---

<div class="post-metadata">

### Author: ![Beisat](https://forum.mustachianpost.com/letter_avatar_proxy/v4/letter/b/a88e4f/32.png) [@Beisat](https://forum.mustachianpost.com/u/Beisat)
#### Post date: [September 5, 2020, 7:03pm UTC](https://forum.mustachianpost.com/t/beancount-advancement-thread/2786/173 "2020-09-05T19:03:20Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![CryingSofa](https://forum.mustachianpost.com/user_avatar/forum.mustachianpost.com/cryingsofa/32/2498_2.png) [@CryingSofa](https://forum.mustachianpost.com/u/CryingSofa)
#### Post date: [September 7, 2020, 4:59pm UTC](https://forum.mustachianpost.com/t/beancount-advancement-thread/2786/174 "2020-09-07T16:59:45Z")

</div>

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](https://www.ledger-cli.org/3.0/doc/ledger3.html#Balance-Report) with bean-report? I’m especially talking about the totals of all the subaccounts.

---

<div class="post-metadata">

### Author: ![nugget](https://forum.mustachianpost.com/user_avatar/forum.mustachianpost.com/nugget/32/57_2.png) [@nugget](https://forum.mustachianpost.com/u/nugget)
#### Post date: [September 7, 2020, 5:19pm UTC](https://forum.mustachianpost.com/t/beancount-advancement-thread/2786/175 "2020-09-07T17:19:53Z")

</div>

try somethign like

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

```

taken from  
[https://beancount.github.io/docs/running\_beancount\_and\_generating\_reports.html#bean-report](https://beancount.github.io/docs/running_beancount_and_generating_reports.html#bean-report) or  
[https://beancount.github.io/docs/tutorial\_example.html#generating-reports](https://beancount.github.io/docs/tutorial_example.html#generating-reports)

---

<div class="post-metadata">

### Author: ![CryingSofa](https://forum.mustachianpost.com/user_avatar/forum.mustachianpost.com/cryingsofa/32/2498_2.png) [@CryingSofa](https://forum.mustachianpost.com/u/CryingSofa)
#### Post date: [September 7, 2020, 5:39pm UTC](https://forum.mustachianpost.com/t/beancount-advancement-thread/2786/176 "2020-09-07T17:39:20Z")

</div>

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

```auto
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`

---

<div class="post-metadata">

### Author: ![MrCheese](https://forum.mustachianpost.com/user_avatar/forum.mustachianpost.com/mrcheese/32/2500_2.png) [@MrCheese](https://forum.mustachianpost.com/u/MrCheese)
#### Post date: [September 7, 2020, 8:49pm UTC](https://forum.mustachianpost.com/t/beancount-advancement-thread/2786/177 "2020-09-07T20:49:46Z")

</div>

Just use fava instead?

---

<div class="post-metadata">

### Author: ![CryingSofa](https://forum.mustachianpost.com/user_avatar/forum.mustachianpost.com/cryingsofa/32/2498_2.png) [@CryingSofa](https://forum.mustachianpost.com/u/CryingSofa)
#### Post date: [September 7, 2020, 9:05pm UTC](https://forum.mustachianpost.com/t/beancount-advancement-thread/2786/178 "2020-09-07T21:05:15Z")

</div>

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… 😉

---

<div class="post-metadata">

### Author: ![MrCheese](https://forum.mustachianpost.com/user_avatar/forum.mustachianpost.com/mrcheese/32/2500_2.png) [@MrCheese](https://forum.mustachianpost.com/u/MrCheese)
#### Post date: [September 7, 2020, 9:31pm UTC](https://forum.mustachianpost.com/t/beancount-advancement-thread/2786/179 "2020-09-07T21:31:58Z")

</div>

> [@CryingSofa](#):
>
> Before you ask: No, I’m not that fun to be around at parties… 😉

Exactly my cup of tea

---

<div class="post-metadata">

### Author: ![tarioch](https://forum.mustachianpost.com/letter_avatar_proxy/v4/letter/t/22d042/32.png) [@tarioch](https://forum.mustachianpost.com/u/tarioch)
#### Post date: [September 8, 2020, 4:54am UTC](https://forum.mustachianpost.com/t/beancount-advancement-thread/2786/180 "2020-09-08T04:54:09Z")

</div>

You might want to look at bean-query

[https://beancount.github.io/docs/beancount\_query\_language.html](https://beancount.github.io/docs/beancount_query_language.html)

---

<div class="post-metadata">

### Author: ![Beisat](https://forum.mustachianpost.com/letter_avatar_proxy/v4/letter/b/a88e4f/32.png) [@Beisat](https://forum.mustachianpost.com/u/Beisat)
#### Post date: [September 8, 2020, 6:09pm UTC](https://forum.mustachianpost.com/t/beancount-advancement-thread/2786/181 "2020-09-08T18:09:27Z")

</div>

@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…

---

<div class="post-metadata">

### Author: ![tarioch](https://forum.mustachianpost.com/letter_avatar_proxy/v4/letter/t/22d042/32.png) [@tarioch](https://forum.mustachianpost.com/u/tarioch)
#### Post date: [September 8, 2020, 7:05pm UTC](https://forum.mustachianpost.com/t/beancount-advancement-thread/2786/182 "2020-09-08T19:05:41Z")

</div>

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.

```auto
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.

---

<div class="post-metadata">

### Author: ![nugget](https://forum.mustachianpost.com/user_avatar/forum.mustachianpost.com/nugget/32/57_2.png) [@nugget](https://forum.mustachianpost.com/u/nugget)
#### Post date: [September 8, 2020, 7:20pm UTC](https://forum.mustachianpost.com/t/beancount-advancement-thread/2786/183 "2020-09-08T19:20:29Z")

</div>

> [@Beisat](#):
>
> Did you ever figure out a good way to handle things like VIAC / Fund of Funds you mentioned in the first post?

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.

---

<div class="post-metadata">

### Author: ![Beisat](https://forum.mustachianpost.com/letter_avatar_proxy/v4/letter/b/a88e4f/32.png) [@Beisat](https://forum.mustachianpost.com/u/Beisat)
#### Post date: [September 8, 2020, 7:28pm UTC](https://forum.mustachianpost.com/t/beancount-advancement-thread/2786/184 "2020-09-08T19:28:42Z")

</div>

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

[Previous page](https://forum.mustachianpost.com/t/beancount-advancement-thread/2786.md?page=8)

[Next page](https://forum.mustachianpost.com/t/beancount-advancement-thread/2786.md?page=10)
