Skip to main content

Beancount portfolio allocation report

Project description

beancount_portfolio_allocation

Reports on portfolio asset allocations in beancount. Useful for risk analysis and for rebalancing purposes.

Build Status Coverage Status

Installation

From source

$ python3 setup.py install

PIP

$ pip install beancount_portfolio_allocation

Usage

usage: Report on portfolio asset classes allocation vs targets.
       [-h] --portfolio PORTFOLIO bean

positional arguments:
  bean                  Path to the beancount file.

optional arguments:
  -h, --help            show this help message and exit
  --portfolio PORTFOLIO
                        Name of portfolio to report on

Example

$ bean-portfolio-allocation-report ledger.beancount --portfolio pension
cash
===========================================================================
subclass 	 amount 	 percent 	 target 	 difference
---------------------------------------------------------------------------
cash       	 380.00 	 19.00 		 0.00 		 -380.00

equity
===========================================================================
subclass 	 amount 	 percent 	 target 	 difference
---------------------------------------------------------------------------
ca-stock   	 700.00 	 35.00 		 30.00 		 -100.00
us-stock   	 600.00 	 30.00 		 30.00 		 0.00

fixed
===========================================================================
subclass 	 amount 	 percent 	 target 	 difference
---------------------------------------------------------------------------
ca-bond    	 320.00 	 16.00 		 40.00 		 480.00

Prerequisites

Before running this tool, your beancount files will need some additional metadata to help it do its job.

Commodities

All the commodities/currency you want to track will need to have the asset-class and asset-subclass metadata strings filled in. The actual values are up to you. Here are some examples:

1867-01-01 commodity CAD
  asset-class: "cash"
  asset-subclass: "cash"

1986-03-13 commodity MSFT
  asset-class: "equity"
  asset-subclass: "us-stock"

1977-01-03 commodity AAPL
  asset-class: "equity"
  asset-subclass: "us-stock"

2007-04-04 commodity VAB
  asset-class: "fixed-income"
  asset-subclass: "ca-bond"

You will also need valid price directives for all commodities held at cost and at least one 'operating_currency' option defined. The values in the report will all be converted to the first 'operating_currency' defined. A future version will offer a way to specify the currency to use for reporting.

Accounts

Accounts need to be part of a specific portfolio to track. Only one portfolio is supported by account, but you can have multiple portfolios over multiple accounts:

2000-01-01 open Assets:CA:Employer:PensionPlan
  portfolio: "pension"

2000-01-01 open Assets:CA:Questrade:RRSP
  portfolio: "pension"

2000-01-01 open Assets:CA:Questrade:Trading
  portfolio: "day-trading"

Target allocations

You can currently define your target allocation percentages for different asset subclasses in a portfolio using custom directives. There can currently be only one directive for the same portfolio and asset subclass. Missing allocation targets will be assumed to be 0%. An example 60/40 portfolio target might look like this (NOT a financial advice):

2018-06-14 custom "allocation" "pension" "ca-stock" 30
2018-06-14 custom "allocation" "pension" "us-stock" 30
2018-06-14 custom "allocation" "pension" "ca-bond" 40

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

beancount_portfolio_allocation-0.2.0.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file beancount_portfolio_allocation-0.2.0.tar.gz.

File metadata

File hashes

Hashes for beancount_portfolio_allocation-0.2.0.tar.gz
Algorithm Hash digest
SHA256 e3cfcf5bdaa802ad8febb0b5d96da999d37476394199c482f2b744b5375c84de
MD5 a46b51abc0a3706552bc09898f5a7e62
BLAKE2b-256 a4e867ca39f0273844b8194eccca967eca1d6694f8da6aebabc409a70c123cec

See more details on using hashes here.

File details

Details for the file beancount_portfolio_allocation-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for beancount_portfolio_allocation-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ed2116786533e681e78855a81a086822bfd599cd0feab5acb67e06fce9384616
MD5 8984b1e28d20237ae296b25234b2a033
BLAKE2b-256 051a45facdf86092a47f5021cbfafef84eac6e679ac1d43c9260f822665983a3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page