This is a Fava extension to display a grouped portfolio view in Fava for a set of Beancount accounts.

Overview

Fava Portfolio Summary

This is a Fava extension to display a grouped portfolio view in Fava for a set of Beancount accounts.

It can also calculate MWRR (Money-Weighted Rate of Return) or TWRR (Time-Weighted Rate of Return)

The display is similar to the Balance Sheet in Fava, however it allows grouping accounts, and calculating partial balances.

The MWRR (and especially TWRR) calculations can be very slow to calculate. By default, MWRR is enabled, and TWRR is disabled

Screenshot

Configuration

In the beancount file, configure via:

2000-01-01 custom "fava-extension" "portfolio_summary" "{
    'metadata-key': 'portfolio',
    'account-groups': (
        { 'name': 'cash', 'mwr': False },
        'investment',
        'retirement-pretax',
        'retirement-roth'),
    'internal': (
      '.*:PnL',
      'Income:Investments:Dividends',
      'Income:Bank:Interest'),
    'mwr': 'children',
    'twr': False,
    }"
  • metadata-key: Name of key used to group accounts
  • account-groups: Either a string or a dictionary with the name key identifying the name of the group
    • If specified as a dictionary, the ineternal, mwr and twr keys can be specied on a per-group basis
  • internal (optional): List of regex patterns denoting 'internal' accounts that should be ignored for cash-flow purposes during MWRR/TWRR calculation. More information about selecting internal accounts can be found here
  • mwr (optional): Enable MWRR calculation for all accounts (can be overridden at the group level). Possible values: (True, False, 'children') Defaults to True
  • twr (optional): Enable TWRR calculation for all accounts (can be overridden at the group level). Possible values: (True, False, 'children') Defaults to False

Additionally each top-level account (that is to be displayed) needs to be marked with the appropriate group:

2000-01-01 open Assets:Investments:Fidelity401k:PreTax
  portfolio: "retirement-pretax"

For each top level account, all transactions of the account and any child accounts will be considered (I.e. for the example above, Assets:Investments:Fidelity401k:PreTax and any accouunt matching Assets:Investments:Fidelity401k:PreTax:.* will be summarized)

Related Projects

You might also like...
Chemical Analysis Calculator, with full solution display.
Chemical Analysis Calculator, with full solution display.

Chemicology Chemical Analysis Calculator, to solve problems efficiently by displaying whole solution. Go to releases for downloading .exe, .dmg, Linux

Bootstraparse is a personal project started with a specific goal in mind: creating static html pages for direct display from a markdown-like file

Bootstraparse is a personal project started with a specific goal in mind: creating static html pages for direct display from a markdown-like file

Streamlit component to display topics from Streamlit's community forum related to any exception.

streamlit-forum Streamlit component to display topics from Streamlit's community forum related to any exception. Installation pip install streamlit-fo

Display your data in an attractive way in your notebook!
Display your data in an attractive way in your notebook!

Bloxs Bloxs is a simple python package that helps you display information in an attractive way (formed in blocks). Perfect for building dashboards, re

Example python package with pybind11 cpp extension

Developing C++ extension in Python using pybind11 This is a summary of the commands used in the tutorial.

A Python3 script to decode an encoded VBScript file, often seen with a .vbe file extension

vbe-decoder.py Decode one or multiple encoded VBScript files, often seen with a .vbe file extension. Usage usage: vbe-decoder.py [-h] [-o output] file

The purpose of this script is to bypass disablefund, provide some useful information, and dig the hook function of PHP extension.
The purpose of this script is to bypass disablefund, provide some useful information, and dig the hook function of PHP extension.

The purpose of this script is to bypass disablefund, provide some useful information, and dig the hook function of PHP extension.

This is a vscode extension with a Virtual Assistant that you can play with when you are bored or you need help..

VS Code Virtual Assistant This is a vscode extension with a Virtual Assistant that you can play with when you are bored or you need help. Its currentl

Broken Link Finder is a Burp Extension to detect broken links for a passive scanning domains and links.
Broken Link Finder is a Burp Extension to detect broken links for a passive scanning domains and links.

Broken Link Finder Broken Link Finder is a Burp Extension to detect broken links for a passive scanning domains and links. Inspired by InitRoot's link

