It looks like the Flattening Inventories in Beancount - Query Language ( https://docs.google.com/document/d/1s0GOZMcrKKCLlP29MD7kHO4L88evrwWdIO0p4EwRBE0/edit#heading=h.agpdf4fbvn2) covers the use case you want. Unfortunately it's a future feature.
I wonder how hard it would be to implement... On Wed, Jan 3, 2018 at 11:16 PM Martin Blais <[email protected]> wrote: > On Wed, Jan 3, 2018 at 10:49 PM, Justus Pendleton <[email protected]> > wrote: > >> On Wednesday, January 3, 2018 at 8:12:09 PM UTC+7, Martin Blais wrote: >> > In any case that should not fail either so there's a bug >> >> With a bit more playing around, I think I understand what beancount is >> doing but I'm still not clear on how to achieve what I want. Using the same >> sample beanfile as in my original post, if I just do SELECT currency, >> number, cost(position), value(position) then beancount tells me >> >> curre num cost_posit value_posi >> ----- --- ---------- ---------- >> VWIUX 1 14.09 USD 14.11 USD >> USD -14 -14.09 USD -14.09 USD >> VWIUX 1 14.23 USD 14.11 USD >> USD -14 -14.23 USD -14.23 USD >> VWIUX 1 14.32 USD 14.11 USD >> USD -14 -14.32 USD -14.32 USD >> VWIUX -1 -14.09 USD -14.11 USD >> VWIUX -1 -14.23 USD -14.11 USD >> VWIUX -1 -14.32 USD -14.11 USD >> USD 42 42.64 USD 42.64 USD >> >> So I guess the key/problem is that the "number" isn't being treated the >> way I expected. Taking the $14.09 lot as an example, I expected it to have >> a single entry with a number of 0. But it actually has 2 entries, one with >> a number of +1 and one with a number of -1. >> >> Now that I see what's happening, I guess I understand why. bean-query is >> showing me postings, not lots. >> > > Yes > > > >> I guess I need to build up an inventory on my own? >> > > You can use sum(position) > > > > >> But I'm not sure that bean-query is flexible enough to let me do what I >> want here and only look at lots that still exist and are under water. So >> I'm back to being stumped about how to proceed. Do I just need to drop into >> python to get what I want? >> > > I don't think you do, use select sum(position) and you should be on your > way, if you want to drop to Python accumulate the Position instances to an > Inventory and print those contents > > (Sorry for the lack of detail, I'm dealing with a newborn situation.) > > > > >> >> Cheers, >> Justus >> >> -- >> 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 post to this group, send email to [email protected]. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/beancount/be5cdbdf-2482-4285-a737-b6e04fa6d138%40googlegroups.com >> <https://groups.google.com/d/msgid/beancount/be5cdbdf-2482-4285-a737-b6e04fa6d138%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> >> For more options, visit https://groups.google.com/d/optout. >> > -- > 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 post to this group, send email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/beancount/CAK21%2BhMa5a2NiEVxN2fDputhUX4_M_PcUzUXp1G0YRAgDEd8-w%40mail.gmail.com > <https://groups.google.com/d/msgid/beancount/CAK21%2BhMa5a2NiEVxN2fDputhUX4_M_PcUzUXp1G0YRAgDEd8-w%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- 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 post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/CAFFHUgvZ-T2X6qiq4P7CjGYHeZf79GQoOemkiqzhswGN_hf_qw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
