├── .github └── workflows │ └── go.yml ├── .gitignore ├── .goreleaser.yml ├── LICENSE.txt ├── Makefile ├── README.md ├── balances.go ├── balances_test.go ├── date.go ├── date_test.go ├── decimal ├── decimal.go └── decimal_test.go ├── go.mod ├── go.sum ├── include_test.go ├── ledger ├── book │ ├── book.toml │ ├── genbook.bash │ ├── genperf.bash │ └── src │ │ ├── 01_01_Installation.md │ │ ├── 01_02_FileFormat.md │ │ ├── 01_03_RunningLedger.md │ │ ├── 02_Accounts.md │ │ ├── 02_Balance.md │ │ ├── 02_Equity.md │ │ ├── 02_Export.md │ │ ├── 02_Import.md │ │ ├── 02_Print.md │ │ ├── 02_Register.md │ │ ├── 02_Stats.md │ │ ├── Editing_VimPlugin.md │ │ ├── Example.md │ │ ├── Introduction.md │ │ ├── LICENSE.md │ │ ├── Performance.md │ │ ├── SUMMARY.md │ │ ├── Web_Accounts.md │ │ ├── Web_AddTransaction.md │ │ ├── Web_GeneralLedger.md │ │ ├── Web_Overview.md │ │ ├── Web_Portfolio.md │ │ ├── Web_Quickview.md │ │ ├── Web_Reports.md │ │ ├── consoleshots │ │ ├── vimfold.png │ │ └── vimsyn.png │ │ ├── ledger.dat │ │ ├── portfolio-stocks.toml │ │ ├── portfolio.toml │ │ ├── quickview.toml │ │ ├── reports.toml │ │ ├── transactions.csv │ │ └── webshots │ │ ├── account.png │ │ ├── accounts.png │ │ ├── addtrans.png │ │ ├── general-ledger.png │ │ ├── portfolio-crypto.png │ │ ├── quickview.png │ │ ├── report-expenses.png │ │ ├── report-networth.png │ │ └── report-savings.png ├── cmd │ ├── export.go │ ├── financialQuotes.go │ ├── import.go │ ├── internal │ │ ├── httpcompress │ │ │ └── compress.go │ │ └── pdr │ │ │ ├── grammar.peg │ │ │ ├── grammar.peg.go │ │ │ ├── pdr.go │ │ │ └── pdr_test.go │ ├── lint.go │ ├── print.go │ ├── printAccounts.go │ ├── printBalance.go │ ├── printEquity.go │ ├── printRegister.go │ ├── root.go │ ├── static │ │ ├── bootstrap-5.3.2.bundle.min.js │ │ ├── bootstrap-5.3.2.min.css │ │ ├── chart-4.4.0.umd.js │ │ ├── datatables-1.13.4.min.css │ │ ├── datatables-1.13.4.min.js │ │ ├── daterangepicker.css │ │ ├── daterangepicker.js │ │ ├── dropdown.css │ │ ├── favicon.ico │ │ ├── jquery-3.7.1.min.js │ │ └── moment.min.js │ ├── stats.go │ ├── templates │ │ ├── template.account.html │ │ ├── template.accounts.html │ │ ├── template.addtransaction.html │ │ ├── template.barlinechart.html │ │ ├── template.common.html │ │ ├── template.leaderboardchart.html │ │ ├── template.ledger.html │ │ ├── template.piechart.html │ │ ├── template.portfolio.html │ │ └── template.quickview.html │ ├── version.go │ ├── web-portfolio-sample.toml │ ├── web-quickview-sample.toml │ ├── web-reports-sample.toml │ ├── web.go │ ├── webConfig.go │ ├── webHandlerAccounts.go │ ├── webHandlerLedger.go │ ├── webHandlerPortfolio.go │ ├── webHandlerReport.go │ └── webLoadTemplate.go ├── genprofile.bash ├── internal │ └── fastcolor │ │ ├── LICENSE.txt │ │ └── fastcolor.go ├── main.go └── man │ ├── ledger.1 │ └── ledger.5 ├── ledgerReader.go ├── ledgerReader_test.go ├── linescanner.go ├── logo.png ├── parse.go ├── parseFuzz_test.go ├── parse_test.go ├── testdata ├── ledger-2021-05.dat ├── ledger-2022-01.dat ├── ledger-2022-02.dat ├── ledger-2022-04.dat ├── ledgerBench.dat ├── ledgerRoot.dat ├── ledgerRootGlob.dat ├── ledgerRootNonExist.dat └── ledgerRootUnbalanced.dat ├── types.go └── vim-ledger ├── ftplugin └── ledger.vim └── syntax └── ledger.vim /.github/workflows/go.yml: -------------------------------------------------------------------------------- 1 | name: Go 2 | 3 | on: 4 | push: 5 | branches: [ master ] 6 | pull_request: 7 | branches: [ master ] 8 | 9 | jobs: 10 | 11 | build: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - uses: actions/checkout@v3 15 | 16 | - name: Set up Go 17 | uses: actions/setup-go@v3 18 | with: 19 | go-version: '>=1.20.0' 20 | check-latest: true 21 | 22 | - name: Build 23 | run: go build -v ./... 24 | 25 | - name: Test 26 | run: go test -v -coverprofile=profile.cov . ./decimal 27 | 28 | - uses: shogo82148/actions-goveralls@v1 29 | with: 30 | path-to-profile: profile.cov 31 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.dat 2 | *.exe 3 | bin 4 | pkg 5 | dist 6 | html-book 7 | src-book 8 | -------------------------------------------------------------------------------- /.goreleaser.yml: -------------------------------------------------------------------------------- 1 | # .goreleaser.yml 2 | before: 3 | hooks: 4 | - make docs 5 | builds: 6 | - 7 | env: 8 | - CGO_ENABLED=0 9 | id: "ledger" 10 | main: ./ledger/. 11 | binary: ledger 12 | ldflags: 13 | - -s -w -X github.com/howeyc/ledger/ledger/cmd.version={{.Version}} 14 | goos: 15 | - windows 16 | - darwin 17 | - linux 18 | - freebsd 19 | - openbsd 20 | goarch: 21 | - amd64 22 | - arm64 23 | archives: 24 | - 25 | builds: 26 | - ledger 27 | files: 28 | - docs/* 29 | - LICENSE.txt 30 | wrap_in_directory: true 31 | format_overrides: 32 | - goos: windows 33 | format: zip 34 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013 Chris Howey 2 | 3 | Permission to use, copy, modify, and distribute this software for any 4 | purpose with or without fee is hereby granted, provided that the above 5 | copyright notice and this permission notice appear in all copies. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 8 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 9 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 10 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 11 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 12 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 13 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 14 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: docs clean release snapshot 2 | 3 | docs: 4 | mkdir -p docs 5 | mandoc -Tpdf -l ledger/man/ledger.1 > docs/ledger.1.pdf 6 | mandoc -Tpdf -l ledger/man/ledger.5 > docs/ledger.5.pdf 7 | cp ledger/man/ledger.1 docs/ 8 | cp ledger/man/ledger.5 docs/ 9 | 10 | snapshot: 11 | goreleaser --skip-publish --rm-dist --snapshot 12 | 13 | release: 14 | goreleaser 15 | 16 | clean: 17 | rm -rf docs dist 18 | 19 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [](https://en.wikipedia.org/wiki/ISC_license) 2 | [](https://github.com/howeyc/ledger/releases) 3 | [](https://github.com/howeyc/ledger/releases) 4 | [](https://matrix.to/#/#plaintextaccounting:libera.chat) 5 | [](https://goreportcard.com/report/github.com/howeyc/ledger) 6 | [](https://pkg.go.dev/github.com/howeyc/ledger) 7 | [](https://coveralls.io/github/howeyc/ledger?branch=master) 8 | 9 |
Account | 37 |Balance | 38 |Balance | 39 |
---|---|---|
{{abbrev .Name}} | 45 |{{.Name}} | 46 |{{.Balance.StringFixedBank}} | 47 |
Name | 35 |Amount | 36 |
---|---|
{{lastaccount $acc.Name}} | 42 |
43 |
44 |
48 |
47 | |
49 |
Name | 37 |Cost | 38 |Market Value | 39 | {{if $.ShowWeight}} 40 |Weight | 41 | {{end}} 42 | {{if $.ShowDividends}} 43 |Annual Dividends | 44 |Annual Yield | 45 | {{end}} 46 |Price | 47 |Pct Chg | 48 |Gain / Loss | 49 |Ovr Pct Chg | 50 |Gain / Loss | 51 |
---|---|---|---|---|---|---|---|---|---|---|
{{.Name}} | 57 |{{printf "%.2f" .Cost}} | 58 |{{printf "%.2f" .MarketValue}} | 59 | {{if $.ShowWeight}} 60 |{{printf "%.2f" .Weight}} | 61 | {{end}} 62 | {{if $.ShowDividends}} 63 |{{printf "%.2f" .AnnualDividends}} | 64 |{{printf "%.2f" .AnnualYield}} | 65 | {{end}} 66 |{{printf "%.2f" .Price}} | 67 |{{printf "%.2f" .PriceChangePctDay}} |
68 | {{printf "%.2f" .GainLossDay}} |
69 | {{printf "%.2f" .PriceChangePctOverall}} |
70 | {{printf "%.2f" .GainLossOverall}} |
71 |
Account | 37 |Balance | 38 ||
---|---|---|
44 | {{qvshortname .Name}} 45 | {{if not $.ReadOnly}} 46 | 47 | {{end}} 48 | | 49 |50 | {{.Name}} 51 | {{if not $.ReadOnly}} 52 | 53 | {{end}} 54 | | 55 |{{.Balance.StringFixedBank}} | 56 |