Thank you Justus,
Added to contrib doc.

On Fri, Sep 10, 2021 at 9:47 AM Justus Pendleton <[email protected]> wrote:

> Here's a plugin I quickly threw together to do this. There are a few
> things in the code I'm not 100% sure about, so consider this a beta and let
> me know if it seems like it is doing the right thing or not for you.
>
> https://github.com/hoostus/beancount-asset-transfer-plugin
>
> It uses a custom directive so you'd write:
>
> 2021-09-10 custom "transfer" 100 APPL Assets:Schwab Assets:Fidelity
>
> Caveats: I don't use crypto so maybe I don't understand what you're trying
> to do; also it transfers assets in LIFO order.
>
>
> On Monday, September 6, 2021 at 6:45:12 AM UTC+7
> [email protected] wrote:
>
>> May I chip in here and say that I have a *lot* of these. The case of
>> transferring crypto around has been well discussed but it's a CGT asset in
>> Aus and moving crypto between exchanges and hot/cold wallets is not
>> uncommon for me: these number in the dozens, maybe even three figures.
>>
>> I have also at times had multiple stockbrokers and while I can go with
>> abstract account names ("Assets:Shares:<ticker>"), I've preferred to have
>> per-institution accounts so where I have two active accounts at once the
>> statements make sense. Every time I transfer holdings between brokers,
>> those assets are transferred with their cost base attached.
>>
>> Not sure what the syntax should be. Just eliding the "recipient" leg in a
>> transfer populates the posting with the currency of the cost base: it's
>> beautiful for capital gains but doesn't help us here. So this would break:
>>
>>   2021-09-02 * "Buy
>> BTC"
>>     Assets:Exchange:AUD                       -1000.00
>> AUD
>>     Assets:Exchange:BTC                           1.00 BTC {1000.00 AUD,
>> 2021-09-02} @ 1000.00 AUD
>>
>>
>>   2021-09-03 * "Transfer
>> BTC"
>>     Assets:Exchange:BTC                          -1.00 BTC
>> {}
>>
>> Assets:Transfer:BTC
>>
>>
>> (Assets:Transfer:BTC is populated with 1000 AUD, being the cost base;
>> again, wonderful for capital gains, but not what we need here)
>>
>> Perhaps:
>>
>>   2021-09-03 * "Transfer
>> BTC"
>>     Assets:Exchange:BTC                          -1.00 BTC
>> {}
>>     Assets:Transfer:BTC                              1.00 BTC {}
>>
>> This would add {} to the syntax of *augmenting* postings. Correct me if
>> I'm wrong, but that "empty braces" syntax doesn't exist at present for
>> augmentations. Perhaps it could be introduced to mean "dump residuals here,
>> but keep the cost base rather than convert to cost currency". If this
>> doesn't resolve to a single currency it's an error.
>>
>> But that's really a question for Martin; please just consider this a keen
>> +1 for this feature. I prefer strict booking so I manually fix these up but
>> it would be nice to be able to write software that exports valid entries
>> that beancount can interpolate with FIFO/LIFO in the first instance e.g.
>> for debugging my own code before I make the txs "concrete" with explicit
>> bookings.
>> On Thursday, 2 September 2021 at 11:45:29 pm UTC+10 [email protected]
>> wrote:
>>
>>> +1 re. Ben's answer.
>>> How many of these do you really do?
>>>
>>>
>>> On Thu, Sep 2, 2021 at 2:30 AM Ben Blount <[email protected]> wrote:
>>>
>>>> Yeah this is high on my wishlist too. This came up a bunch for crypto
>>>> users as well - you should find some examples if you search for crypto on
>>>> the mailing list.
>>>>
>>>> The workaround is you have to transfer the lots manually, e.g make two
>>>> postings per lot - one to reduce the lot on the old account, then recreate
>>>> it with the original date and cost in the new account.
>>>> direction
>>>> bean-doctor can help you easily get all the lots, you can then copy
>>>> paste to make this a little less fussy.
>>>>
>>>> I'm on mobile or I'd give you examples.
>>>>
>>>> On Wed, Sep 1, 2021, 22:37 [email protected] <[email protected]> wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> I tried searching a bit in the documentation and this forum but not
>>>>> sure how to handle this case and carry forward cost-basis information.
>>>>> Imagine you buy some stock at institution 1 and transfer it to institution
>>>>> 2 and then sell. How should one record all this? I tried the following but
>>>>> I'm getting an error related to no positions found.
>>>>>
>>>>> Thanks,
>>>>> Jonathan
>>>>>
>>>>> 2015-02-01 open Assets:Invest:ATrade
>>>>>
>>>>> 2015-02-01 open Assets:Invest:ATrade:Cash
>>>>>
>>>>>
>>>>> 2015-04-01 * "Buy some shares of Hooli in April 2015"
>>>>>
>>>>>   Assets:Invest:ATrade                                   25 HOOL
>>>>> {10.00 USD, "first-lot"}
>>>>>
>>>>>   Assets:Invest:ATrade:Cash                            -250 USD
>>>>>
>>>>>
>>>>>
>>>>> 2017-03-01 open Assets:Invest:ZTrade
>>>>>
>>>>> 2017-03-01 open Assets:Invest:ZTrade:Cash
>>>>>
>>>>>
>>>>> 2017-04-01 * "Transfer from ATrade to ZTrade"
>>>>>
>>>>>   Assets:Invest:ATrade                                   -25 HOOL
>>>>>
>>>>>   Assets:Invest:ZTrade                                   25 HOOL
>>>>>
>>>>>
>>>>>
>>>>> 2017-05-01 close Assets:Invest:ATrade
>>>>>
>>>>>
>>>>> 2018-05-03 * "Sell some shares of Hooli in May 2018"
>>>>>
>>>>>   Assets:Invest:ZTrade                                   -25 HOOL {} @
>>>>> 22.00 USD
>>>>>
>>>>>   Assets:Invest:ZTrade:Cash
>>>>>
>>>>> No position matches "Posting(account='Assets:Invest:ZTrade', units=-25
>>>>> HOOL, cost=CostSpec(number_per=<class 'beancount.core.number.MISSING'>,
>>>>> number_total=None, currency='USD', date=None, label=None, merge=False),
>>>>> price=22.00 USD, flag=None, meta={'filename':
>>>>> '/Users/jonathan/Documents/Finances/beandata/test.beancount', 'lineno':
>>>>> 22})" against balance (25 HOOL)
>>>>>
>>>>> --
>>>>> 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/b3efe67c-a858-4c2c-af6b-26e7444dd9e1n%40googlegroups.com
>>>>> <https://groups.google.com/d/msgid/beancount/b3efe67c-a858-4c2c-af6b-26e7444dd9e1n%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/CACGEkZtewt_iundhaTt8HZ654SJmNWJYyUHhgEPXx0gk2SfRkQ%40mail.gmail.com
>>>> <https://groups.google.com/d/msgid/beancount/CACGEkZtewt_iundhaTt8HZ654SJmNWJYyUHhgEPXx0gk2SfRkQ%40mail.gmail.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/a09a1415-0585-42f7-b1d8-0d2d72efa928n%40googlegroups.com
> <https://groups.google.com/d/msgid/beancount/a09a1415-0585-42f7-b1d8-0d2d72efa928n%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/CAK21%2BhMwMAS5%3DiN0tSGbOS%2BkWEVyDFaZgs-_q%3DSt7wcBiSyJuA%40mail.gmail.com.

Reply via email to