beans-ledger 1.0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- beans_ledger-1.0.1/PKG-INFO +569 -0
- beans_ledger-1.0.1/README.md +547 -0
- beans_ledger-1.0.1/beans/__init__.py +3 -0
- beans_ledger-1.0.1/beans/__main__.py +5 -0
- beans_ledger-1.0.1/beans/analysis.py +158 -0
- beans_ledger-1.0.1/beans/budget.py +101 -0
- beans_ledger-1.0.1/beans/cli.py +1910 -0
- beans_ledger-1.0.1/beans/completions.py +100 -0
- beans_ledger-1.0.1/beans/economic.py +737 -0
- beans_ledger-1.0.1/beans/export.py +213 -0
- beans_ledger-1.0.1/beans/forecast.py +204 -0
- beans_ledger-1.0.1/beans/fx.py +160 -0
- beans_ledger-1.0.1/beans/goals.py +94 -0
- beans_ledger-1.0.1/beans/importer.py +128 -0
- beans_ledger-1.0.1/beans/invest.py +249 -0
- beans_ledger-1.0.1/beans/ledger.py +1418 -0
- beans_ledger-1.0.1/beans/loans.py +277 -0
- beans_ledger-1.0.1/beans/models.py +141 -0
- beans_ledger-1.0.1/beans/reconcile.py +82 -0
- beans_ledger-1.0.1/beans/recurring.py +205 -0
- beans_ledger-1.0.1/beans/render.py +151 -0
- beans_ledger-1.0.1/beans/reports.py +552 -0
- beans_ledger-1.0.1/beans/restore.py +170 -0
- beans_ledger-1.0.1/beans/status.py +117 -0
- beans_ledger-1.0.1/beans/utils.py +278 -0
- beans_ledger-1.0.1/beans_ledger.egg-info/PKG-INFO +569 -0
- beans_ledger-1.0.1/beans_ledger.egg-info/SOURCES.txt +49 -0
- beans_ledger-1.0.1/beans_ledger.egg-info/dependency_links.txt +1 -0
- beans_ledger-1.0.1/beans_ledger.egg-info/entry_points.txt +2 -0
- beans_ledger-1.0.1/beans_ledger.egg-info/requires.txt +7 -0
- beans_ledger-1.0.1/beans_ledger.egg-info/top_level.txt +1 -0
- beans_ledger-1.0.1/pyproject.toml +42 -0
- beans_ledger-1.0.1/setup.cfg +4 -0
- beans_ledger-1.0.1/tests/test_analysis.py +104 -0
- beans_ledger-1.0.1/tests/test_bump_version.py +172 -0
- beans_ledger-1.0.1/tests/test_cli.py +817 -0
- beans_ledger-1.0.1/tests/test_economic.py +314 -0
- beans_ledger-1.0.1/tests/test_export.py +111 -0
- beans_ledger-1.0.1/tests/test_forecast.py +40 -0
- beans_ledger-1.0.1/tests/test_fx.py +151 -0
- beans_ledger-1.0.1/tests/test_goals.py +61 -0
- beans_ledger-1.0.1/tests/test_importer.py +114 -0
- beans_ledger-1.0.1/tests/test_invest.py +124 -0
- beans_ledger-1.0.1/tests/test_ledger.py +236 -0
- beans_ledger-1.0.1/tests/test_loans.py +141 -0
- beans_ledger-1.0.1/tests/test_reconcile.py +120 -0
- beans_ledger-1.0.1/tests/test_recurring.py +169 -0
- beans_ledger-1.0.1/tests/test_reports.py +214 -0
- beans_ledger-1.0.1/tests/test_restore.py +160 -0
- beans_ledger-1.0.1/tests/test_status.py +78 -0
- beans_ledger-1.0.1/tests/test_utils.py +106 -0
|
@@ -0,0 +1,569 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: beans-ledger
|
|
3
|
+
Version: 1.0.1
|
|
4
|
+
Summary: Professional-grade double-entry accounting for personal finance
|
|
5
|
+
License: MIT
|
|
6
|
+
Project-URL: Homepage, https://github.com/rtrimble13/beans
|
|
7
|
+
Project-URL: Repository, https://github.com/rtrimble13/beans
|
|
8
|
+
Project-URL: Issues, https://github.com/rtrimble13/beans/issues
|
|
9
|
+
Project-URL: PyPI, https://pypi.org/project/beans-ledger/
|
|
10
|
+
Keywords: accounting,finance,double-entry,budgeting,cli
|
|
11
|
+
Classifier: Environment :: Console
|
|
12
|
+
Classifier: Intended Audience :: End Users/Desktop
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Topic :: Office/Business :: Financial :: Accounting
|
|
15
|
+
Requires-Python: >=3.10
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
Provides-Extra: dev
|
|
18
|
+
Requires-Dist: pytest; extra == "dev"
|
|
19
|
+
Provides-Extra: release
|
|
20
|
+
Requires-Dist: build; extra == "release"
|
|
21
|
+
Requires-Dist: twine; extra == "release"
|
|
22
|
+
|
|
23
|
+
# beans
|
|
24
|
+
|
|
25
|
+
**Professional-grade double-entry accounting for personal finance, from the command line.**
|
|
26
|
+
|
|
27
|
+
`beans` lets you keep your household books the way a company keeps theirs: every
|
|
28
|
+
transaction is a balanced set of debits and credits, and your finances roll up
|
|
29
|
+
into the same three statements analysts use to evaluate public companies — an
|
|
30
|
+
income statement, a balance sheet, and a statement of cash flows. On top of the
|
|
31
|
+
ledger it layers budgeting, forecasting, and ratio analysis tailored to
|
|
32
|
+
personal finance.
|
|
33
|
+
|
|
34
|
+
- **True double-entry** — transactions must balance to the cent; the trial
|
|
35
|
+
balance always ties.
|
|
36
|
+
- **Corporate-style statements** — income statement (with common-size % and
|
|
37
|
+
prior-period comparison), balance sheet (with computed retained earnings),
|
|
38
|
+
and a direct-method statement of cash flows classified into operating,
|
|
39
|
+
investing, and financing activities.
|
|
40
|
+
- **Budgeting** — per-account budgets at weekly/monthly/quarterly/yearly
|
|
41
|
+
cadence, with budget-vs-actual variance reports over any period.
|
|
42
|
+
- **Forecasting** — project income, expenses, cash, and net worth forward from
|
|
43
|
+
historical averages, a linear trend, or your budgets.
|
|
44
|
+
- **Analysis** — savings rate, liquidity runway, debt-to-assets,
|
|
45
|
+
debt-to-income, and expense composition.
|
|
46
|
+
- **Reconciliation** — clear postings against bank statements and reconcile
|
|
47
|
+
to the cent, the way errors actually get caught.
|
|
48
|
+
- **Investments** — FIFO lots, price history, realized gains on sale, and
|
|
49
|
+
mark-to-market adjustments so the balance sheet carries market value.
|
|
50
|
+
- **Multi-currency** — foreign-denominated accounts with parallel foreign
|
|
51
|
+
balances, exchange-rate history, and FX revaluation, while the books and
|
|
52
|
+
statements stay in your base (functional) currency.
|
|
53
|
+
- **Export & backup** — the whole ledger as JSON or flat CSV, and
|
|
54
|
+
consistent point-in-time SQLite snapshots.
|
|
55
|
+
- **Goals** — savings targets and debt payoff dates with required-monthly
|
|
56
|
+
math, plus period close to lock historical books.
|
|
57
|
+
- **Ease of use** — a `beans status` dashboard, `spend` / `earn` / `transfer`
|
|
58
|
+
shortcuts with instant budget feedback, fuzzy account matching
|
|
59
|
+
(`groceries` → `Expenses:Food:Groceries`), full-text search, undo,
|
|
60
|
+
deduplicating CSV import with auto-categorization rules, shell
|
|
61
|
+
completions, and `--json` output on every report for scripting.
|
|
62
|
+
- **No dependencies** — pure Python standard library; data lives in a single
|
|
63
|
+
SQLite file you own.
|
|
64
|
+
|
|
65
|
+
## Installation
|
|
66
|
+
|
|
67
|
+
From PyPI:
|
|
68
|
+
|
|
69
|
+
```sh
|
|
70
|
+
pip install beans-ledger
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
The package is published on PyPI as **`beans-ledger`** (the name `beans` was
|
|
74
|
+
already taken), but it still installs the `beans` command and is imported as
|
|
75
|
+
`beans`. Or install from a checkout:
|
|
76
|
+
|
|
77
|
+
```sh
|
|
78
|
+
pip install .
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Requires Python 3.10+. This installs the `beans` command.
|
|
82
|
+
|
|
83
|
+
## Quick start
|
|
84
|
+
|
|
85
|
+
```sh
|
|
86
|
+
# Create a ledger (default: ~/.beans/ledger.db; override with -f or $BEANS_LEDGER)
|
|
87
|
+
beans init
|
|
88
|
+
|
|
89
|
+
# Record opening balances against equity, like a company's opening entry
|
|
90
|
+
beans tx add --date 2026-01-01 --desc "Opening balances" \
|
|
91
|
+
--post Assets:Checking 5000 \
|
|
92
|
+
--post Assets:Savings 10000 \
|
|
93
|
+
--post "Liabilities:Credit Card" -1200 \
|
|
94
|
+
--post "Equity:Opening Balances" # omitted amount auto-balances
|
|
95
|
+
|
|
96
|
+
# Day-to-day entries — fuzzy account names, defaults to your checking account
|
|
97
|
+
beans earn 6000 Salary --date 2026-01-15 --desc "January paycheck"
|
|
98
|
+
beans spend 1800 Rent --date 2026-02-01
|
|
99
|
+
beans spend 450.25 Groceries --payee "Market"
|
|
100
|
+
beans transfer 1000 Checking Savings
|
|
101
|
+
|
|
102
|
+
# The three statements
|
|
103
|
+
beans report income --period ytd
|
|
104
|
+
beans report balance
|
|
105
|
+
beans report cashflow --period ytd
|
|
106
|
+
|
|
107
|
+
# Or just run `beans` for the dashboard: cash, net worth, month vs budget,
|
|
108
|
+
# due recurring rules, and goal progress on one screen.
|
|
109
|
+
beans
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## Walkthroughs
|
|
113
|
+
|
|
114
|
+
New here? The [`docs/vignettes/`](docs/vignettes/) directory has guided,
|
|
115
|
+
task-oriented walkthroughs that take a workflow from start to finish with real
|
|
116
|
+
captured output:
|
|
117
|
+
|
|
118
|
+
1. [Getting started](docs/vignettes/01-getting-started.md) — set up a ledger and
|
|
119
|
+
read your first statements.
|
|
120
|
+
2. [Budgeting a month](docs/vignettes/02-budgeting-a-month.md) — set targets and
|
|
121
|
+
track spending against them.
|
|
122
|
+
3. [Import & reconcile](docs/vignettes/03-import-and-reconcile.md) — import a
|
|
123
|
+
bank CSV and tie out to your statement.
|
|
124
|
+
4. [Recurring, goals & investing](docs/vignettes/04-recurring-goals-investing.md)
|
|
125
|
+
— automate bills, set goals, and track investments.
|
|
126
|
+
5. [Loans & liquidity](docs/vignettes/05-loans-and-liquidity.md) — classify
|
|
127
|
+
current vs non-current, finance a loan, and read a classified balance sheet
|
|
128
|
+
with liquidity ratios.
|
|
129
|
+
6. [The economic balance sheet](docs/vignettes/06-economic-balance-sheet.md) —
|
|
130
|
+
value human capital and future consumption to see lifetime net worth
|
|
131
|
+
alongside the accounting balance sheet.
|
|
132
|
+
|
|
133
|
+
The rest of this README is the command reference. For the full instruction
|
|
134
|
+
manual — every command, every flag, with parameter tables and best practices
|
|
135
|
+
for each — see [`docs/MANUAL.md`](docs/MANUAL.md).
|
|
136
|
+
|
|
137
|
+
## Concepts
|
|
138
|
+
|
|
139
|
+
### Accounts
|
|
140
|
+
|
|
141
|
+
Accounts are hierarchical (`Expenses:Food:Groceries`) and typed: `asset`,
|
|
142
|
+
`liability`, `equity`, `income`, or `expense`. `beans init` creates a starter
|
|
143
|
+
chart of ~23 accounts; reshape it freely:
|
|
144
|
+
|
|
145
|
+
```sh
|
|
146
|
+
beans account add Expenses:Pets --type expense
|
|
147
|
+
beans account add Assets:HSA --type asset --cash
|
|
148
|
+
beans account modify Liabilities:Loans --rename Liabilities:Mortgage
|
|
149
|
+
beans account list # with balances; --type expense to filter
|
|
150
|
+
beans account close Assets:HSA # requires a zero balance
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
Two flags drive the statement of cash flows:
|
|
154
|
+
|
|
155
|
+
- `--cash` marks an asset as cash or a cash equivalent (checking, savings,
|
|
156
|
+
wallet). The cash flow statement explains the change in these accounts.
|
|
157
|
+
- `--cashflow operating|investing|financing` overrides the activity an
|
|
158
|
+
account's flows are classified under. Defaults follow corporate convention:
|
|
159
|
+
income/expense → operating, non-cash assets → investing,
|
|
160
|
+
liabilities/equity → financing.
|
|
161
|
+
|
|
162
|
+
Assets and liabilities also carry a **liquidity** classification —
|
|
163
|
+
`current` (realizable or due within a year) or `noncurrent` (beyond a year) —
|
|
164
|
+
that drives the classified balance sheet and the working-capital ratios.
|
|
165
|
+
Everything defaults to `current`; mark the long-term ones:
|
|
166
|
+
|
|
167
|
+
```sh
|
|
168
|
+
beans account add Assets:Prepaid:Insurance --type asset # current
|
|
169
|
+
beans account modify Retirement --noncurrent # long-term
|
|
170
|
+
beans account add "Liabilities:Mortgage" --type liability --noncurrent
|
|
171
|
+
beans account modify "Credit Card" --current
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
For an amortizing debt (mortgage, auto, student loan), don't classify by hand —
|
|
175
|
+
attach a loan and let the amortization schedule split it (see **Loans** below).
|
|
176
|
+
|
|
177
|
+
### Transactions
|
|
178
|
+
|
|
179
|
+
Every transaction is a list of postings that sum to zero (debits positive,
|
|
180
|
+
credits negative). The general form handles any complexity — a paycheck with a
|
|
181
|
+
401(k) deduction, for example:
|
|
182
|
+
|
|
183
|
+
```sh
|
|
184
|
+
beans tx add --desc "Paycheck" --date 2026-02-15 \
|
|
185
|
+
--post Assets:Checking 4000 \
|
|
186
|
+
--post Assets:Investments:Retirement 1000 \
|
|
187
|
+
--post Income:Salary # balances to -5000
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
For the common cases there are shortcuts, each a balanced two-leg entry:
|
|
191
|
+
|
|
192
|
+
```sh
|
|
193
|
+
beans spend 54.20 Dining --from "Credit Card" -m "Pizza night"
|
|
194
|
+
beans earn 120 Interest --to Savings
|
|
195
|
+
beans transfer 500 Checking Savings
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
`spend`/`earn` default the cash side to your checking account; change it with
|
|
199
|
+
`beans config set default_account Savings`. Inspect and correct history with:
|
|
200
|
+
|
|
201
|
+
```sh
|
|
202
|
+
beans tx list --period this-month
|
|
203
|
+
beans tx show 42
|
|
204
|
+
beans tx void 42 # voids keep the audit trail; nothing is deleted
|
|
205
|
+
beans undo # void the most recent transaction (typo insurance)
|
|
206
|
+
beans search "whole foods" # full-text over descriptions/payees
|
|
207
|
+
beans tx add --like 42 --date today # clone a prior transaction
|
|
208
|
+
beans register Checking --period ytd # running-balance view of one account
|
|
209
|
+
beans balances # everything, grouped by type
|
|
210
|
+
beans report trial # the accountant's sanity check
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
After `beans spend` against a budgeted category, you get instant feedback
|
|
214
|
+
("Groceries: 92% of June budget used"), and any command reminds you (on
|
|
215
|
+
stderr) when recurring rules are due.
|
|
216
|
+
|
|
217
|
+
### Recurring transactions
|
|
218
|
+
|
|
219
|
+
Bills, paychecks, subscriptions — define them once and post them on demand:
|
|
220
|
+
|
|
221
|
+
```sh
|
|
222
|
+
beans recur add rent --freq monthly --start 2026-07-01 \
|
|
223
|
+
--post Expenses:Housing:Rent 1800 --post Assets:Checking
|
|
224
|
+
beans recur add paycheck --freq biweekly --start 2026-07-03 \
|
|
225
|
+
--desc "Salary deposit" --post Assets:Checking 2500 --post Income:Salary
|
|
226
|
+
|
|
227
|
+
beans recur list # shows which rules are due
|
|
228
|
+
beans recur run --dry-run # preview everything due through today
|
|
229
|
+
beans recur run # post it (idempotent — run as often as you like)
|
|
230
|
+
beans recur run --to 2026-12-31 # post ahead, e.g. for planning
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
Frequencies: `daily`, `weekly`, `biweekly`, `monthly`, `quarterly`,
|
|
234
|
+
`yearly`. Monthly-style rules anchor to the start date's day-of-month and
|
|
235
|
+
clamp to short months (a rule started Jan 31 posts Feb 28, then Mar 31).
|
|
236
|
+
Rules can have an `--end` date, be `pause`d/`resume`d, and `remove`d —
|
|
237
|
+
already-posted transactions always stay in the ledger, tagged `recurring`.
|
|
238
|
+
|
|
239
|
+
### Periods
|
|
240
|
+
|
|
241
|
+
Reports accept `--period` with: `ytd`, `all`, `this-month`, `last-month`,
|
|
242
|
+
`this-quarter`, `last-quarter`, `this-year`, `last-year`, `2026`, `2026-06`,
|
|
243
|
+
`2026-Q2` — or explicit `--from`/`--to` dates.
|
|
244
|
+
|
|
245
|
+
## Financial statements
|
|
246
|
+
|
|
247
|
+
```sh
|
|
248
|
+
beans report income --period 2026-Q1 --compare # with prior-quarter deltas
|
|
249
|
+
beans report balance --date 2026-03-31
|
|
250
|
+
beans report cashflow --period 2026
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
The income statement shows each line as a % of total income (a common-size
|
|
254
|
+
view). The balance sheet is **classified** — assets and liabilities are split
|
|
255
|
+
into current and non-current sections (use `--flat` for a by-type-only listing).
|
|
256
|
+
It computes **retained earnings** on the fly —
|
|
257
|
+
cumulative net income that was never formally closed — so
|
|
258
|
+
Assets = Liabilities + Equity always holds. The cash flow statement uses the
|
|
259
|
+
direct method: every transaction that moves cash is classified by the
|
|
260
|
+
counter-account's activity, and the net change reconciles to beginning and
|
|
261
|
+
ending cash. Transactions that move no cash (e.g. groceries charged to a
|
|
262
|
+
credit card) correctly appear in the income statement but not the cash flow
|
|
263
|
+
statement until the card is paid.
|
|
264
|
+
|
|
265
|
+
Add `--json` to any report for machine-readable output:
|
|
266
|
+
|
|
267
|
+
```sh
|
|
268
|
+
beans report balance --json | jq .net_worth
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
## Budgeting
|
|
272
|
+
|
|
273
|
+
```sh
|
|
274
|
+
beans budget set Groceries 600 # monthly by default
|
|
275
|
+
beans budget set Insurance 1200 --period yearly # normalized automatically
|
|
276
|
+
beans budget set Salary 6000 # income targets work too
|
|
277
|
+
beans budget report # this month, budget vs actual
|
|
278
|
+
beans budget report --period 2026-Q1 # scaled to any period
|
|
279
|
+
beans budget list
|
|
280
|
+
beans budget remove Insurance
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
Budgets are normalized to the report period — a $600/month grocery budget shows
|
|
284
|
+
as $1,800 for a quarter and is pro-rated for partial periods.
|
|
285
|
+
|
|
286
|
+
## Reconciliation
|
|
287
|
+
|
|
288
|
+
Check the ledger against reality — your bank statement:
|
|
289
|
+
|
|
290
|
+
```sh
|
|
291
|
+
beans reconcile Checking --balance 4512.33 # where do we stand?
|
|
292
|
+
beans clear Checking 12 14 15 # mark matched entries cleared
|
|
293
|
+
beans clear Checking --through 2026-05-31 # or sweep a whole statement
|
|
294
|
+
beans reconcile Checking --balance 4512.33 # difference -> $0.00
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
The register shows a `*` next to cleared entries, and a nonzero difference
|
|
298
|
+
with no uncleared postings points straight at a missing or duplicated
|
|
299
|
+
transaction. Once a statement is reconciled, lock it:
|
|
300
|
+
|
|
301
|
+
```sh
|
|
302
|
+
beans period close 2026-05-31 # transactions on/before can't change
|
|
303
|
+
beans period status
|
|
304
|
+
beans period reopen
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
## Forecasting
|
|
308
|
+
|
|
309
|
+
```sh
|
|
310
|
+
beans forecast # 6 months from 6-month averages
|
|
311
|
+
beans forecast --months 12 --method trend --lookback 12
|
|
312
|
+
beans forecast --use-budget # budgets drive accounts that have them
|
|
313
|
+
beans forecast --use-recurring # scheduled txns at exact amounts/dates
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
Source priority per account: recurring schedule > budget > history.
|
|
317
|
+
|
|
318
|
+
## Goals
|
|
319
|
+
|
|
320
|
+
```sh
|
|
321
|
+
beans goal add house --account Savings --target 20000 --by 2028-01-01
|
|
322
|
+
beans goal add debt-free --account "Credit Card" --by 2027-06-01 # payoff
|
|
323
|
+
beans goal list # progress bars + required monthly contribution
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
## Investments
|
|
327
|
+
|
|
328
|
+
Hold securities as FIFO lots with a price history; everything stays
|
|
329
|
+
balanced double-entry:
|
|
330
|
+
|
|
331
|
+
```sh
|
|
332
|
+
beans invest buy VTI 10 --price 280 --account Brokerage # cash -> lots
|
|
333
|
+
beans price set VTI 295
|
|
334
|
+
beans invest list # qty, cost basis, market, unrealized
|
|
335
|
+
beans invest mark # post mark-to-market vs Income:Unrealized Gains
|
|
336
|
+
beans invest sell VTI 5 --price 300 --account Brokerage # FIFO, books realized gain
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
`mark` adjusts each investment account's book value to market (assumes the
|
|
340
|
+
account is driven by `invest` commands), so the balance sheet reads like a
|
|
341
|
+
brokerage statement while Assets = Liabilities + Equity still holds.
|
|
342
|
+
|
|
343
|
+
## Loans
|
|
344
|
+
|
|
345
|
+
Attach amortization terms to a liability account and beans derives the payment
|
|
346
|
+
schedule, the split between principal and interest, and — for the balance
|
|
347
|
+
sheet — the **current portion of long-term debt** (principal scheduled to come
|
|
348
|
+
due within the next twelve months):
|
|
349
|
+
|
|
350
|
+
```sh
|
|
351
|
+
beans account add "Liabilities:Auto Loan" --type liability
|
|
352
|
+
beans loan add --account "Auto Loan" --principal 30000 --rate 6.25 --term 60 \
|
|
353
|
+
--start 2026-01-01 # payment derived: 583.48/month
|
|
354
|
+
beans loan show "Auto Loan" # the full amortization schedule
|
|
355
|
+
beans loan list # balance, current portion, non-current, rate
|
|
356
|
+
beans loan pay "Auto Loan" # post one payment: principal + interest + cash out
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
Give `--payment` instead of `--term` to solve for the number of payments. On a
|
|
360
|
+
classified balance sheet the loan's *ledger* balance is split into current and
|
|
361
|
+
non-current buckets using the schedule; the balance itself always comes from the
|
|
362
|
+
ledger, so the two buckets sum to the real balance and the sheet still balances.
|
|
363
|
+
`beans loan pay` computes interest on the actual outstanding balance and posts it
|
|
364
|
+
to `Expenses:Interest`, so extra or missed payments stay accurate. (A variable
|
|
365
|
+
rate or extra principal makes only the *split point* approximate, never the
|
|
366
|
+
totals.)
|
|
367
|
+
|
|
368
|
+
## Multi-currency
|
|
369
|
+
|
|
370
|
+
beans keeps its books in one base currency — the "functional currency", as
|
|
371
|
+
a company would — so every transaction balances and every statement stays
|
|
372
|
+
consistent. Asset and liability accounts can be denominated in a foreign
|
|
373
|
+
currency; their postings carry both the base amount and the foreign amount:
|
|
374
|
+
|
|
375
|
+
```sh
|
|
376
|
+
beans account add "Assets:EUR Savings" --type asset --currency EUR
|
|
377
|
+
beans currency set EUR 1.0832 # base units per 1 EUR
|
|
378
|
+
beans transfer 1100 Checking "EUR Savings" --foreign 1000 # exact EUR
|
|
379
|
+
beans transfer 550 Checking "EUR Savings" # EUR derived from the rate
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
The foreign amount comes from the latest rate on or before the transaction
|
|
383
|
+
date unless given explicitly (`--foreign` on spend/earn/transfer, or a
|
|
384
|
+
third value on `tx add --post ACCOUNT AMOUNT FOREIGN`). Then:
|
|
385
|
+
|
|
386
|
+
```sh
|
|
387
|
+
beans currency list # foreign balances, rates, unrealized FX
|
|
388
|
+
beans currency rates # rate history
|
|
389
|
+
beans currency revalue # post FX gains/losses vs Income:FX Gains
|
|
390
|
+
```
|
|
391
|
+
|
|
392
|
+
`revalue` is the FX twin of `invest mark`: it trues each foreign account's
|
|
393
|
+
base value up to the current rate, so the balance sheet reflects today's
|
|
394
|
+
rates while remaining balanced.
|
|
395
|
+
|
|
396
|
+
## Export & backup
|
|
397
|
+
|
|
398
|
+
```sh
|
|
399
|
+
beans export json -o ledger.json # everything: accounts, transactions,
|
|
400
|
+
# budgets, rules, goals, lots, rates
|
|
401
|
+
beans export csv # one row per posting, for spreadsheets
|
|
402
|
+
beans -f new.db restore ledger.json # rebuild a ledger from a JSON export
|
|
403
|
+
beans backup # timestamped copy next to the ledger
|
|
404
|
+
beans backup ~/backups/ # ...or wherever you keep them
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
Both exports are complete: voided transactions are included (the CSV carries
|
|
408
|
+
a `void` column, `1` for voided rows, alongside `cleared`), so your archived
|
|
409
|
+
data matches the ledger rather than silently dropping voids.
|
|
410
|
+
|
|
411
|
+
The JSON export round-trips: `beans -f new.db restore ledger.json` rebuilds a
|
|
412
|
+
fresh ledger from it — accounts, transactions (with void/cleared flags and
|
|
413
|
+
foreign amounts), budgets, rules, goals, lots, prices, and FX rates — by
|
|
414
|
+
replaying them through the normal write path, so every transaction is
|
|
415
|
+
re-validated to balance. It restores into an empty ledger only (it won't
|
|
416
|
+
overwrite an initialized one), which makes it handy for moving a ledger
|
|
417
|
+
between machines or restoring from a text backup.
|
|
418
|
+
|
|
419
|
+
Backups use SQLite's online backup API, so they're consistent even if
|
|
420
|
+
taken mid-write. Restore the binary snapshot by just pointing at it
|
|
421
|
+
(`beans -f backup.db`); use `restore` for the portable JSON form.
|
|
422
|
+
|
|
423
|
+
Projects monthly income, expenses, net savings, cash position, and net worth,
|
|
424
|
+
with a breakdown of which accounts drive the projection and from what basis
|
|
425
|
+
(history vs budget).
|
|
426
|
+
|
|
427
|
+
## Analysis
|
|
428
|
+
|
|
429
|
+
```sh
|
|
430
|
+
beans analyze --period ytd
|
|
431
|
+
beans networth --months 12 # month-end net worth trend with deltas
|
|
432
|
+
```
|
|
433
|
+
|
|
434
|
+
Reports the ratios you would compute for a company, adapted to a household:
|
|
435
|
+
savings rate (margin), working capital and the current & quick ratios (from the
|
|
436
|
+
current vs non-current split), liquidity runway in months of expenses,
|
|
437
|
+
debt-to-assets, debt-to-annual-income, and your top expense categories as a % of
|
|
438
|
+
income.
|
|
439
|
+
|
|
440
|
+
## Economic balance sheet
|
|
441
|
+
|
|
442
|
+
The accounting balance sheet shows what you own and owe today. The **economic
|
|
443
|
+
balance sheet** adds the present value of the future: your **human capital** (the
|
|
444
|
+
discounted value of income you expect to earn) as an asset, and your **future
|
|
445
|
+
consumption** (the discounted value of your lifetime spending) as a liability,
|
|
446
|
+
plus optional pensions, expected inheritances, and planned bequests.
|
|
447
|
+
|
|
448
|
+
```sh
|
|
449
|
+
beans economic bs --rate 3 --work-years 25 --live-years 40 # quick estimate
|
|
450
|
+
beans economic npv # just the headline
|
|
451
|
+
beans economic create-template -o economic.md # a config to edit
|
|
452
|
+
beans economic bs --file economic.md # a detailed plan
|
|
453
|
+
```
|
|
454
|
+
|
|
455
|
+
Human capital and future consumption are estimated from your recent income/expense
|
|
456
|
+
run-rate, projected over the horizons and discounted — or specified precisely in
|
|
457
|
+
a markdown config document, where each input can be a flat amount or a dated
|
|
458
|
+
cashflow stream (e.g. a salary that stops at retirement, a pension that starts
|
|
459
|
+
later, a one-off inheritance). The forward-looking inputs are assumptions and are
|
|
460
|
+
never posted to your ledger, so the result always reconciles with the accounting
|
|
461
|
+
balance sheet:
|
|
462
|
+
|
|
463
|
+
```
|
|
464
|
+
economic net worth = accounting net worth
|
|
465
|
+
+ human capital + pensions/benefits
|
|
466
|
+
- future consumption - bequests/obligations
|
|
467
|
+
```
|
|
468
|
+
|
|
469
|
+
## CSV import
|
|
470
|
+
|
|
471
|
+
Import bank exports with a `date`, `description`, signed `amount`
|
|
472
|
+
(positive = money in), and optional `category` column:
|
|
473
|
+
|
|
474
|
+
```sh
|
|
475
|
+
beans import bank.csv --account Checking --category Expenses:Other --dry-run
|
|
476
|
+
beans import bank.csv --account Checking --category Expenses:Other
|
|
477
|
+
```
|
|
478
|
+
|
|
479
|
+
Column names are remappable (`--date-col`, `--amount-col`, `--desc-col`,
|
|
480
|
+
`--category-col`) to fit whatever your bank produces.
|
|
481
|
+
|
|
482
|
+
Re-importing overlapping exports is safe: deduplication is count-aware, so
|
|
483
|
+
re-importing the same file is a no-op, but two genuinely distinct rows that
|
|
484
|
+
share a date and amount (say, two identical coffees on one day) both import
|
|
485
|
+
rather than collapsing into one (disable dedupe entirely with `--no-dedupe`).
|
|
486
|
+
Rows without a category are routed by saved rules before falling back to
|
|
487
|
+
`--category`:
|
|
488
|
+
|
|
489
|
+
```sh
|
|
490
|
+
beans rule add "WHOLE FOODS" Groceries
|
|
491
|
+
beans rule add "SHELL" Transportation
|
|
492
|
+
beans rule list
|
|
493
|
+
```
|
|
494
|
+
|
|
495
|
+
## Shell completions
|
|
496
|
+
|
|
497
|
+
```sh
|
|
498
|
+
beans completions bash > ~/.local/share/bash-completion/completions/beans
|
|
499
|
+
beans completions zsh > ~/.zfunc/_beans # with fpath+=(~/.zfunc)
|
|
500
|
+
```
|
|
501
|
+
|
|
502
|
+
Completes commands, subcommands, and account names (via
|
|
503
|
+
`beans account list --names`).
|
|
504
|
+
|
|
505
|
+
## Customization
|
|
506
|
+
|
|
507
|
+
- `beans -f path/to/ledger.db …` or `export BEANS_LEDGER=…` — keep multiple
|
|
508
|
+
ledgers, store them in a synced folder, anything.
|
|
509
|
+
- `beans init --currency EUR` — any ISO code; symbol and decimal places adapt.
|
|
510
|
+
- `beans config set default_account Savings` — default cash side for
|
|
511
|
+
`spend`/`earn`.
|
|
512
|
+
- `beans account modify … --cashflow …` — reshape cash flow classification.
|
|
513
|
+
- `--json` everywhere — pipe into `jq`, spreadsheets, or your own tooling.
|
|
514
|
+
|
|
515
|
+
## Development
|
|
516
|
+
|
|
517
|
+
```sh
|
|
518
|
+
pip install -e .[dev]
|
|
519
|
+
pytest
|
|
520
|
+
```
|
|
521
|
+
|
|
522
|
+
The codebase is small and orthogonal: `ledger.py` (SQLite double-entry core),
|
|
523
|
+
`reports.py` (statements), `budget.py`, `forecast.py`, `analysis.py`,
|
|
524
|
+
`loans.py` (amortization), `economic.py` (economic balance sheet / NPV),
|
|
525
|
+
`importer.py`, `cli.py`. All amounts are stored as
|
|
526
|
+
integers in minor units;
|
|
527
|
+
postings are debit-positive/credit-negative and must sum to zero.
|
|
528
|
+
|
|
529
|
+
## Versioning & releases
|
|
530
|
+
|
|
531
|
+
`beans` uses [semantic versioning](https://semver.org/) with `vX.X.X` tags.
|
|
532
|
+
The version lives in a single place — `beans/__init__.py` — and
|
|
533
|
+
`pyproject.toml` reads it dynamically, so there's nothing to keep in sync by
|
|
534
|
+
hand.
|
|
535
|
+
|
|
536
|
+
Check the installed version any time:
|
|
537
|
+
|
|
538
|
+
```sh
|
|
539
|
+
beans --version
|
|
540
|
+
```
|
|
541
|
+
|
|
542
|
+
**Cutting a release** is a two-step, tag-driven flow (see the
|
|
543
|
+
[manual](docs/MANUAL.md#releasing--publishing) for full detail):
|
|
544
|
+
|
|
545
|
+
```sh
|
|
546
|
+
# 1. Bump the version, commit, and create an annotated vX.X.X tag.
|
|
547
|
+
scripts/bump_version.py v1.2.3
|
|
548
|
+
|
|
549
|
+
# 2. Push the commit and the tag. Pushing the tag is what triggers publishing.
|
|
550
|
+
git push origin HEAD
|
|
551
|
+
git push origin v1.2.3
|
|
552
|
+
```
|
|
553
|
+
|
|
554
|
+
Pushing a `v*` tag runs the [release workflow](.github/workflows/release.yml),
|
|
555
|
+
which:
|
|
556
|
+
|
|
557
|
+
- builds the sdist and wheel and verifies the tag matches the package version,
|
|
558
|
+
- creates a **GitHub Release** with an auto-generated **"What's Changed"**
|
|
559
|
+
section (categorised via [`.github/release.yml`](.github/release.yml)), and
|
|
560
|
+
- publishes the distributions **directly to [PyPI](https://pypi.org/project/beans-ledger/)**
|
|
561
|
+
(as `beans-ledger`) using [Trusted Publishing](https://docs.pypi.org/trusted-publishers/) (OIDC —
|
|
562
|
+
no API tokens stored in the repo).
|
|
563
|
+
|
|
564
|
+
`scripts/bump_version.py --show` prints the current version, and
|
|
565
|
+
`--push` will push the commit and tag for you in one step.
|
|
566
|
+
|
|
567
|
+
## Bugs & feature requests
|
|
568
|
+
|
|
569
|
+
Found a bug or have an idea for a new feature? Email roger@turningbull.com.
|