How to transfer commodities between currencies?

95 views
Skip to first unread message

Matt McCormick

unread,
Feb 18, 2024, 10:11:32 PM2/18/24
to Beancount
Some commodities trade on multiple stock exchanges and can be exchanged.  How can this transaction be properly recorded?  For example:

2024-02-18 * "Transfer BMO"
Assets:CA:Brokerage:CanadianAccount:BMO 1 BMO {127.03 CAD}
Assets:CA:Brokerage:USAccount:BMO -1 BMO {} @ 94.19 USD

This results in a "Transaction does not balance" error due to the different currencies.
Is there a way this can be properly recorded?

Thanks

Martin Blais

unread,
Feb 19, 2024, 9:09:05 AM2/19/24
to bean...@googlegroups.com
It depends.
What happens to your unrealized gain?
Does this trigger a realization and stepping up of cost-basis? Or do you carry the unrealized gain to CAD?


--
You received this message because you are subscribed to the Google Groups "Beancount" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beancount+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/d6516c06-94ff-4066-862f-a8762f1a8b4fn%40googlegroups.com.

Martin Blais

unread,
Feb 19, 2024, 9:09:42 AM2/19/24
to Martin Blais, bean...@googlegroups.com
(But to the straightforward question is: yes, it can.)

Martin Blais

unread,
Feb 19, 2024, 9:24:32 AM2/19/24
to Martin Blais, bean...@googlegroups.com
It helps to think of it as all the steps that would be taken by your broker.
Say on a transfer you realize the gains:

plugin "beancount.plugins.auto"

2024-01-01 * "Add cash"
  Income:Misc
  Assets:CA:Brokerage:USAccount:Cash   1000.00 USD

2024-01-01 * "Buy BMO in US"
  Assets:CA:Brokerage:USAccount:BMO   2 BMO {90.00 USD}
  Assets:CA:Brokerage:USAccount:Cash


2024-02-18 * "Sell BMO, realized gain"
  Assets:CA:Brokerage:USAccount:BMO  -2 BMO {90.00 USD} @ 94.19 USD
  Assets:CA:Brokerage:USAccount:Cash   2*94.19 USD
  Income:CA:Brokerage:USAccount:PnL

2024-02-18 * "Transfer cash equivalent"
  Assets:CA:Brokerage:USAccount:Cash         -2*94.19 USD
  Assets:CA:Brokerage:CanadianAccount:Cash   2*127.03 CAD @ USD

2024-02-18 * "Sell BMO, realized gain"
  Assets:CA:Brokerage:CanadianAccount:Cash  -2*127.03 CAD
  Assets:CA:Brokerage:CanadianAccount:BMO   +2 BMO {127.03 CAD}


It's not super convenient, but you can compress those last three transactions to

2024-02-18 * "Sell BMO, realized gain"
  Assets:CA:Brokerage:USAccount:BMO  -2 BMO {90.00 USD} @ 94.19 USD
  Income:CA:Brokerage:USAccount:PnL   -8.38 USD
  Assets:CA:Brokerage:CanadianAccount:BMO   +2 BMO {127.03 CAD}
  Assets:CA:Brokerage:CanadianAccount:Cash   2*127.03 CAD @ USD
  Assets:CA:Brokerage:CanadianAccount:Cash  -2*127.03 CAD

If you prefer to provide the exchange rate instead it can fill in the P/L:

2024-02-18 * "Sell BMO, realized gain"
  Assets:CA:Brokerage:USAccount:BMO  -2 BMO {90.00 USD} @ 94.19 USD
  Income:CA:Brokerage:USAccount:PnL
  Assets:CA:Brokerage:CanadianAccount:BMO   +2 BMO {127.03 CAD}
  Assets:CA:Brokerage:CanadianAccount:Cash   2*127.03 CAD @ 0.74147 USD
  Assets:CA:Brokerage:CanadianAccount:Cash  -2*127.03 CAD

Granted it could be better, but it's possible.
Thankfully you probably don't have a ton of these...
(You could automate the generation of these with a plugin if you do.)


Matt McCormick

unread,
Feb 20, 2024, 2:05:29 AM2/20/24
to Beancount
Thanks this is helpful.  I guess I was thinking that the gains would not be realized until the commodity was sold.  But I supposed it at least makes it easier to realize the gains when exchanging.  I was trying to think of a way to transfer the original cost basis, with it being converted somehow.

Red S

unread,
Feb 20, 2024, 2:54:59 PM2/20/24
to Beancount
I'd suggest first figuring out what you want in this case, in terms of realizing gains vs not. In general (with some exceptions), most users want their journal to reflect their tax authority's views of the transaction. Of course, if you have multiple tax authorities who each view it differently, it gets complicated.

Making Beancount reflect either a realization or transferring the original cost basis are both possible and reasonably easy.

Matt McCormick

unread,
Feb 24, 2024, 3:26:45 AM2/24/24
to Beancount
Yeah I think what helped was to just take one step at a time.  I was trying to combine multiple steps together which ended up in confusion.  When separating out the steps and doing one thing at a time I can think more clearly about what I want to accomplish even though it does result in more transactions than I would like.
Reply all
Reply to author
Forward
0 new messages