Here, that's what I meant:
https://github.com/beancount/beancount/commit/9e6e8f8c3793982a6de5af5321e3026d326f8170
This plugin does what you want (I think).

On Sat, Dec 26, 2020 at 10:29 AM Martin Blais <[email protected]> wrote:

> On Wed, Dec 23, 2020 at 11:11 PM Justus Pendleton <[email protected]>
> wrote:
>
>> On Wednesday, December 23, 2020 at 11:03:44 AM UTC+7 [email protected]
>> wrote:
>>
>>> Short answer is: no, but that's quickly becoming a FAQ from crypto users.
>>> It could be designed, but that would be a new feature.
>>>
>>
>> I only use Spec ID booking so I might be missing something but isn't
>> moving lots just a small 5 or 6 line python script iterating over
>> beancount.ops.holdings.get_final_holdings? Would this work or is it more
>> complicated? I'm not sure that a plugin is simpler/clearer than just
>> generating the transaction externally and then inserting it into the
>> beancount file.
>>
>
> There's that. OTOH if this is super common for crypto, I'm thinking we
> should design it in and make it convenient in the input syntax to make such
> transfers.
>
> In theory it *could* be done with a plugin today as Ben suggest: I
> imagined it more like this though:
>
> 2020-12-19 T "Binance" "Transfer BTC Coinbase-Pro => Binance"
> Assets:Crypto:BTC:Binance 0.2 BTC {}
> Assets:Crypto:BTC:Coinbase-Pro
>
> whereby the plugin would know to select transactions with flag 'T' (or
> perhaps a tag given in its config, whatever) and convert the posting on
> Assets:Crypto:BTC:Coinbase-Pro to include all the original matched
> reductions. I think this should be doable today actually.
>
>
>
> holdings = beancount.ops.holdings.get_final_holdings(entries,
>> included_account_types=('Assets',))
>> print(f'{datetime.date.today()} * "ACATS" "Autogenerated lot transfer to
>> new account"')
>> for h in filter(match, holdings):
>>    cost_date = None
>>    print(f' {h.account} -{h.number} {h.currency} {{ {cost_date},
>> {h.cost_number} {h.cost_currency} }}')
>>    print(f' {args.destination} {h.number} {h.currency} {{ {cost_date},
>> {h.cost_number} {h.cost_currency} }}')
>>
>> The only problem I see is that get_final_holdings returns a Holding tuple
>> that doesn't include the acquisition date. But there's a note in the code
>> saying the Holding tuple should go away and just be replaced by a Position,
>> which would hold the acquisition date.
>>
>
> beancount.ops.holdings is gone in v3. It was superfluous anyway (well when
> I started it I wasn't sure if it would start acquiring more features than
> just an inventory). Now you can simply aggregate over an inventory and
> enumerate its contents (positions).
>
>

-- 
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%2BhNPWvfAvzXyxYtPrmp_PSrWD-NFOn8V0-LiPo1QdSNAwQ%40mail.gmail.com.

Reply via email to