Re: How to get last day of month in BQL

2024-03-17 Thread Andreas Gerstmayr

Hi!

I'm trying to get a report of the market value of my assets at the end 
of each month:


     SELECT year, month,
     CONVERT(LAST(balance),   'USD', DATE_ADD(DATE(year, month+1, 
1), -1)) AS market_value,
     CONVERT(COST(LAST(balance)), 'USD', DATE_ADD(DATE(year, month+1, 
1), -1)) AS book_value

     WHERE account ~ '^Assets:'
     GROUP BY year, month


It does work with the new beanquery when using FIRST():

SELECT year, month,
CONVERT(LAST(balance),   'USD', DATE_ADD(DATE(FIRST(year), 
FIRST(month)+1, 1), -1)) AS market_value,
CONVERT(COST(LAST(balance)), 'USD', DATE_ADD(DATE(FIRST(year), 
FIRST(month)+1, 1), -1)) AS book_value

WHERE account ~ '^Assets:'
GROUP BY year, month

However there's an issue in December, as month+1 doesn't work if month 
is December :|


I think a new BQL function is required to support this use case (happy 
to provide a PR).


--
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/e8011f5d-9c50-4ea2-8924-a0c1f2e4e5e1%40gerstmayr.me.


How to get last day of month in BQL

2024-03-17 Thread Andreas Gerstmayr

Hi!

I'm trying to get a report of the market value of my assets at the end 
of each month:


SELECT year, month,
CONVERT(LAST(balance),   'USD', DATE_ADD(DATE(year, month+1, 
1), -1)) AS market_value,
CONVERT(COST(LAST(balance)), 'USD', DATE_ADD(DATE(year, month+1, 
1), -1)) AS book_value

WHERE account ~ '^Assets:'
GROUP BY year, month

This fails with

Syntax error near '1'

Replacing "month+1" with "month" (as an experiment, it won't produce 
correct results), I'm getting


ERROR: Mixed aggregates and non-aggregates are not allowed.

I think technically this should work, as year and month are in the GROUP 
BY clause.



I came up with the following sketchy workaround:

SELECT year, month,
CONVERT(LAST(balance),   'USD', 
DATE_ADD(YMONTH(DATE_ADD(YMONTH(FIRST(date)), 31)), -1)) AS market_value,
CONVERT(COST(LAST(balance)), 'USD', 
DATE_ADD(YMONTH(DATE_ADD(YMONTH(FIRST(date)), 31)), -1)) AS book_value

WHERE account ~ '^Assets:'
GROUP BY year, month

It uses YMONTH() to get the 1st of the given month and year, adds 31 
days to get the next month, runs YMONTH() again to get the 1st of the 
next month, and subtracts one day.
It won't work in all cases however, for example if the first transaction 
of January is on January 31, because adding 31 days "skips over" February.


Is there a way to get the last day of a month with the current 
beancount.query or the new beanquery module, and if not, can I add one? :)

MySQL for example has a LAST_DAY() function.


Cheers,
Andreas

--
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/b56de533-7eb7-42c6-a25f-fe5cadbe25b4%40gerstmayr.me.


Re: beancount > prometheus > grafana

2023-09-14 Thread Andreas Gerstmayr

Am 12.09.23 um 04:52 schrieb Josh D:
Is anyone utilizing a Prometheus exporter to track, store, and graph 
your financial metrics in Grafana? It would be interesting to (1) store 
/ track them over time, (2) do all sort of maths, like savings rate, 
runway (how long can you last without income), how long it will take to 
pay off your mortgage, etc. - as a dashboard.


I don't see the value of duplicating the financial data from a beancount 
ledger (which is already a database, and supports BQL queries) to 
Prometheus (a time-series database).


Grafana dashboards would definitely be a cool idea though.
I think it would be nice to have a Grafana data source, which can run 
BQL queries against a Beancount ledger. It could work with either:

* a custom Grafana backend datasource [1]
* some daemon (standalone or Fava extension) exposing a HTTP API which 
accepts BQL queries and returns Grafana Data frames [2], then we could 
use some already existing general-purpose data source, e.g. [3].



For my personal dashboards I wanted something integrated in Fava, 
therefore I created a little Fava extension fava-dashboards [4], which 
renders charts from BQL queries. Not as fancy as Grafana, but simple to 
implement and extensible.



[1] 
https://grafana.com/docs/grafana/latest/developers/plugins/create-a-grafana-plugin/develop-a-plugin/build-a-data-source-backend-plugin/
[2] 
https://grafana.com/docs/grafana/latest/developers/plugins/introduction-to-plugin-development/data-frames/

[3] https://grafana.com/grafana/plugins/simpod-json-datasource/
[4] https://github.com/andreasgerstmayr/fava-dashboards

Cheers,
Andreas



