Balance report and other common reports in v3?

777 views
Skip to first unread message

John Lee

unread,
Mar 25, 2024, 6:51:22 PM3/25/24
to bean...@googlegroups.com
I'm new to beancount (but not to PTA, though rusty). I should have read the docs for v3 first, but I was surprised to see there's no bean-report in v3.

What do people use to get e.g. a balance report? Same question for whatever other reports people regularly find useful?

I see there's beanquery split out into a separate repo. Do people really use that just to get a balance report? (I don't mean to suggest that's bad if that's the way people do it, I just suspect I'm missing something)

fin

unread,
Mar 25, 2024, 6:58:13 PM3/25/24
to bean...@googlegroups.com
a good question and one that will be followed by me. :)

the two reports i use constantly right now are balance (bal)
and networth (netw). i haven't had time to worry about writing
either of those using the query language because i'd like to
finish my conversion efforts before the spring planting season
gets here (i'm not sure i'll get all of it done, but i am
making progress :) ).

that said, perhaps someone else has already written them?


fin

John Lee

unread,
Mar 25, 2024, 7:31:22 PM3/25/24
to bean...@googlegroups.com
On Mon, 25 Mar 2024, at 22:57, fin wrote:
> finish my conversion efforts before the spring planting season
> gets here (i'm not sure i'll get all of it done, but i am
> making progress :) ).

By conversion efforts do you mean you're working on re-writing those reports for v3, for public consumption?

If yes, how are you implementing them? (e.g. in Python, or with beanquery, ...?)

Martin Blais

unread,
Mar 25, 2024, 8:16:58 PM3/25/24
to bean...@googlegroups.com
On Mon, Mar 25, 2024 at 6:58 PM fin <f...@anthive.com> wrote:
John Lee wrote:

> I'm new to beancount (but not to PTA, though rusty).  I should have read the docs for v3 first, but I was surprised to see there's no bean-report in v3.
>
> What do people use to get e.g. a balance report?  Same question for whatever other reports people regularly find useful?

bean-query


 
>
> I see there's beanquery split out into a separate repo.  Do people really use that just to get a balance report?  (I don't mean to suggest that's bad if that's the way people do it, I just suspect I'm missing something)

yes
bean-query has moved to its own repository.
You can also build scripts against the API



  a good question and one that will be followed by me.  :)

  the two reports i use constantly right now are balance (bal)
and networth (netw).  i haven't had time to worry about writing
either of those using the query language because i'd like to
finish my conversion efforts before the spring planting season
gets here (i'm not sure i'll get all of it done, but i am
making progress :) ).

  that said, perhaps someone else has already written them?

balance you can do with a "select account, sum(position) ... group by account".
net worth requires a custom script, especially depending on what you 

here's something I wrote a long while ago:


 


  fin

--
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+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/d4c9dk-06o.ln1%40anthive.com.

Chary Chary

unread,
Mar 26, 2024, 3:33:55 PM3/26/24
to Beancount
I normally use only 2 beanquery reports: 
  •      Balance sheet / net worth - like (shows what I have on a specific date)
  •      P&L / income-statement like - (shows what I earned and what I spent in certain period)

I also convert them to single currency
 Balance sheet / net worth - like   - like report to show net worth on a specific date looks like this:
    query = f"""
    SELECT account, convert(SUM(position),'{currency}',{target_date}) as amount
    where date <= {target_date} AND account ~ 'Assets|Liabilities'
    """
 P&L / income-statement like - (shows what I earned and what I spent in certain period)

    query = f"""
        SELECT account, sum(convert(position, 'EUR', date)) as amount
        WHERE account ~ 'Expenses|Income' and date >= {date_a} and date <= {date_b}
        """

Note, that Balance sheet / net worth - like report uses conversion rate at the date  for which the report is produced.
However the P&L / income-statement - like report I uses conversion rate at the date of transaction.  This is inline with business accounting practices as well as with common sense (at least my one).

This approach leaves one open question, that when we deal with different currencies/commodities, which are converted to each other over the accounting period then the P&L report does not explain the difference in changes in Net worth
 
In another words   net_worth(dateA) - net_worth(dateB)  is not equal to the income_statement(dateA+1, dateB) 
Note: above takes into account, that income is negative in PTA

So, you never really sure why your net worth has changed

This is because unrealized gains are not taken into account. 
This seems to be in general unresolved issue with all the major PTA tools (e.g. see this discussion in Reddit, where someone came with the report, but it works only for his own PTA language)

But this is not an issue with PTA, as all the data is there. The issue is that there is no report to extract these unrealized gain

I am now working of the script, which calculates the unrealized gains and in this case the above formula works always.

Red S

unread,
Mar 26, 2024, 6:46:55 PM3/26/24
to Beancount
Especially with things like PTA, I always wonder what someone's workflow looks like. Personally, I write my own scripts to spit out the 3 or 4 reports I most frequently use exactly the way I want it. This is trivial to do with Beancount since it is (also) a library for processing your journal.

Investor for example, has a few reports that I use to various degrees. See the bottom of the README here for an asset allocation example, which for me is the base report I use, on top of which I have a bit of scripting to figure out net worth, change in net worth across time, what the market did across time, etc.

