惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

GbyAI
GbyAI
L
LINUX DO - 热门话题
月光博客
月光博客
B
Blog
博客园 - 叶小钗
美团技术团队
D
Docker
A
About on SuperTechFans
Stack Overflow Blog
Stack Overflow Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
WordPress大学
WordPress大学
P
Proofpoint News Feed
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Y
Y Combinator Blog
V
V2EX
Apple Machine Learning Research
Apple Machine Learning Research
博客园 - 三生石上(FineUI控件)
The Register - Security
The Register - Security
博客园_首页
The Cloudflare Blog
I
InfoQ
T
Tailwind CSS Blog
MongoDB | Blog
MongoDB | Blog
Engineering at Meta
Engineering at Meta
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Microsoft Azure Blog
Microsoft Azure Blog
有赞技术团队
有赞技术团队
C
CERT Recently Published Vulnerability Notes
AWS News Blog
AWS News Blog
Spread Privacy
Spread Privacy
V
Visual Studio Blog
博客园 - Franky
Cloudbric
Cloudbric
Help Net Security
Help Net Security
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
N
News and Events Feed by Topic
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Webroot Blog
Webroot Blog
博客园 - 【当耐特】
TaoSecurity Blog
TaoSecurity Blog
B
Blog RSS Feed
N
News | PayPal Newsroom
人人都是产品经理
人人都是产品经理
H
Heimdal Security Blog
L
LangChain Blog
PCI Perspectives
PCI Perspectives
Jina AI
Jina AI
Google DeepMind News
Google DeepMind News
Schneier on Security
Schneier on Security

Stonecharioteer on Tech

I Traced My Traffic Through a Home Tailscale Exit Node What Was I Reading Last? In Three Not-So-Easy Pieces Dogfooding Is Hard Code blocks in your books, finally GoForGo v0.9.0 Merrilin - We built an app to read books I use a Macbook now Data Structures & Algorithms - Preparing for Interviews Using a local DNS namespace for local service discovery Direction KOllector - Publishing KOReader Highlights gbt: branches touched in the last 24 hours A Soiree into Symbols in Ruby Some Smalltalk about Ruby Loops Ruby Blocks Returning from Ruby Blocks, Procs and Lambdas My Linux Laptop Finally Works: How Claude Helped Me Fix Years of Annoyances TIL: Watchexec - Modern File Watching for Development Workflows A Less Busy Mind GoForGo - Learn Go through live examples Migrating My Old Blog to Hugo with Claude The Qtile Window Manager: A Python-Powered Tiling Experience Read the RFCs that Built the Internet Py-x-Protobuf - Or How I Learned to Stop Worrying and Love Protocol Buffers Python Reverse a List New Beginnings Leaving ChainSafe Systems Screen Lock for Cinnamon Desktop using Zenity and Terminal Commands Crews Not Teams A System for Getting Better at LeetCode So Far So Rust Retrying HTTP Requests with Rust A Primer on Control Charts Learning Rust Explicit is Better than Implicit: Rust for Pythonistas Using Custom Delimiters in Jinja Templates TIL: Creating Fixed Length Iterables in Python Documentation Without Assumption Vagrant Python - A Reflection in 2022 Learning Golang No, A Virtual Machine Is Not Enough: Why Developers Need Native Linux Empathy in Tech For Those Who Came in Late A Weekend With PostgreSQL TIL: Gooey and Python Fire for Quick GUIs and CLIs TIL: 2ality - Dr. Axel Rauschmayer's JavaScript Blog TIL: MassDNS - High-Performance Bulk DNS Lookups TIL: Matomo Analytics, Google Tech Writing, Memory Programming, and NES TV Signals TIL: MontyDB - MongoDB Implemented in Python Returning to the Craft of Programming TIL: CPUFetch, OneFetch, and Learn CSS TIL: DNS Performance Testing and Pi-hole with Unbound TIL: Eli Bendersky's Blog, Awesome By Example, NoCoDB, and Martin Kleppmann TIL: CRDTs, Extreme HTTP Performance, and BYTEPATH Game TIL: AutoInvent, ASGI, Python Packaging, RAPIDS GPU Computing, and FlaskCon TIL: MangaDesk - Terminal Client for MangaDex TIL: McFly - Smart Shell History Search TIL: Siege Load Testing and Awesome FastAPI Resources TIL: Ventoy Bootable USB and Justniffer Network Analysis TIL: CLI Code Review, Git Split Diffs, and Internal Combustion Engine TIL: Benford's Law, Web Security Headers, Event Sourcing, and Mozilla Security Guidelines How to Write Documentation - The README.md File The Importance of Documentation TIL: NNgroup UX Research, SponsorBlock, and Labella Python Library TIL: The Little Book of Rust Macros and Rust Performance Book TIL: Git-Bug Distributed Issue Tracker and Omni Kubernetes Monitoring TIL: Zellij - Modern Terminal Multiplexer TIL: How Discord Handles 2.5 Million Concurrent Voice Users TIL: Volumio - The Audiophile Music Player TIL: Areopagitica - Milton's Defense of Free Speech TIL: Fast Node Manager, Zoxide Smart CD, Technical Writing, PyO3, and Qubes OS TIL: Slurm Workload Manager for HPC Clusters TIL: Data Visualization Guide and Oso Authorization Academy TIL: CORS Deep Dive, Piku Tiny PaaS, Rust Strings, and Deno Standard Library TIL: Raspberry Pi OS Development, Vim Beginner Guide, Password Management, and QueryBook TIL: uBlock Origin Performance Optimization on Firefox TIL: Breaking PostgreSQL at Scale and LeetCode Problem Patterns TIL: Awesome Tmux Resources for Terminal Multiplexing TIL: Grit - A Multitree-Based Personal Task Manager TIL: Lens 4.2 Kubernetes IDE, Shell Scripting Guide, and Dark HTTP Server Do The Job You Hate So You Won't Hate The Job You Love TIL: Innernet VPN Solution and NoteCalc Calculator App TIL: Argo CD for GitOps and Lens Kubernetes IDE TIL: Modern Rust CLI Tools - System Monitoring, HTTP Requests, and DNS TIL: tz - A Time Zone Helper Tool TIL: Distributed Systems Education, Fallacies, and Self-Hosted Internet Archiving TIL: Real-Time Voice Cloning Technology TIL: ChartMuseum for Helm, AMD's Corporate Journey, and Kubernetes Pod Scaling TIL: Docker and Kubernetes Tools - Whaler, Descheduler, and Dive TIL: Post-Mortem Collection, Terminal Plotting, and Technical Twitter TIL: Dark Mode Toggle Web Component by Google Chrome Labs TIL: Python eval(), exec(), and compile() Functions TIL: Camelot PDF Tables, PostgreSQL Row Level Security, Zerodha Varsity, and Write Yourself a Git TIL: fuser Command for Process and File Investigation TIL: i Hate Regex - The Ultimate Regex Cheat Sheet TIL: Dolt - Git for Data and Database Version Control TIL: x86 Assembly Programming and SafeEyes Break Reminder TIL: Comprehensive Distributed Systems Reading List TIL: Cosmopolitan C Library, Distributed Systems Book, High Performance Browser Networking, and Rust Roguelike Tutorial
TIL: Plain Text Accounting with Beancount, Ledger, and Fava
2021-01-13 · via Stonecharioteer on Tech

