Sent from Proton Mail for iOS On Tue, Aug 16, 2022 at 18:04, Oon-Ee Ng <ngoonee.t...@gmail.com> wrote:
> These scripts - do they rely on beancount v3? I'm still on 2.3.5 here > > On Sun, Nov 28, 2021 at 12:06 AM Martin Blais <bl...@furius.ca> wrote: > >> Here, just for you: >> https://github.com/beancount/beanlabs/blob/master/beanlabs/scripts/scan.py#L38 >> >> On Sat, Nov 27, 2021 at 10:35 AM Martin Blais <bl...@furius.ca> wrote: >> >>> Check out what I do in this >>> script:https://github.com/beancount/beanlabs/blob/master/beanlabs/compensation/net-worth-over-time.py#L223 >>> >>> It could be made nicer, an iterator could be created that yields the state >>> at a given list of timestamps, so all the aggregation would be abstracted >>> away. >>> >>> On Sat, Nov 27, 2021 at 5:10 AM Stefano Zacchiroli <z...@upsilon.cc> wrote: >>> >>>> On Fri, Nov 26, 2021 at 09:08:18AM -0500, Martin Blais wrote: >>>>> https://github.com/beancount/beancount/blob/master/beancount/ops/summarize.py#L589 >>>> >>>> Thanks a lot Martin, I didn't know about >>>> beancount.ops.summarize.balance_by_accounts(), and now that I know it >>>> helped me simplify some code I had around. >>>> >>>> While I'm at it, the code in question compute the average daily balance >>>> in a given account for a given year and currency (which matters for >>>> fiscal reasons in Italy, don't ask...). The core of it looks like this: >>>> >>>> # XXX naive approach: we re-calculate realizations from the beginning of >>>> the ledger >>>> # to each day in the target year. It is acceptably fast, so we didn't >>>> bother making >>>> # it more efficient than this (for now). >>>> for day in tqdm(list(year_days(year))): >>>> inventory = balance_by_account(entries, date=day)[0][account] >>>> amount = inventory.get_currency_units(currency) >>>> balances.append(amount.number) >>>> >>>> As per comment, it is good enough (takes ~20 seconds on my main ledger), >>>> but it's not great. What would be the best way/internal API to implement >>>> this "right", i.e., with a running balance that is updated with daily >>>> batches of entries? >>>> >>>> TIA, >>>> Cheers >>>> -- >>>> Stefano Zacchiroli . z...@upsilon.cc . upsilon.cc/zack _. ^ ._ >>>> Full professor of Computer Science o o o \/|V|\/ >>>> Télécom Paris, Polytechnic Institute of Paris o o o </> <\> >>>> Co-founder & CTO Software Heritage o o o o /\|^|/\ >>>> Former Debian Project Leader & OSI Board Director '" V "' >>>> >>>> -- >>>> 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 >>>> [beancount+unsubscr...@googlegroups.com](mailto:beancount%2bunsubscr...@googlegroups.com). >>>> To view this discussion on the web visit >>>> https://groups.google.com/d/msgid/beancount/20211127101046.tw5yy4x6b4ooxvmp%40upsilon.cc. >> >> -- >> 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 beancount+unsubscr...@googlegroups.com. >> To view this discussion on the web visit >> [https://groups.google.com/d/msgid/beancount/CAK21%2BhMVC7C57ghyWyQwa0oHf6Q4eZP2CG60R3JkhiurxuYk_g%40mail.gmail.com](https://groups.google.com/d/msgid/beancount/CAK21%2BhMVC7C57ghyWyQwa0oHf6Q4eZP2CG60R3JkhiurxuYk_g%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 beancount+unsubscr...@googlegroups.com. > To view this discussion on the web visit > [https://groups.google.com/d/msgid/beancount/CAGQ70ev-66MnJfRcCn1RdADf7o%3D%3DpA7UrYOSvn0s9WVXeOMkAg%40mail.gmail.com](https://groups.google.com/d/msgid/beancount/CAGQ70ev-66MnJfRcCn1RdADf7o%3D%3DpA7UrYOSvn0s9WVXeOMkAg%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 beancount+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/IECIyJ-RVdDOce5Ls15S-M6VyBlrXE629vkXne6gujlo1xMpv_ozuV59jpXOm1EO_OK1cA4AA6GdZgZKXkhQRR7_yt1TPuqi6oSuDsJKHek%3D%40kramerthecat.com.