Josh

--
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/a5517d33-09a9-4be5-a3fe-7315b991cff7n%40googlegroups.com .


--
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/2b3b5f63-5abb-4fab-98f4-32c7747084aa%40gerstmayr.me.


Re: Portfolio Returns in Fava (based on beangrow)

2023-09-10 Thread Andreas Gerstmayr

Hi Pablo,

Am 04.09.23 um 12:45 schrieb Pablo Osers:

Hello,

Thanks Andreas, still don't think this is who a whole investment 
portfolio IRR/Performance should be tracked.


Let's say I want to track the performance of my Interactive Brokers 
Portfolio [Assets:Investments:IBKR], what I would expect as cash 
flows/date pairs to be used for IRR calculations are only based on money 
inflows/outflows of this whole portfolio, not single money [buy/sell] of 
each commodity within the portfolio.


Ok, now I understand.
You're right, I think this is not possible right now.


Cheers,
Andreas



Please let me know if I'm making myself clear

Thanks
Pablo

On Sun, Aug 20, 2023 at 11:51 PM Andreas Gerstmayr <mailto:andr...@gerstmayr.me>> wrote:


Hi Pablo,

Am 19.08.23 um 09:37 schrieb Pablo Osers:
 > Great news and many thanks!
 >
 > Re asking a question from before, is there a way to create a report
 > based on the overall performance of a portfolio, meaning, taking
into
 > account only incoming/outgoing cashflows for a specific set of
accounts,
 > instead of getting a per commodity report.
 >
 > Example:
 >
 >   * Assets:Investments:IBKR
 >   * Assets:Investments:IBKR:Cash
 >   * Assets:Investments:IBKR:IWDA
 >   * Assets:Investments:IBKR:CSPX

If all your investments have the same cost currency, adding a new group
in your beangrow config should work:

group {
    name: "Entire Portfolio"
    investment: "Assets:Investments:IBKR:*"
}


Cheers,
Andreas


 >
 > So getting a report of the performance of the
 > account Assets:Investments:IBKR, meaning, taking
 > deposited/withdrawal cashflows and current value of all its children
 > (commodity+cash) accounts
 >
 > I haven't been able to reproduce such report in beangrow
 >
 > Many thanks
 > Pablo
 >
 > On Wednesday, August 16, 2023 at 11:38:45 PM UTC+2
and...@gerstmayr.me <mailto:and...@gerstmayr.me>
 > wrote:
 >
 >     Hi Stefano,
 >
 >     Am 16.08.23 um 17:12 schrieb Stefano Mihai Canta:
 >      > Thank you, Andreas!
 >      >
 >      > I am running a small example, how do I get reinvested
dividends
 >     to show
 >      > up in the charts? If I split up the dividend transaction
so that the
 >      > dividend amount goes into the cash account first and then from
 >     the cash
 >      > account to the commodity, I get the dividend amount to
show up in
 >     the
 >      > beangrow chart, but not when the dividend is reinvested
directly
 >     into
 >      > the commodity.
 >      >
 >      > 2023-06-23 * "reinvest" "[VTSAX] Vanguard Total Stock Market
 >     Index Fund"
 >      >   Assets:Investments:Retirement:VTSAX  0.878 VTSAX
 >     {105.48974943052393 USD}
 >      >   Income:Retirement:Investments:VTSAX:Dividend  -92.62 USD
 >      >
 >      > vs
 >      >
 >      > 2023-06-23 * "reinvest" "[VTSAX] Vanguard Total Stock Market
 >     Index Fund"
 >      >   Assets:Investments:Retirement:VTSAX  0.878 VTSAX
 >     {105.48974943052393 USD}
 >      >   Assets:Investments:Retirement:Cash -92.62 USD
 >      >
 >      > 2023-06-23 * "reinvest" "[VTSAX] Vanguard Total Stock Market
 >     Index Fund"
 >      >   Assets:Investments:Retirement:Cash 92.62 USD
 >      >   Income:Retirement:Investments:VTSAX:Dividend  -92.62 USD
 >      >
 >      > Thoughts?
 >
 >     I think the second way is the correct way. If it is a
distributing ETF,
 >     the dividends will be paid out to your cash account first,
and then you
 >     have to create a new transaction to buy more shares.
 >
 >     You can use
 >
 >     1980-05-12 custom "fava-extension" "fava_portfolio_returns" "{
 >     'beangrow_config': 'beangrow.pbtxt',
 >     'beangrow_debug_dir': 'debug',
 >     }"
 >
 >     to instruct beangrow to write debug files to the debug folder.
 >

https://beancount.github.io/docs/calculating_portolio_returns.html#handling-transactions-using-the-signature
 
<https://beancount.github.io/docs/calculating_portolio_returns.html#handling-transactions-using-the-signature>
 