Introduction to Plain Text Accounting

Introduction to plain text accounting — sirodoht blog

Revolutionary approach to personal and business accounting using simple text files:

Core Philosophy:

  • Human Readable: Accounting records in plain text format
  • Version Control: Track financial changes with Git
  • Durability: Text files last forever, proprietary formats don’t
  • Transparency: Every transaction is visible and auditable
  • Scriptable: Automate analysis with standard text processing tools

Double-Entry Bookkeeping Principles:

Fundamental Equation:

Assets + Expenses = Liabilities + Equity + Income

Every Transaction Has Two Sides:

2021-01-13 * "Grocery shopping"
  Expenses:Food:Groceries    45.67 USD
  Assets:Checking           -45.67 USD

Explanation:

  • Money flows OUT of checking account (asset decreases)
  • Money flows INTO grocery expense (expense increases)
  • Total change = 0 (books balance)

Benefits of Plain Text Accounting:

Advantages Over Traditional Software:

  • No Vendor Lock-in: Your data remains accessible forever
  • Version Control: Complete audit trail of changes
  • Automation: Scripts can generate and analyze transactions
  • Customization: Unlimited flexibility in categorization
  • Privacy: Data stays on your computer
  • Cost: Free and open source tools

Developer-Friendly Features:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# Version control your finances
git add finances.beancount
git commit -m "Added Q4 2021 expenses"

# Analyze with standard tools
grep "Expenses:Food" finances.beancount | wc -l
awk '/Expenses:Transport/ {sum += $2} END {print sum}' finances.beancount

# Backup and sync
rsync -av finances/ backup-server:/accounting/

Beancount - Python-Based Accounting

beancount: Double-Entry Accounting from Text Files

Modern, powerful plain text accounting system:

Syntax and Structure:

Basic Transaction Format:

; Account declarations
1900-01-01 open Assets:US:BofA:Checking         USD
1900-01-01 open Expenses:Food:Restaurant        USD
1900-01-01 open Expenses:Transport:Uber         USD
1900-01-01 open Income:US:Company:Salary        USD

; Transactions
2021-01-13 * "Lunch at Italian restaurant"
  Expenses:Food:Restaurant   28.50 USD
  Assets:US:BofA:Checking   -28.50 USD

2021-01-13 * "Uber ride to work"
  Expenses:Transport:Uber    12.45 USD
  Assets:US:BofA:Checking   -12.45 USD

2021-01-15 * "Salary deposit"
  Assets:US:BofA:Checking   3500.00 USD
  Income:US:Company:Salary -3500.00 USD

Advanced Features:

; Price declarations
2021-01-13 price AAPL 150.00 USD

; Investment transactions
2021-01-13 * "Buy Apple stock"
  Assets:US:Schwab:AAPL     10 AAPL {150.00 USD}
  Assets:US:Schwab:Cash   -1500.00 USD

