Living Document Notice
Published 2026-09-17. The evolving architecture, revisions, and connected notes for this dispatch live in the Stax Digital Garden.
Tax Lot Manifest Generation and Depreciation Accounting in DuckDB
Calculating capital asset depreciation and year-end tax manifests across multi-year accounting logs exceeds the capabilities of flat text parsing. Rather than forcing complex SQL schemas onto plaintext notes, Quartermaster projects plain-text ledger entries into an in-memory DuckDB database for analytical processing.
In-Memory Ledger Projection
Quartermaster reads Beancount ledger files, parses them into memory, and registers transactional records as DuckDB tables:
import duckdb
import pandas as pd
def compute_asset_depreciation(ledger_postings):
con = duckdb.connect(database=":memory:")
con.register("postings", pd.DataFrame(ledger_postings))
# Calculate MACRS 5-year depreciation schedules
query = '''
SELECT
account,
SUM(amount) as cost_basis,
SUM(amount) * 0.20 as year_one_depreciation
FROM postings
WHERE account LIKE "Assets:Equipment:%"
GROUP BY account
'''
return con.execute(query).df()DuckDB processes millions of ledger lines in milliseconds, producing IRS Form 4562 depreciation tables and Schedule D capital gain summaries without touching remote tax software.
Analytical Power Without Data Lock-in
By maintaining the single source of truth in human-readable plain-text files and treating relational databases purely as ephemeral compute engines, Quartermaster avoids proprietary database bloat.
- Directus Target: quartermaster
- Garden Source Reference: MOC - Personal Finance, Ledgers & Tax Manifests, MOC - Bosun PKM Tools
- Garden Source Reference: [QTM-1006 - Tax Lot Manifest Generation and Depreciation Accounting in DuckDB](QTM-1006 - Tax Lot Manifest Generation and Depreciation Accounting in DuckDB)