Investment tools for fava

241 views
Skip to first unread message

Red S

unread,
Mar 22, 2020, 4:40:11 PM3/22/20
to Beancount
One area that is missing in fava today is investment tools.

I've found Beancount to be very well designed to capture and represent almost anything necessary for handling investments in the realm of personal finance (thanks, Martin!), and Fava to be a terrific front end (thanks, Fava authors)!

I'd like to develop a set of investment reports and tooling. I've started an empty repo at:

I'd love contributions! In the form of design input,well thought out feature requests, tests, and of course, code.

Here are my initial thoughts.

Desired feature list

The goal is to develop a comprehensive set of reports and tools related to investments for fava. This document contains list of potential features that we would like to consider for implementation.

Reports

Asset allocation: By asset class:

  • Pie chart, hierarchical

    • Reference chart
    • top level alone chart (to simplify complex portfolios)?
  • Tax adjusted

Asset allocation: By account:

  • like the current one

Asset allocation: Tax Treatment:

  • taxable, tax-deferred, etc.
  • configure using parent account or metadata

Net worth:

  • across time (redundant?)

Savings rate:

  • absolute number across time
  • as %age of gross, net

Summary stats:

  • number of unique funds owned
  • number of brokerage accounts

Tools

Cash drag analysis:

  • cash as percentage of portfolio, and where it is

Tax loss harvester:

  • pull this in

Rebalancing:

  • consider plugging into a rebalancing tool (example1)

Dave The Happy Singer

unread,
Mar 23, 2020, 12:50:41 AM3/23/20
to Beancount
I've added some comments here: https://github.com/beancount/fava/issues/1082#issuecomment-602310904

Let us know if you want to continue the conversation here, on fava or on fava-investor!

Dave

Red S

unread,
Mar 23, 2020, 5:46:04 AM3/23/20
to Beancount
Great!

Reg. IRR, here are the ones I've looked at:
1) https://github.com/hoostus/portfolio-returns - simple, money-weighted


2) https://github.com/beancount/beancount/tree/master/experiments/returns and
https://groups.google.com/forum/#!searchin/beancount/%22computing$20investment$20returns%22%7Csort:date/beancount/XfuetD4BeOY/-lzaPiNqEgAJ

Martin's returns code.

The main problem seems to be extracting the right transactions and data. I don't know if either of the above address a multiple-currency case. Regardless, an IRR that handles most cases correctly, and either clearly flags corner cases it doesn't support or can clearly document those, would be a very good start IMHO.

If you're interested in contributing code to do this, please do, by all means. An irr directory within fava-investor on a dev branch would be a great if you already have working code and tests. If not, feel free to point me to your code.

Red S

unread,
Mar 23, 2020, 5:54:35 AM3/23/20
to Beancount
It would also be good if this could be built in modular fashion so we can use it as a library for beancount scripting, a cli and as a fava plugin (should fava-investor be beancount-investor, with a fava plugin?)

I very much agree with the philosophy of library/cli/fava. That's exactly how I designed my tax loss harvestor (there's libtlh.py, tlh.py, and the fava extension). That is the ideal design for fava-investor too, IMHO.

However, I find that for investing reports and tools, interactivity and visualization are key. This is the reason I'd like to build this primarily as a fava extension, and have the focus and main efforts be on fava. Ideally, this could even become a standard part of fava. Hence the naming. (I considered naming it beancount_fava_investor to tip my hat to beancount for being what makes this work, but that is too long and confusing).


On Sunday, March 22, 2020 at 9:50:41 PM UTC-7, Dave The Happy Singer wrote:

Red S

unread,
Mar 23, 2020, 5:56:42 AM3/23/20
to Beancount

Let us know if you want to continue the conversation here, on fava or on fava-investor!


Continuing the conversation here would be great and get more eyes on it. Of course, for specific issues affecting code and lower-level design, feel free to open issues in fava-investor. Thanks for asking!

Dave The Happy Singer