; Multi-currency support
2021-01-13 * "European vacation expense"
  Expenses:Travel:Hotel     120.00 EUR
  Assets:US:BofA:Checking  -142.80 USD @ 1.19 USD/EUR

; Budgets and forecasting
2021-01-01 budget Assets:US:BofA:Checking   "Monthly budget: 4000 USD"

Command Line Tools:

Basic Operations:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# Validate file syntax
bean-check finances.beancount

# Generate balance sheet
bean-report finances.beancount balsheet

# Income statement
bean-report finances.beancount income

# Custom queries
bean-query finances.beancount "SELECT account, sum(position) WHERE date >= 2021-01-01"

# Export to other formats
bean-report finances.beancount holdings --format=csv > holdings.csv

Data Validation and Error Checking:

; Assertions to catch errors
2021-01-31 balance Assets:US:BofA:Checking  2847.55 USD

; Padding for unknown transactions
2021-01-01 pad Assets:US:BofA:Checking Equity:Opening-Balances

; Close accounts when no longer used
2021-12-31 close Assets:US:OldBank:Savings

Fava - Web Interface for Beancount

Welcome to Fava! — Fava documentation

Beautiful web interface for Beancount files:

Key Features:

Interactive Dashboard:

  • Real-time Updates: Automatically reload when files change
  • Charts and Graphs: Visual representation of financial data
  • Drill-down Analysis: Click through from summaries to transactions
  • Multi-file Support: Handle complex accounting setups

Web Interface Benefits:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# Start Fava server
fava finances.beancount

# Access at http://localhost:5000
# Features available:
# - Balance sheets and income statements
# - Account hierarchies and drill-downs
# - Transaction search and filtering
# - Import helpers for bank data
# - Budget vs actual reporting

Advanced Analysis:

Custom Reports:

; Custom reporting periods
2021-01-01 custom "fava-option" "fiscal-year-end" "03-31"

; Budget definitions
2021-01-01 custom "budget" Assets:US:BofA:Checking  "4000 USD"
2021-01-01 custom "budget" Expenses:Food            "800 USD"

Import Automation:

  • Bank CSV Import: Convert bank statements to Beancount format
  • Duplicate Detection: Automatic detection of duplicate transactions
  • Categorization: Machine learning-based expense categorization
  • Reconciliation: Match imported transactions with manual entries

Ledger - The Original Plain Text Accounting

ledger, a powerful command-line accounting system

The pioneering plain text accounting system:

Core Features:

Simple Syntax:

2021/01/13 Grocery Store
    Expenses:Food:Groceries        $45.67
    Assets:Checking

2021/01/13 Salary
    Assets:Checking             $3,500.00
    Income:Salary

2021/01/15 Investment
    Assets:Brokerage:AAPL       10 AAPL @ $150.00
    Assets:Checking            $-1,500.00

Powerful Queries:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# Basic reports
ledger -f finances.ledger balance
ledger -f finances.ledger register

# Time-based analysis
ledger -f finances.ledger balance --period "this month"
ledger -f finances.ledger register --period "last year"

# Complex queries
ledger -f finances.ledger balance ^Expenses --depth 2
ledger -f finances.ledger register Expenses:Food --monthly

Advanced Capabilities:

Budgeting and Forecasting:

1
2
3
4
5
6
7
8
# Budget vs actual
ledger -f finances.ledger balance --budget

# Forecast future cash flow
ledger -f finances.ledger register --forecast "next 6 months"

# Investment tracking
ledger -f finances.ledger balance --market --price-db prices.db

Ecosystem and Tools:

Supporting Applications:

  • hledger: Haskell implementation with additional features
  • PlainTextAccounting.org: Community and resources
  • Mobile Apps: Various mobile entry applications
  • Bank Integration: Tools for automatic transaction import

Practical Implementation:

Getting Started Workflow:

1. Set Up Account Structure:

1900-01-01 open Assets:US:BofA:Checking         USD
1900-01-01 open Assets:US:BofA:Savings          USD
1900-01-01 open Expenses:Food:Groceries         USD
1900-01-01 open Expenses:Food:Restaurant        USD
1900-01-01 open Expenses:Transport:Gas          USD
1900-01-01 open Expenses:Housing:Rent           USD
1900-01-01 open Income:Salary                   USD

2. Import Historical Data:

1
2
3
4
5
# Convert bank CSV to Beancount
bean-extract config.py statement.csv > imported.beancount

# Merge with main file
cat imported.beancount >> finances.beancount

3. Establish Routine:

1
2
3
4
5
6
#!/bin/bash
# Daily accounting routine
bean-check finances.beancount || exit 1
fava finances.beancount &
echo "Fava started at http://localhost:5000"
echo "Add today's transactions and review accounts"

Best Practices:

  • Consistent Naming: Establish and stick to account naming conventions
  • Regular Reconciliation: Match against bank statements monthly
  • Backup Strategy: Version control and offsite backups
  • Documentation: Comment complex transactions and account purposes
  • Automation: Script repetitive tasks like imports and reports

Plain text accounting represents a powerful paradigm shift in financial management, combining the rigor of double-entry bookkeeping with the flexibility and transparency of plain text files.