Do I find correctly, that the two plugins 
"beancount.plugins.unrealized" and
"beancount.plugins.leafonly"

inherently clash since "unrealized" explicitly adds a Child-account to 
existing (commodity containing) accounts, and "leafonly" will then detect 
non-leaf accounts with bookings? my Minimal example:
plugin "beancount.plugins.unrealized" "PnL"
plugin "beancount.plugins.leafonly"

1970-01-01 commodity MYSTOCK
    name: "MYSTOCK"

2015-11-09 price MYSTOCK          1 USD

1970-01-01 open Assets:USD  USD
1970-01-01 open Assets:MYSTOCK  MYSTOCK

2017-08-04 * "MYSTOCK" "buy MYSTOCK" 
 Assets:MYSTOCK  1 MYSTOCK { 1 USD } 
 Assets:USD 

with a query printout

$bean-query test3.bean print
test3.bean:11:      Non-leaf account 'Assets:MYSTOCK' has postings on it

   1970-01-01 open Assets:MYSTOCK                                  MYSTOCK


1970-01-01 open Assets:USD                                      USD
1970-01-01 open Assets:MYSTOCK                                  MYSTOCK

1970-01-01 commodity MYSTOCK
  name: "MYSTOCK"

2015-11-09 price MYSTOCK                                 1 USD

2017-08-04 open Assets:MYSTOCK:PnL
2017-08-04 open Income:MYSTOCK:PnL

2017-08-04 * "MYSTOCK" "buy MYSTOCK"
  Assets:MYSTOCK   1 MYSTOCK {1 USD, 2017-08-04}
  Assets:USD      -1 USD                        

2017-08-04 U "Unrealized loss for 1 units of MYSTOCK (price: 1.0000 USD as 
of 2015-11-09, average cost: 1.0000 USD)"
  Assets:MYSTOCK:PnL  0 USD
  Income:MYSTOCK:PnL  0 USD

I really like both plugins, but i cannot imagine combining them. I guess 
dropping one of them is the only option, or is there a way to use both 
plugins? For example, specify non-subaccounts for the PnL?
Thanks for your advice!




On Friday, November 29, 2019 at 10:36:37 AM UTC+1, nug get wrote:
>
> Thanks Justus,
> your answer really puts it into context, which indeed helps me. 
>
>
>
>
>
> On Friday, 29 November 2019 02:54:07 UTC+1, Justus Pendleton wrote:
>>
>> On Friday, November 29, 2019 at 7:01:27 AM UTC+7, nugget wrote:
>>
>>> What would be the clean way of balancing both accounts other than 
>>> hardcoding a transaction and changing it everytime some historic 
>>> transactions pops up?
>>>
>>
>> I would suggest not to use nested accounts like you have in your example. 
>> Don't put transactions in Assets:Parent. In the real world, banks and 
>> brokerages generally don't allow accounts to work like in your example. 
>> There's a beancount plugin called "leafonly" -- 
>> https://aumayr.github.io/beancount-docs-static/api_reference/beancount.plugins.html#module-beancount.plugins.leafonly
>>  
>> -- which is how most accounts should be structured, with only rare 
>> exceptions.
>>
>> In any case, dealing with "historic transactions that pop up" is always 
>> going to cause problems with balance statements. The solution is to not 
>> have historic transactions popping up -- don't write balance statements 
>> when you have unknown(?!) outstanding transactions -- or accept that you 
>> will need to rewrite your beancount history & transactions. That pad does 
>> that automagically for you is not a good thing IMHO.
>>
>> I think that pad statements should be used very sparingly. They are 
>> convenient but a little too magical. You get 99% of the benefit, with no 
>> confusion, by simply writing the equivalent pad transaction yourself and 
>> making it explicit.
>>
>

-- 
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/28549213-0da5-4ced-b80e-17a561731e3f%40googlegroups.com.

Reply via email to