<https://beancount.github.io/docs/calculating_portolio_returns.html#handling-transactions-using-the-signature
 
<https://beancount.github.io/docs/calculating_portolio_returns.html#handling-tr

Re: Portfolio Returns in Fava (based on beangrow)

2023-09-03 Thread Andreas Gerstmayr

Am 01.09.23 um 03:08 schrieb cha...@gmail.com:
This is more of a beangrow question, but is there a calculation of IRR 
or annualized yield we can surface? As far as I understand it, the 
"Yield" that is shown in the overview is simply (gain / investment 
amount), which doesn't account for time invested. Would it be possible 
to surface an IRR or CAGR for your actual investments for an easy 
group-to-group comparison?


Yep, the Yield in the overview page is gain/investment. I just added a 
new column "IRR" to the overview table a few hours ago.


The returns as shown in the individual reports are the total/annualized 
IRR. I've updated the heading to make this clear.



Cheers,
Andreas


On Sunday, August 20, 2023 at 5:51:17 PM UTC-4 and...@gerstmayr.me wrote:

Hi Pablo,

Am 19.08.23 um 09:37 schrieb Pablo Osers:
 > Great news and many thanks!
 >
 > Re asking a question from before, is there a way to create a report
 > based on the overall performance of a portfolio, meaning, taking
into
 > account only incoming/outgoing cashflows for a specific set of
accounts,
 > instead of getting a per commodity report.
 >
 > Example:
 >
 > * Assets:Investments:IBKR
 > * Assets:Investments:IBKR:Cash
 > * Assets:Investments:IBKR:IWDA
 > * Assets:Investments:IBKR:CSPX

If all your investments have the same cost currency, adding a new group
in your beangrow config should work:

group {
name: "Entire Portfolio"
investment: "Assets:Investments:IBKR:*"
}


Cheers,
Andreas


 >
 > So getting a report of the performance of the
 > account Assets:Investments:IBKR, meaning, taking
 > deposited/withdrawal cashflows and current value of all its children
 > (commodity+cash) accounts
 >
 > I haven't been able to reproduce such report in beangrow
 >
 > Many thanks
 > Pablo
 >
 > On Wednesday, August 16, 2023 at 11:38:45 PM UTC+2
and...@gerstmayr.me
 > wrote:
 >
 > Hi Stefano,
 >
 > Am 16.08.23 um 17:12 schrieb Stefano Mihai Canta:
 > > Thank you, Andreas!
 > >
 > > I am running a small example, how do I get reinvested dividends
 > to show
 > > up in the charts? If I split up the dividend transaction so
that the
 > > dividend amount goes into the cash account first and then from
 > the cash
 > > account to the commodity, I get the dividend amount to show up in
 > the
 > > beangrow chart, but not when the dividend is reinvested directly
 > into
 > > the commodity.
 > >
 > > 2023-06-23 * "reinvest" "[VTSAX] Vanguard Total Stock Market
 > Index Fund"
 > >   Assets:Investments:Retirement:VTSAX  0.878 VTSAX
 > {105.48974943052393 USD}
 > >   Income:Retirement:Investments:VTSAX:Dividend  -92.62 USD
 > >
 > > vs
 > >
 > > 2023-06-23 * "reinvest" "[VTSAX] Vanguard Total Stock Market
 > Index Fund"
 > >   Assets:Investments:Retirement:VTSAX  0.878 VTSAX
 > {105.48974943052393 USD}
 > >   Assets:Investments:Retirement:Cash -92.62 USD
 > >
 > > 2023-06-23 * "reinvest" "[VTSAX] Vanguard Total Stock Market
 > Index Fund"
 > >   Assets:Investments:Retirement:Cash 92.62 USD
 > >   Income:Retirement:Investments:VTSAX:Dividend  -92.62 USD
 > >
 > > Thoughts?
 >
 > I think the second way is the correct way. If it is a
distributing ETF,
 > the dividends will be paid out to your cash account first, and
then you
 > have to create a new transaction to buy more shares.
 >
 > You can use
 >
 > 1980-05-12 custom "fava-extension" "fava_portfolio_returns" "{
 > 'beangrow_config': 'beangrow.pbtxt',
 > 'beangrow_debug_dir': 'debug',
 > }"
 >
 > to instruct beangrow to write debug files to the debug folder.
 >

https://beancount.github.io/docs/calculating_portolio_returns.html#handling-transactions-using-the-signature
 
<https://beancount.github.io/docs/calculating_portolio_returns.html#handling-transactions-using-the-signature>
 
<https://beancount.github.io/docs/calculating_portolio_returns.html#handling-transactions-using-the-signature
 
