Beancount getting started

If you’re familiar with docker, that’s the way I would go. Otherwise maybe the easiest way for s to use wsl.

My seutp is, and i am mosly very happy:

  • WSL Ubuntu 18.04, with a win10 host
  • VScode for text editing & transaction checking. awesome beancount plugin available!
  • miniconda for python encapsulation
  • private github repo for version control & backup
  • git-crypt to encrypt that repo before pushing (once set up it disappears from the typical git workflow)
  • beancount, smart-importer, tariochbctools for revolut importer, fava
  • lots of time to get started, but very satisfied in the end

in the beginning i also tried docker, but it was too much of new stuff at the time. you can read up about it further up in the thread :grin: among others I had the problem of accessing the localhost fava webapp through the docker container shell.

unfortuanately a good tutorial for getting started is not available to my knowledge. there is a section in the documentation, but the author and all the beancount community suffer heavily from the Curse of knowledge

some sources I used:

Beancount - Syntax Cheat Sheet - Google Docs
Beancount - Index - Google Docs
Beancount Google Groups
Awesome Beancount | awesome-beancount
Command-line Accounting in Context — Beancount 2.0b3 documentation
Alex Johnstone - Managing my personal finances with beancount
Vince Cima
Docker Container on Windows host system: how to access mapped ports? - Docker Desktop for Windows - Docker Forums
Browsable & searchable Documentation for Beancount — Beancount 2.0b3 documentation
beancount-import/ofx.py at master · jbms/beancount-import

my tutorial would be: start as simple as possible (bare beancount & fava) and add your taste as you go. don’t try to do everything at once. Read the google doc documentation, but don’t be disappointed if it doesnt help very much when you look for something specific.

In the end I made it and I don’t think in a glorious way xD so any IT-person should be able to do so too. And with me there is one more person willing to answer question :slight_smile:

1 Like

did you by chance copy the wrong text for the config.py?

Thanks for all the details!

I’m trying to migrate my GNUCash file. I had problems with splits and dates but I modified the Python sourcecode and it was okay. Then with accounts with an ampersand, that’s okay too.

Still, it’s a mess. I’m visualizing my beancount result file after all these fixes and there is no order or information. It’s as if everything was wrong. I’m thinking, maybe I should start from scratch in 2021? Manually update both of them for a while to see where I feel better?

@nugget what’s your experience with the migration?

I did the migration as well and it took a bit to clean it up afterwards but was totally worth it, having all the history in there. I also split my stuff into multiple files.

1 Like

i remember it worked, but it was nowhere next to “clean”

i vaguely remembering that i used some gnucash2beancount converter. it was a pain. it required some ancient gnucash format, so i installed some specific version where i then could export my files in a format that the convrter would accept. finally i did end up with a coherent beancount version of my gnucash data.
and as tarioch writes, i had to manually edit quite alot of the entries. partly because i refurbished my account tree and used the opportunity to resolve inconsistencies of my bookkeeping. a good text editor (i used vscode) and regex are your friend here :wink:

but, again as tarioch writes, it was totally worth it from today’s perspective

Would you mind sharing some screenshots? I’m utterly demotivated and almost about to give up.

This is what I see after I fixed all the errors:

Not really useful, huh?

yes, you got the first part of the typical beancount feeling ^^
for me it looks like

Could be related to currencies and missing prices, what prices do you have in your beancount file?

1 Like

First of all, thanks!

I did translate my historical prices from the GNUCash file alright, at least I think so. For example:

2016-12-29 price VTI                                115.75 USD
2016-12-28 price VTI                                115.74 USD
2016-12-27 price VTI                                116.71 USD
2016-12-23 price VTI                                116.42 USD
2016-12-22 price VTI                                116.24 USD

And also currencies:

2020-04-03 price EUR                               1.05555 CHF
2020-04-02 price EUR                               1.05617 CHF
2020-04-01 price EUR                                1.0579 CHF
2020-03-31 price EUR                                  1.06 CHF
2020-03-30 price EUR                                1.0587 CHF

Currently bean-check is throwing some errors on transactions that do not balance in some shares and dividends transactions (not all of them, just a few). For example:

