TLDR: it's a hack to try to get beancount to carry cost basis along if that position is ever transferred to another account.
There have been a bunch of discussions about this and to be honest, I'm not 100% confident in the current state of affairs. In general, beancount is not very reliable about carrying cost basis along with transfers. Asset transfers are a very uncommon pattern in general beancount usage, it seems of concern mostly to crypto traders (who frequently transfer between exchanges and wallets). So it's not a well-exercised or supported functionality. See e.g. https://github.com/beancount/beancount/issues/476 https://groups.google.com/g/beancount/c/WF3Ta9yVQVo (and many more crypto discussions on the list) There have been a couple workarounds discussed. It looks like what I eventually got working for me was inserting an empty cost spec: https://github.com/ericaltendorf/magicbeans/blob/4a0856aa0558abb5dc1b78123ea4feff263646cd/src/magicbeans/common.py#L102 It is possible this depends on this tweak I made to beancount core: https://github.com/beancount/beancount/compare/master...ericaltendorf:beancount:cost-transfer However like I said I have seen inconsistent behavior and so I don't have confidence in my mental model of what beancount is actually doing here. It would be really nice to get this rigorously understood and supported. On Sun, Mar 17, 2024 at 8:44 AM CD <[email protected]> wrote: > Thank you for this. > > I figured out the USD price importing (I downloaded price histories from > Yahoo and put them all in a folder that my script references) but I am not > clear on what the empty {} does > > > I understand if I want to book the price I purchased at in the database I > want to use something like this... > > Assets:XRP 1107.10301990 XRP {0.66587 USD} > > But in your example.... > > 2020-04-10 * "Exchange 1483.9889 USDT for 9.4000 ETH" > Assets:Account:ETH 9.4 ETH {158.1869 USD} > Assets:Account:USDT -1483.988882235528942115768463 USDT {} @ 1.0020 USD > Income:CapGains > > What does the USDT {} @ 1.0020 USD part do? > > > Thank you for the reply. I saw that you replied in the other thread, I > will be checking that out in the next few days once I get this sorted. > On Saturday, March 16, 2024 at 6:16:35 PM UTC-4 [email protected] wrote: > >> All of the following is not tax or accounting advice, but simply my >> understanding. Feedback from other beancounters would be welcome. >> >> I think you have to figure out the USD values yourself, based on your >> assessment of the FMV. Here's some examples of how I structure exchanges. >> (Reminder: this is a generated file with fake data) >> >> >> https://github.com/ericaltendorf/magicbeans/blob/master/data/magicbeans_example.beancount#L69 >> 2020-04-10 * "Exchange 1483.9889 USDT for 9.4000 ETH" >> Assets:Account:ETH 9.4 ETH {158.1869 USD} >> Assets:Account:USDT -1483.988882235528942115768463 USDT {} @ 1.0020 USD >> Income:CapGains >> >> >> https://github.com/ericaltendorf/magicbeans/blob/master/data/magicbeans_example.beancount#L101 >> 2020-06-10 * "Exchange 20.0000 ETH for 4943.2960 USDT" >> Assets:Account:USDT 4943.296022386568059164501299 USDT {1.0006 USD} >> Assets:Account:ETH -20 ETH {} @ 247.3131 USD >> Income:CapGains >> >> I do this in my importers. For example, the coinbase pro importer, when >> a transaction has an increase leg, looks up the USD price of the increasing >> currency: >> >> https://github.com/ericaltendorf/magicbeans/blob/master/src/magicbeans/importers/coinbasepro.py#L238 >> See also the gateio importer: >> >> https://github.com/ericaltendorf/magicbeans/blob/master/src/magicbeans/importers/gateio.py#L265 >> I am sad I never had the time to clean all this up and create an elegant >> and consistent code path for handling both of these. :( >> >> Regarding prices, I wrote my own code for price fetching (rationale in >> the header of the file): >> >> https://github.com/ericaltendorf/magicbeans/blob/master/src/magicbeans/prices.py >> >> Then for tax reporting you want to report the value of the proceeds in >> USD. Take a look at the last entry in the Disposals table on page 5 of the >> example PDF report: >> https://github.com/ericaltendorf/magicbeans/blob/master/data/magicbeans_example.pdf >> There was an exchange, where there was a disposal of 20 ETH and an >> acquisition of 4943.2960 USDT, but the "proceeds" (i.e., USD value on which >> taxes might be assessed) was 4946.26 (because 1 USDT ~= 1.0006 USD at the >> time). >> >> hope this helps. i am sorry i haven't had a chance to get back to you on >> the other thread yet. >> >> >> On Sat, Mar 16, 2024 at 12:45 PM CD <[email protected]> wrote: >> >>> Two random transactions that I created based from an old Poloniex export >>> a friend gave me... >>> >>> 2018-01-03 * "Crypto Buy" "Order number: xxxxxxxxx" >>> Assets:DGB 5171.00018694 DGB @ 0.00000447 BTC >>> Assets:BTC -0.02317230 BTC >>> Expenses:TradingFees 12.95990021 DGB @ 0.00000447 BTC >>> >>> 2018-01-08 * "Crypto Sell" "Order number: xxxxxx" >>> Assets:ETC -13.30376940 ETC @ 0.00225500 BTC >>> Assets:BTC 0.02995500 BTC >>> Expenses:TradingFees 0.00004499 BTC >>> >>> >>> Poloniex at the time only had transactions made between different >>> cryptocurrencies, so there are no USD trades. Everything is priced in one >>> half of the pair ie BTC/ETC DGB/BTC in the above examples. >>> >>> How does one go about making everything into USD in reporting (cost >>> basis, etc) >>> >>> I'm baffled. >>> >>> If I set price directives for the different cryptos before each >>> transaction will that do it? Or am I going about it all wrong? >>> >>> There doesn't seem to be a way to do double @ either. So for example I >>> couldn't do 5171.00018694 DGB @ 0.00000447 BTC @ 21000.00 USD right? >>> >>> Is there some way to set up the cost basis in USD in the initial >>> transaction or using price directives? >>> >>> >>> -- >>> 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/a537f66b-f03b-4aac-bd50-deda8584a179n%40googlegroups.com >>> <https://groups.google.com/d/msgid/beancount/a537f66b-f03b-4aac-bd50-deda8584a179n%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/8b39f184-1692-434c-b6b9-e5133369b92en%40googlegroups.com > <https://groups.google.com/d/msgid/beancount/8b39f184-1692-434c-b6b9-e5133369b92en%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/CAFXPr0tD6sKZZSL0%3DhFxi3SCSZP5sWOYobQvV7XvwWLLjFk2tQ%40mail.gmail.com.