<https://beancount.github.io/docs/calculating_portolio_returns.html#handling-transactions-using-the-signature>>
 > explains how beangrow is categorizing and handling transactions.
 >
 >
 > Cheers,
 > Andreas
 >
 > >
 > > Stefano
 > >

Re: Portfolio Returns in Fava (based on beangrow)

2023-08-20 Thread Andreas Gerstmayr

Hi Pablo,

Am 19.08.23 um 09:37 schrieb Pablo Osers:

Great news and many thanks!

Re asking a question from before, is there a way to create a report 
based on the overall performance of a portfolio, meaning, taking into 
account only incoming/outgoing cashflows for a specific set of accounts, 
instead of getting a per commodity report.


Example:

  * Assets:Investments:IBKR
  * Assets:Investments:IBKR:Cash
  * Assets:Investments:IBKR:IWDA
  * Assets:Investments:IBKR:CSPX


If all your investments have the same cost currency, adding a new group 
in your beangrow config should work:


group {
  name: "Entire Portfolio"
  investment: "Assets:Investments:IBKR:*"
}


Cheers,
Andreas




So getting a report of the performance of the 
account Assets:Investments:IBKR, meaning, taking 
deposited/withdrawal cashflows and current value of all its children 
(commodity+cash) accounts


I haven't been able to reproduce such report in beangrow

Many thanks
Pablo

On Wednesday, August 16, 2023 at 11:38:45 PM UTC+2 and...@gerstmayr.me 
wrote:


Hi Stefano,

Am 16.08.23 um 17:12 schrieb Stefano Mihai Canta:
 > Thank you, Andreas!
 >
 > I am running a small example, how do I get reinvested dividends
to show
 > up in the charts? If I split up the dividend transaction so that the
 > dividend amount goes into the cash account first and then from
the cash
 > account to the commodity, I get the dividend amount to show up in
the
 > beangrow chart, but not when the dividend is reinvested directly
into
 > the commodity.
 >
 > 2023-06-23 * "reinvest" "[VTSAX] Vanguard Total Stock Market
Index Fund"
 >   Assets:Investments:Retirement:VTSAX  0.878 VTSAX
{105.48974943052393 USD}
 >   Income:Retirement:Investments:VTSAX:Dividend  -92.62 USD
 >
 > vs
 >
 > 2023-06-23 * "reinvest" "[VTSAX] Vanguard Total Stock Market
Index Fund"
 >   Assets:Investments:Retirement:VTSAX  0.878 VTSAX
{105.48974943052393 USD}
 >   Assets:Investments:Retirement:Cash -92.62 USD
 >
 > 2023-06-23 * "reinvest" "[VTSAX] Vanguard Total Stock Market
Index Fund"
 >   Assets:Investments:Retirement:Cash 92.62 USD
 >   Income:Retirement:Investments:VTSAX:Dividend  -92.62 USD
 >
 > Thoughts?

I think the second way is the correct way. If it is a distributing ETF,
the dividends will be paid out to your cash account first, and then you
have to create a new transaction to buy more shares.

You can use

1980-05-12 custom "fava-extension" "fava_portfolio_returns" "{
'beangrow_config': 'beangrow.pbtxt',
'beangrow_debug_dir': 'debug',
}"

to instruct beangrow to write debug files to the debug folder.

https://beancount.github.io/docs/calculating_portolio_returns.html#handling-transactions-using-the-signature
 
<https://beancount.github.io/docs/calculating_portolio_returns.html#handling-transactions-using-the-signature>
explains how beangrow is categorizing and handling transactions.


Cheers,
Andreas

 >
 > Stefano
 >
 > On Sat, Aug 12, 2023 at 11:07 AM Andreas Gerstmayr
 <mailto:and...@gerstmayr.me>> wrote:
 >
 > Hi all,
 >
 > I developed a Fava extension which integrates portfolio reports
 > generated by the excellent beangrow library [1] in Fava:
 > https://github.com/andreasgerstmayr/fava-portfolio-returns
<https://github.com/andreasgerstmayr/fava-portfolio-returns>
 > <https://github.com/andreasgerstmayr/fava-portfolio-returns
<https://github.com/andreasgerstmayr/fava-portfolio-returns>>
 >
 > Currently the report is almost identical to the one generated by
 > beangrow, with an additional Profit and Loss chart (market value -
 > spent
 > amount over time) and some interactivity (mouse tooltips etc.).
 >
 > Ideally I'd like to keep all/most calculations in beangrow, and put
 > only
 > the report/frontend code in the Fava extension. My goal is to
 > explicitly
 > not reinvent the wheel of computing the portfolio returns :).
 >
 >
 > [1] https://github.com/beancount/beangrow
<https://github.com/beancount/beangrow>
 > <https://github.com/beancount/beangrow
<https://github.com/beancount/beangrow>>
 >
 > Cheers,
 > Andreas
 >
 > --
 > 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
 > <mailto:beancount%