mblt.beancount:36724:   Transaction does not balance: (-12.730 USD)`
           2018-06-21 * "Buy VTI Total Stock Market ETF"
         Assets:Investments:Brokerage-Accounts:TradeDirect:TradeDirect-USD:Vanguard-Total-Stock-Market-ETF-VTI        7.0 VTI @ 143.09 USD
         Assets:Investments:Brokerage-Accounts:TradeDirect:TradeDirect-USD                                      -1014.360 USD
         Expenses:Bank-Service-Charge:Banking-fees                                                                    0.0 CHF

And I also have a problem with easyJet for some reason (so glad I sold that with a profit):

mblt.beancount:378:     syntax error, unexpected COLON, expecting EOL or COMMENT

mblt.beancount:378: Invalid token: ‘easyJet’

The line reads:

2015-12-31 open Income:Dividend-Income:Dividend-Income-GBP:easyJet GBP

Apart from that, no other errors are showing so I’m quite puzzled.

I’d like to thank @nugget also for proposing his help.

Hey Ed,

i think that looks good!

my transactions look like (buy & sell)

2017-08-04 * "VTI" "buy VTI @ 126.94 USD" 
  Assets:Invest:IB:VTI                                  81 VTI { 126.94 USD }  ; buy shares: provide cost "{}"
  Assets:Invest:IB:USD                               -10282.14 USD 
  Assets:Invest:IB:USD                                   -0.28 USD 
  Expenses:Invest:IB:Fees:USD                             0.28 USD

2017-07-27 * "VWRL" "sell VWRL @ 76.28 CHF" 
  Assets:Invest:IB:VWRL                                   -206 VWRL { } @ 76.28 CHF ; sell shares: provide price @ xx.xx USD"
  Assets:Invest:IB:CHF                                15713.68 CHF 
  Income:Invest:IB:VWRL:PnL                                                       ; have a PnL account to balance the transaction on sales
  Assets:Invest:IB:CHF                                  -16.81 CHF 
  Expenses:Invest:IB:Fees:CHF                            16.81 CHF

mind that i have the “cost” { 126.94 USD } on purchase, “price” @ 143.09 USD and a PnL account on sale. That’s a somewhat unintuitive thing of bookkeeping. There is a chapter in the docs about it. Please read it, i would not know how to get it right without understanding what’s written there.
just change thy syntax so it matches mine, and some of your errors will dissipate.

First Character Of Each Account Needs To Be Capitalized

hope this helps abit :slight_smile:

I did not specify an operating currency, that’s why I was seeing nothing.

Also, I had to delete GNUCash’s annual book closings.

Thanks for the CamelCase tip!!

I’ll see how to balance those transactions, it’s not getting translated well.

I will still need some help but this is improving.

Now I’m just losing a lot of money (not right) :rofl:

Thank you, guys!

1 Like

This actually looks good, in beancount, income is negative, expenses positive, so that’s what you want it to look like.

I see. It seems counterintuitive that the net profit is negative even though you are putting some money aside every month

Hello Beancounters, I am considering to start using Beancount myself, it definitely looks cool. So far I have only been tracking “Balance sheets” for all my accounts, but not transactions.

I managed to install everything on Windows using WSL. I was playing with the example file and Fava and I have couple of questions:

  • Since Beancount does not track the prices of my assets automatically, I need to prize them manually. At what frequence do you add these? Daily? Weekly? Monthly? I assume that Beancount will take the last price, so if I want monthly reports, I’d have to add monthly prices of all my assets to the last day of the month.

  • How do you track your savings rate? I wasn’t able to find it in Fava. I assume I could do a custom query, but isn’t there an easier way?

  • How do you track your portfolio allocations (stocks, bonds, cash) and stock allocations (US, EU, …, emerging)?

  • How do you track of other FI metrics? “Months until FI”, “Current FI progress %”, …

Thanks in advance!

  • Prices: I have a cronjob that daily pulls prices from a couple of sources ( alphavantage, exchangeratesapi), see https://github.com/tarioch/beancounttools
  • Allocation: I have meta annotation on my commodities that specify the alloction percentage
  • allocation metrics, savings rate, …: This depends on your needs and programming skills: I created a custom reporting website that uses queries to build all kind of metrics and graphs, but this is very specific to my setup and my needs

Beancount is basically just an “accounting” engine.

1 Like

Hi,

The setup for automatic prices is easy. You can do a cron work every day with something like that:

bean-price --no-cache main.bean >> prices.bean

Later in the main.bean you include the file prices.bean and you’ll have all the prices for any stock automatically updated every day.

For that the best in my opinion is working with tags. Exemples:

2020-04-21 * “IB” “Buy VEUR” #Buy #VEUR #ETF #Europe #Whatever
Assets:ETF:VEUR 100 VEUR {25.455 EUR}
Expenses:Comission:IB 1.27 EUR
Assets:Account:IB -2546.77 EUR

Later you can filter by tags, I’m using fava for that. Another technique is using different Assets for different stocks, e.g. Assets:ETF:Europe:VEUR and Assets:ETF:US:VTI, Assets:Stock:US:KO, etc. Later you can filter by US or ETF to have the distributions.

I don’t track that but is easy to check by month, years, etc. In Income Statement you have

[ Income ] -1000 [ Expenses ] 800 [ Net Profit ] 200
So for me is easy to have those values.

Regards.

@Tino @tarioch
i see you use cronjob, i want to do the same. Since my machine is off a lot, i looked into fcron for the feature of bootrun , an option that allows to run overdue tasks at system startup if they had been scheduled for during off time.

do you know how to get this working? fcron as such works nicely, but the line

&nice(10),bootrun 0 * * * * echo " we sent an email based on fcrontab entry $(date)" >> ~/myfiles/fcron/testlog.log

will only append to the logfile only when the machine is on. same for
&bootrun 0 * * * * ~/myfiles/fcron/testemailscript.sh
thanks!

@tarioch
what is the advantage of your alphavantage script over the bean-price solution provided by @Tino ?

Honestly I don’t have any idea for windows, did you try https://stackoverflow.com? I did a quick check and I found several solutions… did you try them?

Regards.