Disclaimer: I'm not an expert with this and may be wrong
In your case I understand that you don't want to keep cost basis in expenses accounts. What I would do is sell BTC at a cost and keep it without cost in Expenses. This is minimal beancount file that shows it:

plugin "beancount.plugins.auto_accounts"

2018-08-07 * "Buy BTC"
  Income:Salary           -20 USD
  Assets:Bitcoin             2 BTC {10 USD}

2019-08-07 * "Buy Pizza"
  Assets:Bitcoin            -1 BTC {10 USD}
  Expenses:Pizza           1 BTC @ 20 USD
  Income:Gains            -10 USD

If you wanted to keep cost basis in the other account:
I think this topic was raised earlier this year. You can search for "Moving assets with cost basis" in the mailing list to see a solution.

The short answer is that when you do the transfer you have to put cost basis explicitly inside {} (even if there is only one lot)


On 29/09/2019 17:11, Dennis Golomazov wrote:
And if I add the cost manually, it shows a "Transaction does not balance" error.

On Sunday, September 29, 2019 at 6:07:09 PM UTC+3, Dennis Golomazov wrote:

    Hi,

    I have a question. Imagine you buy bitcoins, so they are held at
    cost.
    Then later you use them to buy something (so they go to Expenses:
    subaccount nominated in bitcoins).
    How do you record that transaction? Ideally I want the
    gains/losses to be realized.
    But If I do something like:

       2013-06-01 * "Buy pizza"
         Assets:Cryptocurrency:Coinbase:Bitcoin       -10000 BTC {}
         Expenses:Pizza               10000 BTC

    beancount shows an error "No position matches...".
    I assume that's because BTC were bought with USD, but now are
    "sold" to BTC and not back to USD?

    This works:

       2013-06-01 * "Buy pizza"
         Assets:Cryptocurrency:Coinbase:Bitcoin         -10000 BTC {}
         Expenses:Pizza               100 USD

    the cost gets imputed correctly. But the thing is that pizza might
    haven't had a price in USD, it was nominated in bitcoins :)
    What's the best way to handle these situations?

--
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 [email protected] <mailto:[email protected]>. To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/a7aa91f9-4042-4bfb-bdc1-01b50e04b645%40googlegroups.com <https://groups.google.com/d/msgid/beancount/a7aa91f9-4042-4bfb-bdc1-01b50e04b645%40googlegroups.com?utm_medium=email&utm_source=footer>.

--
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/df2db204-6651-dccf-d94b-d46cf0579d18%40gmail.com.

Reply via email to