Re: Portfolio Returns in Fava (based on beangrow)

2023-08-16 Thread Andreas Gerstmayr

Hi Stefano,

Am 16.08.23 um 17:12 schrieb Stefano Mihai Canta:

Thank you, Andreas!

I am running a small example, how do I get reinvested dividends to show 
up in the charts? If I split up the dividend transaction so that the 
dividend amount goes into the cash account first and then from the cash 
account to the commodity, I get the dividend amount to show up in the 
beangrow chart, but not when the dividend is reinvested directly into 
the commodity.


2023-06-23 * "reinvest" "[VTSAX] Vanguard Total Stock Market Index Fund"
   Assets:Investments:Retirement:VTSAX  0.878 VTSAX {105.48974943052393 USD}
   Income:Retirement:Investments:VTSAX:Dividend  -92.62 USD

vs

2023-06-23 * "reinvest" "[VTSAX] Vanguard Total Stock Market Index Fund"
   Assets:Investments:Retirement:VTSAX  0.878 VTSAX {105.48974943052393 USD}
   Assets:Investments:Retirement:Cash -92.62 USD

2023-06-23 * "reinvest" "[VTSAX] Vanguard Total Stock Market Index Fund"
   Assets:Investments:Retirement:Cash 92.62 USD
   Income:Retirement:Investments:VTSAX:Dividend  -92.62 USD

Thoughts?


I think the second way is the correct way. If it is a distributing ETF, 
the dividends will be paid out to your cash account first, and then you 
have to create a new transaction to buy more shares.


You can use

1980-05-12 custom "fava-extension" "fava_portfolio_returns" "{
  'beangrow_config': 'beangrow.pbtxt',
  'beangrow_debug_dir': 'debug',
}"

to instruct beangrow to write debug files to the debug folder. 
https://beancount.github.io/docs/calculating_portolio_returns.html#handling-transactions-using-the-signature 
explains how beangrow is categorizing and handling transactions.



Cheers,
Andreas



Stefano

On Sat, Aug 12, 2023 at 11:07 AM Andreas Gerstmayr <mailto:andr...@gerstmayr.me>> wrote:


Hi all,

I developed a Fava extension which integrates portfolio reports
generated by the excellent beangrow library [1] in Fava:
https://github.com/andreasgerstmayr/fava-portfolio-returns
<https://github.com/andreasgerstmayr/fava-portfolio-returns>

Currently the report is almost identical to the one generated by
beangrow, with an additional Profit and Loss chart (market value -
spent
amount over time) and some interactivity (mouse tooltips etc.).

Ideally I'd like to keep all/most calculations in beangrow, and put
only
the report/frontend code in the Fava extension. My goal is to
explicitly
not reinvent the wheel of computing the portfolio returns :).


[1] https://github.com/beancount/beangrow
<https://github.com/beancount/beangrow>

Cheers,
Andreas

-- 
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/d43aec17-b973-6a00-8c42-f592afd85f45%40gerstmayr.me
 
<https://groups.google.com/d/msgid/beancount/d43aec17-b973-6a00-8c42-f592afd85f45%40gerstmayr.me>.

--
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+unsubscr...@googlegroups.com>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAMzm8_q3DYvKq%3DXYZyWjf-kwf7%3D58JVnK1%2B%2B_%2B%3DKJFjYjd7qrw%40mail.gmail.com <https://groups.google.com/d/msgid/beancount/CAMzm8_q3DYvKq%3DXYZyWjf-kwf7%3D58JVnK1%2B%2B_%2B%3DKJFjYjd7qrw%40mail.gmail.com?utm_medium=email_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/fa01017b-910b-fd28-038b-0c1cac57b1be%40gerstmayr.me.


Re: Portfolio Returns in Fava (based on beangrow)

2023-08-16 Thread Andreas Gerstmayr

Am 15.08.23 um 04:49 schrieb Red S:
Same here: this is the one important missing piece I've wanted to add to 
Fava Investor for a while. Very glad to see it here, thank you Andreas!


Glad that people are interested in this :)

Couple of questions: is it possible to supply and display multiple 
configs?


Currently not, what's your use case? I find the groups in beangrow quite 
flexible (e.g. they also support globs, etc.), could this be solved with 
that feature?



Is it easy to display custom charts?


No, custom charts are not supported. How do you envision this feature, 
i.e. how would the chart be rendered and based on what data structures?


I wrote another plugin for rendering custom charts (Apache ECharts) 
based on beancount query results: 
https://github.com/andreasgerstmayr/fava-dashboards - but there's 
currently no interface to get data from beangrow.



Cheers,
Andreas




On Saturday, August 12, 2023 at 3:19:17 PM UTC-7 flyaw...@gmail.com wrote:

It is so great to hear this. I am planning to write the Fava
extension by myself. But it seems I don’t need to anymore...
Thanks Andreas!



Yichu Zhou
flyaw...@gmail.com





On Aug 12, 2023, at 09:07, Andreas Gerstmayr 
wrote:

Hi all,

I developed a Fava extension which integrates portfolio reports
generated by the excellent beangrow library [1] in Fava:
https://github.com/andreasgerstmayr/fava-portfolio-returns
<https://github.com/andreasgerstmayr/fava-portfolio-returns>

Currently the report is almost identical to the one generated by
beangrow, with an additional Profit and Loss chart (market value -
spent amount over time) and some interactivity (mouse tooltips etc.).

Ideally I'd like to keep all/most calculations in beangrow, and
put only the report/frontend code in the Fava extension. My goal
is to explicitly not reinvent the wheel of computing the portfolio
returns :).


[1] https://github.com/beancount/beangrow
<https://github.com/beancount/beangrow>

Cheers,
Andreas

-- 
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/d43aec17-b973-6a00-8c42-f592afd85f45%40gerstmayr.me
 
<https://groups.google.com/d/msgid/beancount/d43aec17-b973-6a00-8c42-f592afd85f45%40gerstmayr.me>.


--
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+unsubscr...@googlegroups.com>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/a03aef17-d8da-4323-b61d-4da473510da5n%40googlegroups.com <https://groups.google.com/d/msgid/beancount/a03aef17-d8da-4323-b61d-4da473510da5n%40googlegroups.com?utm_medium=email_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/3d4770f3-0d36-5fdc-0f51-6522a4f6c94d%40gerstmayr.me.


Portfolio Returns in Fava (based on beangrow)

2023-08-12 Thread Andreas Gerstmayr

Hi all,

I developed a Fava extension which integrates portfolio reports 
generated by the excellent beangrow library [1] in Fava:

https://github.com/andreasgerstmayr/fava-portfolio-returns

Currently the report is almost identical to the one generated by 
beangrow, with an additional Profit and Loss chart (market value - spent 
amount over time) and some interactivity (mouse tooltips etc.).


Ideally I'd like to keep all/most calculations in beangrow, and put only 
the report/frontend code in the Fava extension. My goal is to explicitly 
not reinvent the wheel of computing the portfolio returns :).



[1] https://github.com/beancount/beangrow

Cheers,
Andreas

--
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/d43aec17-b973-6a00-8c42-f592afd85f45%40gerstmayr.me.


Re: Custom dashboards in Fava

2023-03-20 Thread Andreas Gerstmayr

Hi Fin,

Am 18.03.23 um 19:05 schrieb fin:

Andreas Gerstmayr wrote:

Hi,


   hello,

   i hope it uses the environment variable BEAN_ROOT if that is
defined?


The plugin currently doesn't use this environment variable. I looked at 
the beancount and fava sources, and neither reads or sets this 
environment variable.


Can you explain your use case, how do you start fava?

You can also specify the path to the dashboards.yaml file directly if 
the default path doesn't work for your use case:


2010-01-01 custom "fava-extension" "fava_dashboards" "{
'config': '/path/to/dashboards.yaml'
}"


Cheers,
Andreas




   fin



Am 16.03.23 um 10:07 schrieb Josh D:

Looks great! Where should the dashboards.yaml file be saved for the
plugin to locate it?


by default the plugin looks for a dashboards.yaml file in the same
directory where Fava was started, for example if you run "fava
personal.beancount", the dashboards.yaml file should be in the same
directory as personal.beancount.

Thanks for the question, I forgot to describe this part in the README.
I've added a new paragraph about this now, and also show how to
customize the location of the configuration file.

Great that there's interest for this :)
I think with the current plugin there are tons of possibilities for
customization (i.e. additional (e)charts, or HTML panels), I'd be happy
to collect and share various dashboards in the repo.


Cheers,
Andreas



On Thursday, March 16, 2023 at 1:40:59 AM UTC+8 Red S wrote:

 This is awesome! Been wanting to do this for a while, glad to see it
 done well!

 Looks nice and simple, and thanks for the great documentation.
 On Sunday, March 12, 2023 at 4:03:53 PM UTC-7 and...@gerstmayr.me wrote:

 Hi everyone,

 I've written a new Fava extension which may be of interest to
 some of
 you interested in additional Fava charts.

 It allows creating custom dashboards in Fava, combining Beancount
 queries and Apache ECharts.
 The dashboards are defined in a `dashboards.yaml` configuration
 file,
 where each panel includes one or multiple Beancount queries
 and a `script` field, which transforms the Beancount query
 results into
 a valid ECharts configuration.

 Example dashboards, screenshots and installation instructions
 are in the
 project repository:
 https://github.com/andreasgerstmayr/fava-dashboards
 <https://github.com/andreasgerstmayr/fava-dashboards>

 A blog post explaining the basic structure of the Fava extension:
 
