Thank you for this information, so I was indeed not fully understanding 
some of it

On Friday, January 10, 2025 at 9:23:06 AM UTC-8 [email protected] wrote:

> On 10/01/25 17:54, E wrote:
> > Thank you for looking into this
> > 
> > I think there is the slight difference in that I am adding costs to the 
> > transactions
>
> [...]
>
> > Result:
> > [((1.0 TEST {1.0 USD, 2024-01-01}, 1.0 TEST {1.0 USD, 2024-01-02}, 1.0 
> > TEST {1.0 USD, 2024-01-03}),)]
>
> This is correct. You would get the same result in the interactive 
> bean-query shell. As you can see, the costs get an implicit date added, 
> thus the lots cannot be summed together without loss of information.
>
> To get the result you get applying numberify you need to drop the cost 
> information and sum the units in each posting using the units() BQL 
> function:
>
> >>> import beanquery
> >>> conn = beanquery.connect('beancount:tests/test53.beans')
> >>> curs = conn.execute('''
> ... SELECT sum(units(position))
> ... WHERE date <= 2024-04-01 AND account ~ "Assets:MyAsset"
> ... ''')
> >>> curs.fetchall()
> [((3.0 TEST),)]
>
> Conversely, to sum the costs at the time of the transaction, you can use 
> the cost() function.
>
> Cheers,
> Dan
>
>

-- 
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 visit 
https://groups.google.com/d/msgid/beancount/aa66ab42-1fce-4cc1-827b-48e5a49f40dcn%40googlegroups.com.

Reply via email to