In addition, I also use Fava's web frontend to both give me a quick balances overview, see net worth over time graphically (although as Chary pointed out, there's no indication of why net worth changed), and chase down answers to quick, one-time questions and such.

Hope that helps.

Martin Blais

unread,
Mar 26, 2024, 9:06:52 PM3/26/24
to bean...@googlegroups.com
FWIW, I feel like I've implemented less than a third of the ideas I've had for reporting, just ran out of time and energy.
It's an area where there could be a lot of fun new outputs.

About an API, I've started to sketch a simplified API in the master branch, so that all the symbols hang off of a "beancount as bn" imprt.
It's not much of a change, but ultimately the goal would be to make script writing more prominent and more commonly used.
--
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+...@googlegroups.com.

fin

unread,
Mar 27, 2024, 12:00:18 AM3/27/24
to bean...@googlegroups.com
no, sorry, i'm in the middle of converting a lot of old
records into transactions for feeding into beancount reports
or something that can give me the answers i want. as i'm
doing this conversion i use the bal report hundreds of times
to check that i'm not introducing errors into my already
existing transactions and balances.


fin

fin

unread,
Mar 28, 2024, 12:22:01 PM3/28/24
to bean...@googlegroups.com
Martin Blais wrote:

thank you! pointers are appreciated, even if i don't have
time now to dig into it very deeply.

fin