https://www.andreasgerstmayr.at/2023/03/12/dashboards-with-beancount-and-fava.html 
<https://www.andreasgerstmayr.at/2023/03/12/dashboards-with-beancount-and-fava.html>

 P.S.: I'm not 100% sure if I got all the queries in the example
 dashboards right, especially the portfolio ones.
 Please let me know if you find any issues or have suggestions!


 Cheers,
 Andreas

--
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+unsubscr...@googlegroups.com>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/beancount/76b0d7da-5315-4d46-92ab-6bb32b13bea6n%40googlegroups.com
 
<https://groups.google.com/d/msgid/beancount/76b0d7da-5315-4d46-92ab-6bb32b13bea6n%40googlegroups.com?utm_medium=email_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/73b83f61-2a90-807f-d732-bf9b2481ab79%40gerstmayr.me.


Re: Custom dashboards in Fava

2023-03-16 Thread Andreas Gerstmayr

Hi,

Am 16.03.23 um 10:07 schrieb Josh D:
Looks great! Where should the dashboards.yaml file be saved for the 
plugin to locate it?


by default the plugin looks for a dashboards.yaml file in the same 
directory where Fava was started, for example if you run "fava 
personal.beancount", the dashboards.yaml file should be in the same 
directory as personal.beancount.


Thanks for the question, I forgot to describe this part in the README. 
I've added a new paragraph about this now, and also show how to 
customize the location of the configuration file.


Great that there's interest for this :)
I think with the current plugin there are tons of possibilities for 
customization (i.e. additional (e)charts, or HTML panels), I'd be happy 
to collect and share various dashboards in the repo.



Cheers,
Andreas



On Thursday, March 16, 2023 at 1:40:59 AM UTC+8 Red S wrote:

This is awesome! Been wanting to do this for a while, glad to see it
done well!

Looks nice and simple, and thanks for the great documentation.
On Sunday, March 12, 2023 at 4:03:53 PM UTC-7 and...@gerstmayr.me wrote:

Hi everyone,

I've written a new Fava extension which may be of interest to
some of
you interested in additional Fava charts.

It allows creating custom dashboards in Fava, combining Beancount
queries and Apache ECharts.
The dashboards are defined in a `dashboards.yaml` configuration
file,
where each panel includes one or multiple Beancount queries
and a `script` field, which transforms the Beancount query
results into
a valid ECharts configuration.

Example dashboards, screenshots and installation instructions
are in the
project repository:
https://github.com/andreasgerstmayr/fava-dashboards


A blog post explaining the basic structure of the Fava extension:

https://www.andreasgerstmayr.at/2023/03/12/dashboards-with-beancount-and-fava.html 


P.S.: I'm not 100% sure if I got all the queries in the example
dashboards right, especially the portfolio ones.
Please let me know if you find any issues or have suggestions!


Cheers,
Andreas

--
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/76b0d7da-5315-4d46-92ab-6bb32b13bea6n%40googlegroups.com .


--
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/7f570862-e8a0-4274-007b-09142f134864%40gerstmayr.me.


Custom dashboards in Fava

2023-03-12 Thread Andreas Gerstmayr

Hi everyone,

I've written a new Fava extension which may be of interest to some of 
you interested in additional Fava charts.


It allows creating custom dashboards in Fava, combining Beancount 
queries and Apache ECharts.
The dashboards are defined in a `dashboards.yaml` configuration file, 
where each panel includes one or multiple Beancount queries
and a `script` field, which transforms the Beancount query results into 
a valid ECharts configuration.


Example dashboards, screenshots and installation instructions are in the 
project repository:

https://github.com/andreasgerstmayr/fava-dashboards

A blog post explaining the basic structure of the Fava extension:
https://www.andreasgerstmayr.at/2023/03/12/dashboards-with-beancount-and-fava.html

P.S.: I'm not 100% sure if I got all the queries in the example 
dashboards right, especially the portfolio ones.

Please let me know if you find any issues or have suggestions!


Cheers,
Andreas

--
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/eaa5dc57-eb24-7f0d-60fd-dc3f4f05266b%40gerstmayr.me.


Re: Loss reported as profit

2021-02-28 Thread Andreas Gerstmayr

Hi Tono,

the change was merged in master yesterday. You can install the latest 
development version of fava with:


pip3 install git+https://github.com/beancount/fava.git

or you wait until a new fava version is released.


Cheers,
Andreas


Am 26.02.21 um 14:56 schrieb Tono Riesco:

Hi Andreas,

