command line accounting tool
As a former CPA, I could not resist building my own accounting system.
yaml
files as data storecsv
files to yaml
formatCODE_OF_CONDUCT.md
for fundamental guidelinescargo install rust_ledger
Alternatively, clone this repo and do the following:
cargo build --release
to compile the binary/target/release
and copy the rust_ledger
binary in your path: /usr/bin
rust_ledger -l LEDGER_FILE_PATH COMMAND -f OPTION
LEDGERFILEPATH (denoted by -l
) - relative path to location of yaml ledger file
RLEDGER_FILE
in lieu of specifying whenever the program is invoked.-l
is provided with a file path the file provided will be used instead of any RLEDGER_FILE
set.
RLEDGER_FILE=~/rledger.yaml rust_ledger balances
RLEDGER_FILE
can be set as a system or user environment variable.
export RLEDGER_FILE="$HOME/rledger.yaml"
COMMAND - ledger command (account, balance, register, or csv)
OPTION (denoted by -f
) - allows you to filter the output of the register
command by account type. For example, if you wish to only see "expense" transactions in the output, you would pass in expense
as the option here.
RLEDGER_FILE
- Path to rledger file. ex: RLEDGER_FILE=~/rledger.yaml
NO_COLOR
- Disables color output. ex: NO_COLOR=true
Transactions can be expressed in two different ways. One is a "simplified" format for transactions that only impact two accounts:
yaml
- date: 01/01/2020
amount: 200
offset_account: liability:credit_card_amex
description: grocery store
account: expense:expense_general
The sign (debit / credit) associated with the offset_account
value is the opposite of the sign of the value contained in amount
field.
In the above example transaction, since expense_general
was debited by 200, the credit_card_amex
account will be credited by the same amount.
Transactions that involve more than two accounts are expressed in the following manner:
yaml
- date: 01/01/2020
description: grocery store
transaction:
- amount: 20
account: expense:general
- amount: 180
account: expense:grocery
- amount: -200
account: liability:credit_card_amex
Transactions that only involve two accounts can also be expressed in the above format.
cargo test
```
asset:cashchecking
asset:cashsavings
liability:creditcardamex
equity:equity
expense:grocery
expense:general
expense:mortgage
income:general
```
```
asset
asset:cashchecking $ -700.00
asset:cashsavings $ 1000.00
liability
liability:creditcardamex $ -455.00
equity
equity:equity $ -3500.00
expense
expense:grocery $ 635.00
expense:general $ 1020.00
expense:mortgage $ 2000.00
income
income:general 0
check 0
```
```
11/4/2019 weekly groceries grocery $ 455.00 $ 455.00 creditcardamex $ -455.00 0 07/04/2020 mortage mortgage $ 2000.00 $ 2000.00 cashchecking $ -2000.00 0 07/04/2020 stuff general $ 1000.00 $ 1000.00 cashsavings $ -1000.00 0 06/21/2020 grocery store general $ 20.00 $ 20.00 grocery $ 180.00 $ 200.00 cash_checking $ -200.00 0 ```
csv
files to yaml
format expected by rust_ledger
csv
formatcsv
file into the tool, you must rename the columns in the first line of the csv
file in the following schema:
"date","transaction","name","memo","amount"
yaml
file formatyaml
file can be found at examples/example.yaml
yaml
files in the following format:```yaml accounts: - account: amount:
transactions: - date: amount: description: account: offset_account: - date: description: transaction: - amount: account: - amount: account: ```
The ledger format schema is purposely lightweight. The only requirements are as follows:
- the account
field should be expressed in the following format: account_classification:account_name
.
- the amount
field should be a number. It can include up to two (2) decimal points.
- the date
field should be in the following format: MM-DD-YYYY
.