2 个不稳定版本
0.2.0 | 2023年4月8日 |
---|---|
0.1.0 | 2023年1月19日 |
#83 in 金融
630KB
14K SLoC
Tackler-NG:Tackler CLI 应用程序
这是 Tackler CLI 应用程序的 Rust 版本。
Tackler 是一种基于文本的复式记账会计引擎和报告工具。
项目状态
这是 Rust 版 Tackler 的技术预览版本。
Tackler 日志格式 完全支持,并且也支持 文件系统 和 Git 存储 后端。请参阅 tackler --help
了解如何使用这些。
此 TPR 支持 register
和 balance
报告,支持 商品 和 股份。
由于这是技术预览版本,存在一些缺失功能和与现有 Tackler 实现的已知不一致之处。
构建和安装 tackler
目前您需要 Rust 的夜间频道来构建 tackler
cargo install tackler
# check that it works
tackler --version
tackler --help
简单演示
创建一个游乐场
mkdir -p tackler/txns; cd tackler
让我们记录一些交易数据
cat > txns/journal.txn << EOF
2023-04-01 'It was warm, sunny day
Expenses:Ice_cream 2
Assets:Cash
2023-05-01 'Ice cream 'n soda!
Expenses:BostonCooler 3
Assets:Cash
EOF
创建一些报告
简单余额
tackler --input.file txns/journal.txn --reports balance
输出
BALANCE
-------
0.00 -5.00 Assets
-5.00 -5.00 Assets:Cash
0.00 5.00 Expenses
3.00 3.00 Expenses:BostonCooler
2.00 2.00 Expenses:Ice_cream
=====================
0.00
带有账户过滤器的余额
tackler --input.file txns/journal.txn --reports balance --accounts '^Expenses'
输出
BALANCE
-------
0.00 5.00 Expenses
3.00 3.00 Expenses:BostonCooler
2.00 2.00 Expenses:Ice_cream
=====================
5.00
让我们来真的玩一玩
获取 Tackler 的测试向量和完整源代码
git clone --recurse-submodules https://github.com/e257-fi/tackler-ng
使用 Git 仓库作为交易存储
带有交易校验和的报告
tackler \
--input.git.repo tackler-ng/suite/audit/audit-repo.git \
--input.git.dir txns \
--input.git.ref txns-1E1 \
--reports balance \
--accounts '^a:.*' \
--audit.mode true
输出
Git Storage
commit : 4aa4e9797501c1aefc92f32dff30ab462dae5545
reference : txns-1E1
directory : txns
suffix : txn
message : txns-1E1: 2016/12
Txn Set Checksum
SHA-256 : 9b29071e1bf228cfbd31ca2b8e7263212e4b86e51cfee1e8002c9b795ab03f76
Set size : 10
BALANCE
-------
0.00 -161.00 a:ay2016
-6.00 -6.00 a:ay2016:am02
-14.00 -14.00 a:ay2016:am03
-19.00 -19.00 a:ay2016:am04
-26.00 -26.00 a:ay2016:am05
-1.00 -1.00 a:ay2016:am07
-7.00 -7.00 a:ay2016:am08
-13.00 -13.00 a:ay2016:am09
-19.00 -19.00 a:ay2016:am10
-25.00 -25.00 a:ay2016:am11
-31.00 -31.00 a:ay2016:am12
=====================
-161.00
包含 100_000 项交易的报告
tackler \
--input.git.repo tackler-ng/suite/audit/audit-repo.git \
--input.git.dir txns \
--input.git.ref txns-1E5 \
--reports balance \
--accounts '^a:.*' \
--audit.mode true
输出
Git Storage
commit : cb56fdcdd2b56d41fc08cc5af4a3b410896f03b5
reference : txns-1E5
directory : txns
suffix : txn
message : txns-1E5: 2016/12
Txn Set Checksum
SHA-256 : 27060dc1ebde35bebd8f7af2fd9815bc9949558d3e3c85919813cd80748c99a7
Set size : 100000
BALANCE
-------
0.00 -1574609.01 a:ay2016
-135600.00 -135600.00 a:ay2016:am01
-118950.00 -118950.00 a:ay2016:am02
-135631.00 -135631.00 a:ay2016:am03
-127137.00 -127137.00 a:ay2016:am04
-135616.00 -135616.00 a:ay2016:am05
-127154.00 -127154.00 a:ay2016:am06
-135600.00 -135600.00 a:ay2016:am07
-135603.00 -135603.00 a:ay2016:am08
-127140.00 -127140.00 a:ay2016:am09
-135619.00 -135619.00 a:ay2016:am10
-127126.00 -127126.00 a:ay2016:am11
-133433.00 -133433.00 a:ay2016:am12
=========================
-1574609.01
交易过滤器
过滤器定义
tackler \
--input.git.repo tackler-ng/suite/audit/audit-repo.git \
--input.git.dir txns \
--input.git.ref txns-1E5 \
--reports balance \
--accounts '^a:.*' \
--audit.mode true \
--api-filter-def '{"txnFilter":{"TxnFilterPostingAccount":{"regex":"^a:ay2016:am12"}}}'
交易过滤器定义也可以作为 Base64 ascii 加密字符串提供
--api-filter-def base64:eyJ0eG5GaWx0ZXIiOnsiVHhuRmlsdGVyUG9zdGluZ0FjY291bnQiOnsicmVnZXgiOiJeYTpheTIwMTY6YW0xMiJ9fX0=
输出
Git Storage
commit : cb56fdcdd2b56d41fc08cc5af4a3b410896f03b5
reference : txns-1E5
directory : txns
suffix : txn
message : txns-1E5: 2016/12
Txn Set Checksum
SHA-256 : 51faa6d2133d22d3ff8b60aff57722d1869fc4677911b13161dce558e7498073
Set size : 8406
Filter:
Posting Account: "^a:ay2016:am12$"
BALANCE
-------
0.00 -133433.00 a:ay2016
-133433.00 -133433.00 a:ay2016:am12
========================
-133433.00
更多信息
Tackler 组件在 Crates.io 上
- Tackler CLI 应用程序: tackler
- Tackler 客户端 API: tackler-api
- Tackler 服务器 API: tackler-core
- Tackler Rusty 服务: tackler-rs
依赖项
~22–52MB
~880K SLoC