Giter Site home page Giter Site logo

fava-classy-portfolio's Introduction

Fava Classy Portfolio Extension

Classy Portfolio Screenshot

Warning: Prototype Code

This is a prototype I'm throwing out there due to interest from the Beancount Community (see https://groups.google.com/forum/#!msg/beancount/XNjjnML_vsA/e_MAEhgCBgAJ ). Issues / PR's welcome! So far this is just an early prototype to get a table breakdown view done, there's still work to be done on numeric features (e.g. gain/loss, tax, etc.).

Introduction

Classy Portfolio is an Extension for Fava, a web interface for the Beancount plaintext accounting software. The extension displays a list of different portfolios (e.g. 'taxable' vs. 'retirement'), with breakdowns using 'asset-class' and 'asset-subclass' metadata labels on commodities.

It's recommended (though not required) to use this extension along with the beancount metadata spray plugin to ease with tagging multiple accounts with portfolio metadata.

An example file is available at https://github.com/seltzered/fava-classy-portfolio-demo.

Compatibility with Fava

This currently works with fava 1.19. Since this extension depends on internal fava API's compatibility may change.

Usage

  1. Clone this repo into the same directory as your beancount ledger.

  2. In your ledger file, add asset-class and asset-subclass metadata strings to commodity entries. Should look similar to:

     2010-01-01 commodity VTI
       name: "Vanguard Total Market Index ETF"
       asset-class: "Stock"
       asset-subclass: "US-Total Domestic Market"
       price: "USD:yahoo/VTI" 
    
  3. In your ledger file, add portfolio metadata strings to account entries. Should look similar to:

     2010-01-01 open Assets:Vanguard:RothIRA:VTI
         portfolio: "retirement"
    

    ...or if you're using the metadata spray plugin:

     2010-01-01 open Assets:Vanguard:RothIRA:VTI
     plugin "beancount_plugins_metadata_spray.plugins.metadata_spray" "{
     'sprays': [{ 'spray_type': 'account_open',
                   'replace_type': 'return_error',
                   'pattern': 'Assets:Vanguard:RothIRA:.*',
                   'metadata_dict': {'portfolio': 'retirement'}
                   }]
     }"
    
  4. In your ledger file, instantiate the extension with a line similar to:

     2010-01-01 custom "fava-extension" "fava_classy_portfolio" "[
             ('account_open_metadata_pattern', ('portfolio', 'retirement'))
     ]"
    
  5. Because this is an early prototype, you will need to clone/run fava from latest source. See first section "PROTOTYPE: modification to fava required" in this document on modifying fava.

  6. Run fava on the ledger file. A link in the sidebar should appear.

References

This extension was somewhat inspired by the Beancount Portfolio Allocation plugin, which I believe follows similar conventions on metadata labeling.

fava-classy-portfolio's People

Contributors

carderne avatar phracturedblue avatar seltzered avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

fava-classy-portfolio's Issues

Red error bar.

When I try this out, I simply get this in a red bar in fava:

Loading http://localhost:8081/main-accounts/extension/FavaClassyPortfolio/ failed.

There is no error output on the console where I started fava. How do I debug this? Thanks!

Originally posted by @redstreet in #1 (comment)

Blank screen in fava-classy-portfolio page

Hi!

I am using fava, version 1.13.dev12+g84df3df6 and fava-classy-portfolio @ 5732cac .
When i try to load the fava-classy-portfolio page, i have a blank screen.

image

There are no error message in the chrome developper tool console.

In the fava debug log, i hav found the following:

Traceback (most recent call last):
  File "/myData/fava-classy-portfolio/__init__.py", line 71, in portfolio_accounts
    tree, end, option[1][0], option[1][1]
  File "/myData/fava-classy-portfolio/__init__.py", line 146, in _account_metadata_pattern
    selected_nodes = [tree[x] for x in selected_accounts]
  File "/myData/fava-classy-portfolio/__init__.py", line 146, in <listcomp>
    selected_nodes = [tree[x] for x in selected_accounts]
KeyError: 'Actif:Linxea:AVTim1:FR0010434019'
Traceback (most recent call last):
  File "/myData/fava-classy-portfolio/__init__.py", line 82, in portfolio_accounts
    True),
  File "/myData/fava-classy-portfolio/__init__.py", line 403, in insert_rowspans
    False)
  File "/myData/fava-classy-portfolio/__init__.py", line 438, in insert_rowspans
    False)
  File "/myData/fava-classy-portfolio/__init__.py", line 459, in insert_rowspans
    data[key][coltype[0]], {"rowspan": 1})
KeyError: 'asset_subclass_allocation'
Traceback (most recent call last):
  File "/myData/fava-classy-portfolio/__init__.py", line 82, in portfolio_accounts
    True),
  File "/myData/fava-classy-portfolio/__init__.py", line 403, in insert_rowspans
    False)
  File "/myData/fava-classy-portfolio/__init__.py", line 438, in insert_rowspans
    False)
  File "/myData/fava-classy-portfolio/__init__.py", line 459, in insert_rowspans
    data[key][coltype[0]], {"rowspan": 1})
KeyError: 'asset_subclass_allocation'
Traceback (most recent call last):
  File "/myData/fava-classy-portfolio/__init__.py", line 82, in portfolio_accounts
    True),
  File "/myData/fava-classy-portfolio/__init__.py", line 403, in insert_rowspans
    False)
  File "/myData/fava-classy-portfolio/__init__.py", line 438, in insert_rowspans
    False)
  File "/myData/fava-classy-portfolio/__init__.py", line 459, in insert_rowspans
    data[key][coltype[0]], {"rowspan": 1})
KeyError: 'asset_subclass_allocation'
Traceback (most recent call last):
  File "/myData/fava-classy-portfolio/__init__.py", line 82, in portfolio_accounts
    True),
  File "/myData/fava-classy-portfolio/__init__.py", line 403, in insert_rowspans
    False)
  File "/myData/fava-classy-portfolio/__init__.py", line 438, in insert_rowspans
    False)
  File "/myData/fava-classy-portfolio/__init__.py", line 459, in insert_rowspans
    data[key][coltype[0]], {"rowspan": 1})
KeyError: 'asset_subclass_allocation'
Traceback (most recent call last):
  File "/myData/fava-classy-portfolio/__init__.py", line 82, in portfolio_accounts
    True),
  File"/myData/fava-classy-portfolio/__init__.py", line 403, in insert_rowspans
    False)
  File "/myData/fava-classy-portfolio/__init__.py", line 438, in insert_rowspans
    False)
  File "/myData/fava-classy-portfolio/__init__.py", line 459, in insert_rowspans
    data[key][coltype[0]], {"rowspan": 1})
KeyError: 'asset_subclass_allocation'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.