Thank you very much for your patch. I’ve been looking for that for a 
long time.
Could please be so kind to explain how to apply to the present fava 
package (1.18)? If I try "pip3 install —upgrade fava" doesn’t work 
because hasn’t been commit to the main version ...



Best regards.

Tono.

On 26 Feb 2021, 13:47 +0100, Andreas Gerstmayr , 
wrote:

I also didn't like seeing my net profit as negative (even though it's
positive), so I added an option to fava to flip the sign of the Income,
Liabilities and Equity accounts: 
https://github.com/beancount/fava/pull/1214


Keep in mind though that it will only flip the signs in the user
interface though, and won't change anything with the internal beancount
accounting.


Cheers,
Andreas


Am 02.02.21 um 14:26 schrieb Martin Blais:

One important design decision in beancount (an idea borrowed from Ledger
originally) is to do away with credit accounts and debit accounts.
Income, liabilities and equity accounts all normally have negative
signs, so that is correct. (It's a bit like programmers counting from
zero and not one).

See the a section in the documentation about this.


On Tue, Feb 2, 2021, 08:10 Andrew Chiw mailto:randomshinichi4...@gmail.com>> wrote:

I followed the Beancount getting started guide, and made
transactions from my bank account to my different categories like this:

2019-01-24 * "Employer" "Invoice 23"
  Income:DE:Salary
  Assets:Bank  2000 EUR

2019-01-02 * "Stromio GmbH" "ABSCHLAG Strom"
  Assets:Bank  -87.0 EUR
  Expenses:Core:Electricity

However, if I saved money from my income, fava reports a negative
"net profit", and if I used more than I got, fava says I have a
positive "net profit". Am I doing things wrong somehow?
Thanks,
Andrew

--
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+unsubscr...@googlegroups.com>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/beancount/b5c42a27-fe2a-49e5-82d0-f127303e47dbn%40googlegroups.com
<https://groups.google.com/d/msgid/beancount/b5c42a27-fe2a-49e5-82d0-f127303e47dbn%40googlegroups.com?utm_medium=email_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
<mailto:beancount+unsubscr...@googlegroups.com>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/beancount/CAK21%2BhP%2BVLF3%2Bmys39JHM3RdS9%2B%2BWnxW3QQ9-A7NusMKfkqKkw%40mail.gmail.com
<https://groups.google.com/d/msgid/beancount/CAK21%2BhP%2BVLF3%2Bmys39JHM3RdS9%2B%2BWnxW3QQ9-A7NusMKfkqKkw%40mail.gmail.com?utm_medium=email_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/08330cbb-26fc-bf7d-6796-5963b07d644e%40gerstmayr.me.


--
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+unsubscr...@googlegroups.com>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/7fb0083e-53cc-4790-869c-003a4a714e6d%40Spark 
<https://groups.google.com/d/msgid/beancount/7fb0083e-53cc-4790-869c-003a4a714e6d%40Spark?utm_medium=email_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/b7ab4a7c-16d6-ac2c-6665-3ad94b0f8176%40gerstmayr.me.


Re: Loss reported as profit

2021-02-26 Thread Andreas Gerstmayr
I also didn't like seeing my net profit as negative (even though it's 
positive), so I added an option to fava to flip the sign of the Income, 
Liabilities and Equity accounts: https://github.com/beancount/fava/pull/1214


Keep in mind though that it will only flip the signs in the user 
interface though, and won't change anything with the internal beancount 
accounting.



Cheers,
Andreas


Am 02.02.21 um 14:26 schrieb Martin Blais:
One important design decision in beancount (an idea borrowed from Ledger 
originally) is to do away with credit accounts and debit accounts. 
Income, liabilities and equity accounts all normally have negative 
signs, so that is correct. (It's a bit like programmers counting from 
zero and not one).


See the a section in the documentation about this.


On Tue, Feb 2, 2021, 08:10 Andrew Chiw > wrote:


I followed the Beancount getting started guide, and made
transactions from my bank account to my different categories like this:

2019-01-24 * "Employer" "Invoice 23"
   Income:DE:Salary
   Assets:Bank  2000 EUR

2019-01-02 * "Stromio GmbH" "ABSCHLAG Strom"
   Assets:Bank  -87.0 EUR
   Expenses:Core:Electricity

However, if I saved money from my income, fava reports a negative
"net profit", and if I used more than I got, fava says I have a
positive "net profit". Am I doing things wrong somehow?
Thanks,
Andrew

-- 
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/b5c42a27-fe2a-49e5-82d0-f127303e47dbn%40googlegroups.com

.

--
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%2BhP%2BVLF3%2Bmys39JHM3RdS9%2B%2BWnxW3QQ9-A7NusMKfkqKkw%40mail.gmail.com 
.


--
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/08330cbb-26fc-bf7d-6796-5963b07d644e%40gerstmayr.me.