Does Beancount allow easy changing of the "base" currency?

274 views
Skip to first unread message

Anatoly Makarevich

unread,
May 3, 2021, 7:52:04 PM5/3/21
to Beancount
I'm very interested in trying plain text accounting, I currently use GnuCash, and it's turned into quite the chore now that I've gotten into stocks and cryptocurrencies...

I recently moved countries, and expect to possibly move again in the future. I would like to keep a single accounting history while still being able to calculate things relative to any "base" currency. This is especially important because, though I'm living in Europe, I'm a US citizen and need to file taxes anyways. While my only income was my salary, it was all easy to do manually, but now I need to calculate capital gains for stocks and cryptocurrency.

What really made me look for alternatives to GnuCash was the impossibility of setting transaction fees with a "stock"-type; since "gas fees" in crypto are paid in crypto, this means it's a huge headache.

As I understand from reading threads, Beancount supports 2 different options for cryptocurrencies. One is to treat crypto like a currency, in which case all of them are equivalent, but cost accounting is more difficult in some way? The other is to treat it like an investment asset, which tracks the price each particular unit was sold... which is confusing to me, because it seems I can't sell at a different price than the buying price? That doesn't seem right.

Essentially, I use USD, EUR, PLN, BYN, 3+ cryptocurrencies, and probably stocks. In GnuCash I used the trading accounts method to handle all conversions, and I believe the ledger balance was kept. I can change the report currency to get "today's" status of all transactions. Can I do the same easily in Beancount? Judging by what I've seen, the answer is yes. Are there any hidden dangers or other problems?

Thank you for your time.

James Cook

unread,
May 5, 2021, 3:59:12 PM5/5/21
to bean...@googlegroups.com
I mostly view my Beancount ledger through the fava web UI, and it seems
to have good support for viewing things in different currencies. You
should make sure you supply the necessary prices somewhere in your
ledger.

I don't know if Beancount will do everything you want. Maybe try a
couple of experiments with toy examples?

I'm not sure what you mean by "I can't sell at a different price than
the buying price". You might want to look at the "Trading with
Beancount" document at
https://beancount.github.io/docs/trading_with_beancount.html . (Maybe
you're referring to the fact that when you sell a lot, it's valued at
the price you bought it at? Hopefully the examples on that page will
explain why that works.)

--
James

Anatoly Makarevich

unread,
May 7, 2021, 3:44:07 PM5/7/21
to Beancount
Thanks for the link, I had missed that during my initial preview phase. I decided to just jump right in, and I already feel that it's the right choice.

Yes, I was referring to the lot prices. I see how it makes a lot of sense for normal stocks and other integer-valued assets.
However, for fiat currencies and cryptocurrencies, I would expect tracking lots to be a huge headache (it's always fractional).
Especially since I'm living in a very multi-currency situation even now.

However, I've found that just having 2 trading accounts (1 for fiat-fiat exchange, 1 for crypto-crypto and fiat-crypto exchange) is enough to implement the "trading accounts" method.
For each transaction, you can just specify:

2021-05-07 * "Self" "Example currency conversion"
   Assets:Cash -100 USD
   Assets:Cash 117 CAD
   Expenses:Exchange:Fiat 4 USD
   Income:Exchange:Fiat

This will automatically track all FX (or crypto) income and fees separately.
I'm not even certain a plugin needs to be developed, maybe a shortcut for "I did an exchange here".

As I understand, the only downside is that all my gains/losses will be averaged out, so I can't do creative tax matching.
However, since any crypto losses can only be weighed against future crypto gains (in my location), I don't see this as much of a problem.

James Cook

unread,
May 9, 2021, 7:56:19 PM5/9/21
to bean...@googlegroups.com
On Fri, May 07, 2021 at 12:44:07PM -0700, Anatoly Makarevich wrote:
> Thanks for the link, I had missed that during my initial preview phase. I
> decided to just jump right in, and I already feel that it's the right
> choice.
>
> Yes, I was referring to the lot prices. I see how it makes a lot of sense
> for normal stocks and other integer-valued assets.
> However, for fiat currencies and cryptocurrencies, I would expect tracking
> lots to be a huge headache (it's always fractional).
> Especially since I'm living in a very multi-currency situation even now.

My impression is people don't usually bother with lots for (non-crypto)
currency exchange. I certainly don't. However they may come in handy if
you have to report capital gains on your cryptocurrency.


> *However*, I've found that just having 2 trading accounts (1 for fiat-fiat
> exchange, 1 for crypto-crypto and fiat-crypto exchange) is enough to
> implement the "trading accounts" method.
> For each transaction, you can just specify:
>
> 2021-05-07 * "Self" "Example currency conversion"
> Assets:Cash -100 USD
> Assets:Cash 117 CAD
> Expenses:Exchange:Fiat 4 USD
> Income:Exchange:Fiat
>
> This will automatically track all FX (or crypto) income and fees separately.
> I'm not even certain a plugin needs to be developed, maybe a shortcut for
> "I did an exchange here".
>
> As I understand, the only downside is that all my gains/losses will be
> averaged out, so I can't do creative tax matching.
> However, since any crypto losses can only be weighed against future crypto
> gains (in my location), I don't see this as much of a problem.

I'm not sure trading accounts will give you enough information to file
taxes if you're using cryptocurrencies.

For example, for my US tax, if I spend 0.1 BTC on something, I have to
answer two questions to fill out Schedule D (capital gains):

- How long ago did I buy that 0.1 BTC? Determines whether the gain is
short or long term.

- How much did I pay for it?

I actually haven't tried directly using trading accounts to compute
capital gains, but consider this sequence of transactions:

2020-01-01 * "Buy"
Assets:BTC 0.1 BTC
Assets:Cash -6000 USD
Equity:Exchange -0.1 BTC
Equity:Exchange 6000 USD

2020-02-01 * "Spend"
description: "Buy $7000 gadget for 0.1 BTC."
Assets:BTC -0.1 BTC
Equity:Exchange 0.1 BTC
Equity:Exchange -7000 USD
Expenses:Gadgets 7000 USD

2020-02-01 * "Buy more"
Assets:BTC 0.05 BTC
Assets:Cash -1000 USD
Equity:Exchange -0.05 BTC
Equity:Exchange 1000 USD

The final balance in the exchange accounts will be:

-0.05 BTC
0 USD

For US taxes, at least, you'd need to report a $1000 capital gain from
when you spent the 0.1 BTC. I don't see a convenient way to get that
information out of this example ledger. The exchange account balances
certainly don't seem useful.

--
James
Reply all
Reply to author
Forward
0 new messages