Comments
  • Unable to install through pip

    Unable to install through pip

    Thanks for creating such a useful extension, has been really helpful!

    Problem

    Doing a pip install . in the root directory after a clone is failing to install the package contents correctly. It didn't create a fava_portfolio_summary directory with the python files in the site-packages directory, and only copied the metadata to it.

    Solution

    I was able to resolve it by adding the package_dir option to setup.py:

    ...
    packages=find_packages(),
    package_dir={'fava_portfolio_summary': '.'}
    ...
    

    PS: setuptools is deprecated, so it might be prudent to switch to pyproject.toml to specify the package details :)

    PS2: Would be good to add some installation instructions to the readme. After the proposed change, doing pip install git+https://github.com/PhracturedBlue/fava-portfolio-summary does the job!

    opened by iamkroot 1
  • fix pip install and update README with package name

    fix pip install and update README with package name

    I had to make a few changes to setup.py in order to be able to integrate fava-portfolio-summary into my docker image where run beancount/fava. The Dockerfile is as follows:

    FROM python:3
    
    # Keeps Python from generating .pyc files in the container
    ENV PYTHONDONTWRITEBYTECODE=1
    
    RUN /usr/local/bin/python -m pip install --upgrade pip
    RUN /usr/local/bin/python -m pip install --upgrade setuptools
    COPY requirements.txt .
    RUN python -m pip install -r requirements.txt
    
    WORKDIR /beancount
    
    ENV FAVA_HOST=0.0.0.0
    ENV FAVA_PORT=15000
    ENV MAIN_FILE=main.beancount
    
    EXPOSE 15000
    
    CMD ["/bin/bash", "-c", "fava $MAIN_FILE"]
    

    And requirements.txt contains:

    fava
    git+https://github.com/PhracturedBlue/fava-portfolio-summary
    

    The package was being created without the source and template files, so fava was failing to load it. This gets resolved with this proposal.

    opened by clsacramento 0
  • Adds allocation breakdown for each portfolio under All portfolios

    Adds allocation breakdown for each portfolio under All portfolios

    I originally tried out the fava-portfolio-summary extension because I was looking for a simple way to track my stock allocation versus the rest of my portfolio. While associating different accounts to my stocks portfolio, fava-portfolio-summary will show me the percentage of each security under this portfolio but not the percentage of stocks in the whole portfolio. This PR adds this as part of the summary, on the top under All portifolios.

    For example, this is how it looks for me with this change: https://paste.pics/GPRDG

    opened by clsacramento 3
  • handle KeyError error when getting security prices

    handle KeyError error when getting security prices

    I encountered following error when using the extension:

    Exception on /beancount/extension/PortfolioSummary/ [GET]
    Traceback (most recent call last):
      File "/usr/local/lib/python3.10/site-packages/fava_portfolio_summary/__init__.py", line 71, in portfolio_accounts
        portfolio = self._account_metadata_pattern(tree, key, pattern, internal, mwr, twr)
      File "/usr/local/lib/python3.10/site-packages/fava_portfolio_summary/__init__.py", line 172, in _account_metadata_pattern
        portfolio_data = self._portfolio_data(selected_accounts, internal, mwr, twr)
      File "/usr/local/lib/python3.10/site-packages/fava_portfolio_summary/__init__.py", line 263, in _portfolio_data
        rows.append(total)
      File "/usr/local/lib/python3.10/site-packages/fava_portfolio_summary/__init__.py", line 233, in _process_node
        try:
      File "/usr/local/lib/python3.10/site-packages/fava/core/__init__.py", line 538, in prices
        all_prices = get_all_prices(self.price_map, (base, quote))
      File "/usr/local/lib/python3.10/site-packages/beancount/core/prices.py", line 303, in get_all_prices
        return _lookup_price_and_inverse(price_map, base_quote)
      File "/usr/local/lib/python3.10/site-packages/beancount/core/prices.py", line 278, in _lookup_price_and_inverse
        return price_map[base_quote]
    KeyError: ('CHF', 'VT')
    

    The problem for me is that I have securities which are traded in USD, while my operating currency is CHF. It seems operating currency does not work in the situation where the user needs to trade uisng different currencies. I propose to add this workaround for the time being and later work on a smarter solution to figure out which currency should be used to obtain the prices.

    opened by clsacramento 1
Owner
null
Adjust the white point, gamma or make your XDR display darker without losing HDR peak luminance or the ability to adjust display brightness

XDR Tuner Adjust the white point, gamma or make your XDR display darker without losing HDR peak luminance or the ability to adjust display brightness

François Simond 16 Dec 28, 2022
An addin for Autodesk Fusion 360 that lets you view your design in a Looking Glass Portrait 3D display

An addin for Autodesk Fusion 360 that lets you view your design in a Looking Glass Portrait 3D display

Brian Peiris 12 Nov 2, 2022
A 3D Slicer Extension to view data from the flywheel heirarchy

flywheel-connect A 3D Slicer Extension to view, select, and download images from a Flywheel instance to 3D Slicer and storing Slicer outputs back to F

null 4 Nov 5, 2022
Building an Investment Portfolio for Day Trade with Python

Montando um Portfólio de Investimentos para Day Trade com Python Instruções: Para reproduzir o projeto no Google Colab, faça o download do repositório

Paula Campigotto 9 Oct 26, 2021
Prometheus exporter for Spigot accounts

SpigotExporter Prometheus exporter for Spigot accounts What it provides SpigotExporter will output metrics for each of your plugins and a cumulative d

Jacob Bashista 5 Dec 20, 2021
Simple GUI menu for micropython using a rotary encoder and basic display.

Micropython encoder based menu This is a simple menu system written in micropython. It uses a switch, a rotary encoder and an OLED display.

null 80 Jan 7, 2023
How to access and display MyEnergi data

MyEnergi-Python-Example How to access and display MyEnergi data Windows PC Install a version of Python typically 3.10 The Python code here needs addit

G6EJD 8 Nov 28, 2022
gwcheck is a tool to check .gnu.warning.* sections in ELF object files and display their content.

gwcheck Description gwcheck is a tool to check .gnu.warning.* sections in ELF object files and display their content. For an introduction to .gnu.warn

Frederic Cambus 11 Oct 28, 2022
In this project, we are going to display the battery notification and the time left for the battery to drain out using the battery capacity value.

In this project, we are going to display the battery notification and the time left for the battery to drain out using the battery capacity value.

Ritoban Biswas 1 Dec 20, 2021
A service to display a quick summary of a project on GitHub.

A service to display a quick summary of a project on GitHub. Usage ?? Paste the code below with details filled in as specified below into your Readme.

Rohit V 8 Dec 6, 2022