unread,
Mar 23, 2020, 7:13:57 PM3/23/20
to Beancount
> If you're interested in contributing code to do this, please do, by all means. An irr directory within fava-investor on a dev branch would be a great if you already have working code and tests. If not, feel free to point me to your code.

OK, as soon as work allows, I'll either make my repo public for you to look at or fork fava-investor with a dev branch. My project is currently set up as an installable python package (albeit not on public pypi yet as I considered it pre-release, so I might go with opening the repo just so you can see if it's suitable for contributing.
 
I very much agree with the philosophy of library/cli/fava.
 
However, I find that for investing reports and tools, interactivity and visualization are key. This is the reason I'd like to build this primarily as a fava extension,

All good! Contribution guidelines and code review can help us contribute code that can be reusable in a library or cli context, I think, just wanted to flag up my strong support for having those APIs available and designed in along the way if possible, e.g. by keeping fava-specific code separate from generic beancount-level implementation, we will be in a good position.

Justus Pendleton

unread,
Mar 23, 2020, 11:27:54 PM3/23/20
to Beancount
On Monday, March 23, 2020 at 3:40:11 AM UTC+7, Red S wrote:
One area that is missing in fava today is investment tools.

I wouldn't mind a bit more investment related stuff in the beancount/fava universe.

Rebalancing:

  • consider plugging into a rebalancing tool (example1)
I have a python implementation of Albert Mao's "optimal lazy rebalancing" that can be used standalone: https://github.com/hoostus/lazy_rebalance

Red S

unread,
Mar 28, 2020, 3:12:39 AM3/28/20
to Beancount

On Monday, March 23, 2020 at 4:13:57 PM UTC-7, Dave The Happy Singer wrote:
> If you're interested in contributing code to do this, please do, by all means. An irr directory within fava-investor on a dev branch would be a great if you already have working code and tests. If not, feel free to point me to your code.

OK, as soon as work allows, I'll either make my repo public for you to look at or fork fava-investor with a dev branch. My project is currently set up as an installable python package (albeit not on public pypi yet as I considered it pre-release, so I might go with opening the repo just so you can see if it's suitable for contributing.

Sounds good, I look forward to it!

 
I very much agree with the philosophy of library/cli/fava.
 
However, I find that for investing reports and tools, interactivity and visualization are key. This is the reason I'd like to build this primarily as a fava extension,

All good! Contribution guidelines and code review can help us contribute code that can be reusable in a library or cli context, I think, just wanted to flag up my strong support for having those APIs available and designed in along the way if possible, e.g. by keeping fava-specific code separate from generic beancount-level implementation, we will be in a good position.

Contribution guidelines and reviews are a great place to enforce the APIs, will do :).

Red S

unread,
Mar 28, 2020, 3:13:22 AM3/28/20
to Beancount

I have a python implementation of Albert Mao's "optimal lazy rebalancing" that can be used standalone: https://github.com/hoostus/lazy_rebalance

Excellent, will keep this in mind!

Red S

unread,
Apr 11, 2020, 3:14:37 AM4/11/20
to Beancount

The fava_investor project now has a few basic modules: asset allocation by class, asset allocation by accounts, TLH, and a basic cash drag analysis. A performance module is in development, and several more are planned.



Would love help from anyone interested in anything from blog posts, setting up pythonanywhere, to writing and beta testing modules. See below:


Web related

  • Pretty-fying the tabbed interface
  • Rendering the asset allocation by class as a tree-table
  • Adding a graph to asset allocation by class

Building and publishing

  • PyPI
  • Adding tests, linter
  • Building releases
  • Writing blog posts
  • Hosting on pythonanywhere

Developing modules

  • see modules above, or suggest your own
  • Example file writers

Beta testers

See open issues here.

Red S

unread,
May 2, 2020, 11:57:57 PM5/2/20
to Beancount
fava_investor is now available via PyPI (pip):

pip install fava-investor

It's still in development. Help beta test and more.
Feedback appreciated. Let me know what features you'd like to see.

screenshot-assetalloc.png
Reply all
Reply to author
Forward
0 new messages