> --00000000000024ef3106148535d8
> Content-Type: text/plain; charset="UTF-8"
> Content-Transfer-Encoding: quoted-printable
>
> On Mon, Mar 25, 2024 at 6:58=E2=80=AFPM fin <f...@anthive.com> wrote:
>
>> John Lee wrote:
>>
>> > I'm new to beancount (but not to PTA, though rusty). I should have rea=
> d
>> the docs for v3 first, but I was surprised to see there's no bean-report =
> in
>> v3.
>> >
>> > What do people use to get e.g. a balance report? Same question for
>> whatever other reports people regularly find useful?
>>
>
> bean-query
>
>
>
>
>> >
>> > I see there's beanquery split out into a separate repo. Do people
>> really use that just to get a balance report? (I don't mean to suggest
>> that's bad if that's the way people do it, I just suspect I'm missing
>> something)
>>
>
> yes
> bean-query has moved to its own repository.
> You can also build scripts against the API
>
>
>
>> a good question and one that will be followed by me. :)
>>
>> the two reports i use constantly right now are balance (bal)
>> and networth (netw). i haven't had time to worry about writing
>> either of those using the query language because i'd like to
>> finish my conversion efforts before the spring planting season
>> gets here (i'm not sure i'll get all of it done, but i am
>> making progress :) ).
>>
>> that said, perhaps someone else has already written them?
>>
>
> balance you can do with a "select account, sum(position) ... group by
> account".
> net worth requires a custom script, especially depending on what you
>
> here's something I wrote a long while ago:
> https://github.com/beancount/beanlabs/blob/master/beanlabs/compensation/net=
> -worth-over-time.py
>
>
>
>
>>
>>
>> fin
>>
>> --
>> 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+...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/beancount/d4c9dk-06o.ln1%40anthive.com.
>>
>
> --=20
> 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 e=
> mail to beancount+...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/=
> beancount/CAK21%2BhPZkrWbCTAH2HX3xckL_ogN9i9FxCsg7wjJy3S2wMEj9w%40mail.gmai=
> l.com.
>
> --00000000000024ef3106148535d8
> Content-Type: text/html; charset="UTF-8"
> Content-Transfer-Encoding: quoted-printable
>
><div dir=3D"ltr"><div dir=3D"ltr"><div class=3D"gmail_default" style=3D"fon=
> t-family:arial,sans-serif;font-size:small"><span style=3D"font-family:Arial=
> ,Helvetica,sans-serif">On Mon, Mar 25, 2024 at 6:58=E2=80=AFPM fin &lt;<a h=
> ref=3D"mailto:f...@anthive.com">f...@anthive.com</a>&gt; wrote:</span><br></d=
> iv></div><div class=3D"gmail_quote"><blockquote class=3D"gmail_quote" style=
>=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding=
> -left:1ex">John Lee wrote:<br>
><br>
> &gt; I&#39;m new to beancount (but not to PTA, though rusty).=C2=A0 I shoul=
> d have read the docs for v3 first, but I was surprised to see there&#39;s n=
> o bean-report in v3.<br>
> &gt;<br>
> &gt; What do people use to get e.g. a balance report?=C2=A0 Same question f=
> or whatever other reports people regularly find useful?<br></blockquote><di=
> v><br></div><div><div class=3D"gmail_default" style=3D"font-family:arial,sa=
> ns-serif;font-size:small">bean-query</div><div class=3D"gmail_default" styl=
> e=3D"font-family:arial,sans-serif;font-size:small"><br></div><br></div><div=
>>=C2=A0</div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px =
> 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
> &gt;<br>
> &gt; I see there&#39;s beanquery split out into a separate repo.=C2=A0 Do p=
> eople really use that just to get a balance report?=C2=A0 (I don&#39;t mean=
> to suggest that&#39;s bad if that&#39;s the way people do it, I just suspe=
> ct I&#39;m missing something)<br></blockquote><div><br></div><div class=3D"=
> gmail_default" style=3D"font-family:arial,sans-serif;font-size:small">yes</=
> div><div class=3D"gmail_default" style=3D"font-family:arial,sans-serif;font=
> -size:small">bean-query has moved to its own repository.</div><div class=3D=
> "gmail_default" style=3D"font-family:arial,sans-serif;font-size:small">You =
> can also build scripts against the API</div><div class=3D"gmail_default" st=
> yle=3D"font-family:arial,sans-serif;font-size:small"><br></div><div class=
>=3D"gmail_default" style=3D"font-family:arial,sans-serif;font-size:small"><=
> br></div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8e=
> x;border-left:1px solid rgb(204,204,204);padding-left:1ex">
><br>
>=C2=A0 a good question and one that will be followed by me.=C2=A0 :)<br>
><br>
>=C2=A0 the two reports i use constantly right now are balance (bal)<br>
> and networth (netw).=C2=A0 i haven&#39;t had time to worry about writing<br=
>>
> either of those using the query language because i&#39;d like to<br>
> finish my conversion efforts before the spring planting season<br>
> gets here (i&#39;m not sure i&#39;ll get all of it done, but i am<br>
> making progress :) ).<br>
><br>
>=C2=A0 that said, perhaps someone else has already written them?<br></block=
> quote><div><br></div><div><div class=3D"gmail_default" style=3D"font-family=
>:arial,sans-serif;font-size:small">balance you can do with a &quot;select a=
> ccount, sum(position) ... group by account&quot;.</div><div class=3D"gmail_=
> default" style=3D"font-family:arial,sans-serif;font-size:small">net worth r=
> equires a custom script, especially depending on what you=C2=A0</div><div c=
> lass=3D"gmail_default" style=3D"font-family:arial,sans-serif;font-size:smal=
> l"><br></div><div class=3D"gmail_default" style=3D"font-family:arial,sans-s=
> erif;font-size:small">here&#39;s something I wrote a long while ago:</div><=
> div class=3D"gmail_default" style=3D"font-family:arial,sans-serif;font-size=
>:small"><a href=3D"https://github.com/beancount/beanlabs/blob/master/beanla=
> bs/compensation/net-worth-over-time.py">https://github.com/beancount/beanla=
> bs/blob/master/beanlabs/compensation/net-worth-over-time.py</a></div><br></=
> div><div><br></div><div>=C2=A0</div><blockquote class=3D"gmail_quote" style=
>=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding=
> -left:1ex">
><br>
><br>
>=C2=A0 fin<br>
><br>
> -- <br>
> You received this message because you are subscribed to the Google Groups &=
> quot;Beancount&quot; group.<br>
> To unsubscribe from this group and stop receiving emails from it, send an e=
> mail to <a href=3D"mailto:beancount%2Bunsu...@googlegroups.com" target=
>=3D"_blank">beancount+...@googlegroups.com</a>.<br>
> To view this discussion on the web visit <a href=3D"https://groups.google.c=
> om/d/msgid/beancount/d4c9dk-06o.ln1%40anthive.com" rel=3D"noreferrer" targe=
> t=3D"_blank">https://groups.google.com/d/msgid/beancount/d4c9dk-06o.ln1%40a=
> nthive.com</a>.<br>
></blockquote></div></div>
>
><p></p>
>
> -- <br />
> You received this message because you are subscribed to the Google Groups &=
> quot;Beancount&quot; group.<br />
> To unsubscribe from this group and stop receiving emails from it, send an e=
> mail to <a href=3D"mailto:beancount+...@googlegroups.com">beancount=
> +unsub...@googlegroups.com</a>.<br />
> To view this discussion on the web visit <a href=3D"https://groups.google.c=
> om/d/msgid/beancount/CAK21%2BhPZkrWbCTAH2HX3xckL_ogN9i9FxCsg7wjJy3S2wMEj9w%=
> 40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">https://groups.goo=
> gle.com/d/msgid/beancount/CAK21%2BhPZkrWbCTAH2HX3xckL_ogN9i9FxCsg7wjJy3S2wM=
> Ej9w%40mail.gmail.com</a>.<br />
>
> --00000000000024ef3106148535d8--
>

Simon Michael

unread,
Apr 8, 2024, 7:02:31 PM4/8/24
to bean...@googlegroups.com
On 2024-03-26 09:33, Chary Chary wrote:
> This is because unrealized gains are not taken into account.
> This seems to be in general unresolved issue with all the major PTA
> tools (e.g. see this discussion
> <https://www.reddit.com/r/plaintextaccounting/comments/19c1xv7/gainstrack_a_more_accessible_plaintextaccounting/> in Reddit, where someone came with the report, but it works only for his own PTA language)

hledger balance --gain is such a report I think ?

https://hledger.org/hledger.html#balance-report-types

Reply all
Reply to author
Forward
0 new messages