Moving assets between accounts and preserve cost basis?

119 views
Skip to first unread message

Artur Matos

unread,
Dec 21, 2023, 8:29:05 PM12/21/23
to Beancount
Hi everyone,

I've changed one of my taxable accounts providers and need to transfer the assets from one beancount account to the other. Transfer happens "in specie" and I need to preserve the cost basis and lots as part of the transfer. If I understood the docs correctly , transferring like this won't work and will remove the lots from the new account:

2015-05-15 * "Transfer" Assets:InvestAccount1 -60 HOOL {} Assets:InvestAccount2 60 HOOL {}

Is there a shorthand way to transfer the assets while preserving lot information? I've had the original account for rather long and doing it lot by lot will be very tedious.

Thanks.

Martin Blais

unread,
Dec 21, 2023, 8:34:29 PM12/21/23
to bean...@googlegroups.com
I *think*[1] that if 60 HOOL is all you have in that account it should match the total number of units in account1, and it would automatically fill in the cost basis in account2.

[1] It's been a while, adding a unit test specifically for this case in the matching code might make sense to validate in an isolated way.

--
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/48984991-9622-49cf-9c54-b98f70ac1518n%40googlegroups.com.

Justus Pendleton

unread,
Dec 23, 2023, 3:41:41 AM12/23/23
to Beancount
This may not help you but I figure I'll mention it here since moving cost basis came up.

A few years I wrote a plugin to (try to) do this. "It worked for me" but a user soon reported an issue. You can't ever use the {} syntax.


"In loader.py around lines 506-513 it looks like the loader runs "interpolation" on incomplete booking entries before it runs "transformations" from plugins. So the {} gets triggered (and then fails because it can't find enough matching holdings) before the asset_transfer plugin has a chance to run and actually generate the holdings.

You can workaround this by not using {} and instead specifying the lots explicitly."

Artur Matos

unread,
Dec 28, 2023, 5:24:55 PM12/28/23
to Beancount
Thanks everyone. I was hoping I could avoid transferring the lots explicitly but it's OK. Thanks. 
Reply all
Reply to author
Forward
0 new messages