New experimental plugin: opengroup

89 views
Skip to first unread message

Red S

unread,
Jan 24, 2023, 6:15:35 PM1/24/23
to Beancount
I've used this plugin for a while to keep my hierarchy consistent. I don't have the time to clean it up thoughtfully enough to know if it will be useful to others, so I thought I'd simply share it as is in case it is useful.

From the README:
# Opengroup: an EXPERIMENTAL plugin for Beancount

Inserts `open` statements for a set of accounts based on specified rules. For example,
turns:

```
2000-01-01 open Assets:Investments:Taxable:Midelity PARENT
  opengroup_cash_and_fees: "USD"
  opengroup_commodity_leaves_default_booking: "AAPL,VTI"
  opengroup_commodity_leaves_cgdists: "VTI"
```

into:

```
2000-01-01 open Assets:Investments:Taxable:Midelity PARENT

2000-01-01 open Assets:Investments:Taxable:Midelity:USD USD
2000-01-01 open Expenses:Fees-and-Charges:Brokerage-Fees:Taxable:Midelity USD

2000-01-01 open Assets:Investments:Taxable:Midelity:AAPL
2000-01-01 open Income:Investments:Taxable:Dividends:Midelity:AAPL     USD
2000-01-01 open Income:Investments:Taxable:Interest:Midelity:AAPL      USD
2000-01-01 open Income:Investments:Taxable:Capital-Gains:Midelity:AAPL USD

2000-01-01 open Assets:Investments:Taxable:Midelity:VTI
2000-01-01 open Income:Investments:Taxable:Dividends:Midelity:VTI      USD
2000-01-01 open Income:Investments:Taxable:Interest:Midelity:VTI       USD
2000-01-01 open Income:Investments:Taxable:Capital-Gains:Midelity:VTI  USD

2000-01-01 open Income:Investments:Taxable:Capital-Gains-Distributions:Short:Midelity:VTI USD
2000-01-01 open Income:Investments:Taxable:Capital-Gains-Distributions:Long:Midelity:VTI  USD
```

### Why use this plugin?

If you like the benefit of a layer of error checking that you get by manually opening
and closing accounts in Beancount, this plugin offers a way to get that benefit while
being compact and consistent in your account declarations. Opening groups of accounts
based on metadata like the above helps with:

- ensuring your accounts follow consistent naming conventions
- expression density (fewer open statements)
- ease of adding new funds (no need to remember all the corresponding accounts to open
  and their conventions; simply add the new ticker to the metadata list)


Reply all
Reply to author
Forward
0 new messages