Tracking Commodities At Cost Between Accounts

65 views
Skip to first unread message

Amos Kyler

unread,
Aug 11, 2018, 8:15:08 PM8/11/18
to Beancount

Hey all! New to Beancount here, loving it so far. I've gotten pretty much all of my finances in order using the excellent documentation and reading through this forum.

I've got a question about handling the transfer of commodities purchased at cost. I'm getting an error in one of the following transactions, and would love some advice on how to approach what I'm trying to do.


2017-01-01 open Assets:Crypto:US:Exchange:BTC BTC "FIFO"

2017-01-01 open Assets:Crypto:Wallet:BTC BTC "FIFO"

2017-01-01 * "Exchange Purchase" "Buy BTC"
Assets:US:Checking -1500.00 USD
Assets:Crypto:US:Exchange:BTC 1.00 BTC {1500.00 USD}

2017-01-02 * "Tranfer To Wallet" "Transfer BTC"
Assets:Crypto:US:Exchange:BTC -0.5 BTC
Assets:Crypto:Wallet:BTC 0.5 BTC

2017-01-03 * "Exchange Purchase" "Buy BTC"
Assets:US:Checking -1000.00 USD
Assets:Crypto:US:Exchange:BTC 0.50 BTC {2000 USD}


In this example, the third transaction throws the following error:

[Beancount] No position matches "Posting(account='Assets:Crypto:US:Exchange:BTC', units=0.50 BTC, cost=CostSpec(number_per=Decimal('2000'), number_total=None, currency='USD', date=None, label=None, merge=False), price=None, flag=None, meta={'filename': '/Home/beancount/crypto.bean', 'lineno': 127})" against balance (-0.5 BTC, 1.00 BTC {1500.00 USD, 2017-01-01})

I don't fully understand why this is the error being generated, but I believe I understand the underlying issue. Beancount does not deduct from lots in Assets:Crypto:US:Exchange:BTC and create identical lots in the transfer account Assets:Crypto:Wallet:BTC. So cost basis is lost when moving commodities account to account.

The third transaction does not fail if the second transaction is removed or represented as a sale, and a re-purchase in the other account.

This kind of transaction is commonplace as moving cryptos out of exchanges and into wallets is the standard. Cost basis is determined by the exchange transaction however, but should still apply to the same holdings in a different account. What kind of strategy should I be using here to correctly calculate gains/losses over time?

Thanks,
Amos

Amos Kyler

unread,
Aug 11, 2018, 10:20:50 PM8/11/18
to Beancount
Thanks to a new response https://groups.google.com/forum/#!topic/beancount/Qvbcq-Sk5NY I've just found some new information to read through. This is exactly my issue!

Martin Blais

unread,
Aug 12, 2018, 3:55:48 PM8/12/18
to Beancount
On Sat, Aug 11, 2018 at 8:15 PM Amos Kyler <amos....@gmail.com> wrote:

Hey all! New to Beancount here, loving it so far. I've gotten pretty much all of my finances in order using the excellent documentation and reading through this forum.

I've got a question about handling the transfer of commodities purchased at cost. I'm getting an error in one of the following transactions, and would love some advice on how to approach what I'm trying to do.


2017-01-01 open Assets:Crypto:US:Exchange:BTC BTC "FIFO"

2017-01-01 open Assets:Crypto:Wallet:BTC BTC "FIFO"

2017-01-01 * "Exchange Purchase" "Buy BTC"
Assets:US:Checking -1500.00 USD
Assets:Crypto:US:Exchange:BTC 1.00 BTC {1500.00 USD}

2017-01-02 * "Tranfer To Wallet" "Transfer BTC"
Assets:Crypto:US:Exchange:BTC -0.5 BTC
Assets:Crypto:Wallet:BTC 0.5 BTC

2017-01-03 * "Exchange Purchase" "Buy BTC"
Assets:US:Checking -1000.00 USD
Assets:Crypto:US:Exchange:BTC 0.50 BTC {2000 USD}


In this example, the third transaction throws the following error:

[Beancount] No position matches "Posting(account='Assets:Crypto:US:Exchange:BTC', units=0.50 BTC, cost=CostSpec(number_per=Decimal('2000'), number_total=None, currency='USD', date=None, label=None, merge=False), price=None, flag=None, meta={'filename': '/Home/beancount/crypto.bean', 'lineno': 127})" against balance (-0.5 BTC, 1.00 BTC {1500.00 USD, 2017-01-01})

I don't fully understand why this is the error being generated, but I believe I understand the underlying issue. Beancount does not deduct from lots in Assets:Crypto:US:Exchange:BTC and create identical lots in the transfer account Assets:Crypto:Wallet:BTC. So cost basis is lost when moving commodities account to account.

That's correct. 
 

The third transaction does not fail if the second transaction is removed or represented as a sale, and a re-purchase in the other account.

This kind of transaction is commonplace as moving cryptos out of exchanges and into wallets is the standard. Cost basis is determined by the exchange transaction however, but should still apply to the same holdings in a different account. What kind of strategy should I be using here to correctly calculate gains/losses over time?
\

You have to provide the cost basis on both sides of the second transaction.


 
Thanks,
Amos

--
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 post to this group, send email to bean...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/fa55f9cc-6c89-4860-a92b-4c39d92bc044%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages