# Awesome Beancount

Beancount 生态系统的精选指南。Beancount 是一款功能强大的开源会计系统，它使用简单的文本格式，通过严谨的双录入复式记账法来管理你的财务。本页面将社区精选列表和生态系统概览整合为一个全面的资源。

## 为什么要进行纯文本会计？

纯文本会计 (PTA) 是一种使用简单的文本文件和强大的命令行工具来管理财务的方法。这种方法让你拥有数据的完整所有权，确保数据的持久性，并为自动化和分析提供了无与伦比的灵活性。

- **官方 PTA 枢纽：** [Plain Text Accounting](https://plaintextaccounting.org/)
- **入门简介：** [Accounting for the simple minds with plain text accounting](https://dustri.org/b/accounting-for-the-simple-minds-with-plain-text-accounting.html)
- **从 Web 应用到命令行：** [Command line accounting: From mint.com to Ledger](https://muehe.org/posts/command-line-accounting/)

***

## Beancount 生态系统

Beancount 生态系统是围绕核心引擎构建的工具、插件和资源的集合。每个组件在创建完整的财务管理工作流中都发挥着特定作用。

### 1. 核心引擎与官方资源

这些是 Beancount 的基础要素，由创建者和官方贡献者维护。

| 资源                 | 描述                                                                                                                                                      |
| ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Beancount (核心)** | 读取你的账本文件、强制执行复式记账规则并生成报告的引擎。它提供了 `bean-check` 和 `bean-format` 等核心命令行工具。所有其他工具都构建于此。                                                                     |
| **主页**             | [beancount.github.io](https://beancount.github.io/)                                                                                                     |
| **源代码**            | [github.com/beancount/beancount](https://github.com/beancount/beancount)                                                                                |
| **文档**             | [GitHub Pages](https://beancount.github.io/docs/) 和 [Google Docs](https://docs.google.com/document/d/1RaondTJCS_IUPBHFNdT8oqFKJjVJDsfsn6JEjBG04eA/edit) |
| **外部贡献**           | [官方社区贡献列表](https://beancount.github.io/docs/external_contributions.html)                                                                                |
| **Beanquery**      | 一个强大的、类似 SQL 的查询工具 (`v3`)，用于对你的账本运行高级查询（例如 `SELECT ... FROM ... WHERE ...`）以生成自定义分析。                                                                    |

### 2. 用户界面

这些工具提供了用于探索和编辑财务数据的可视化界面。

| 工具                         | 描述                                                               |
| -------------------------- | ---------------------------------------------------------------- |
| **Fava**                   | Beancount 的权威、全功能 Web 仪表板。它提供交互式图表、下钻式表格、浏览器内编辑以及用于添加预算等功能的扩展系统。 |
| **Fava-GTK**               | 一个包装了 Fava 的原生 GNOME 桌面应用程序，提供无缝的桌面体验。                           |
| **Beancount Mobile**       | 一款用于在移动端随时随地添加交易的数据录入应用。                                         |
| **Beancount Telegram Bot** | 一个 Telegram 机器人，通过聊天快速向你的账本添加交易。                                 |

### 3. 交易导入

导入是指将来自金融机构的数据（如银行 CSV 或 PDF）转换为 Beancount 条目的过程。

| 工具                          | 描述                                                      |
| --------------------------- | ------------------------------------------------------- |
| **Beangulp (v3)**           | 用于构建导入器的现代独立框架。它通过 Python 脚本（插件）处理外部文件以生成 Beancount 指令。 |
| **Smart Importer**          | 一个通过机器学习增强导入器的工具，可自动预测并分配类别。                            |
| **Beancount Reds Ingestor** | 一组导入器的集合，包含用于处理 CSV 和 OFX 文件的通用库。                       |
| **double-entry-generator**  | 一个基于规则的导入器，专注于支付宝和微信支付等中国服务。                            |

#### 社区导入器（按国家/地区）

由社区维护的针对特定银行和服务的庞大脚本集合。

- **中国**

  - Alipay / 支付宝：[deb-sig/double-entry-generator](https://github.com/deb-sig/double-entry-generator), [wzyboy/importer](https://github.com/wzyboy/awesome-beancount/blob/master/importers/alipay_acclog.py)
  - 招商银行 (CMB)：[借记卡](https://github.com/wzyboy/awesome-beancount/blob/master/importers/cmb_debit_cards.py)，[信用卡](https://github.com/wzyboy/awesome-beancount/blob/master/importers/cmb_credit_cards.py)
  - WeChat Pay / 微信支付：[deb-sig/double-entry-generator](https://github.com/deb-sig/double-entry-generator)

- **法国**

  - Caisse d'Epargne: [beancount-ce](https://github.com/ArthurFDLR/beancount-ce)
  - Boursorama, Amex: [Beancount-myTools](https://github.com/grostim/Beancount-myTools)

- **德国**

  - Commerzbank: [beancount-commerzbank](https://github.com/siddhantgoel/beancount-commerzbank)
  - Deutsche Kredit Bank (DKB): [beancount-dkb](https://github.com/siddhantgoel/beancount-dkb)
  - ING: [beancount-ing](https://github.com/siddhantgoel/beancount-ing)
  - N26: [beancount-n26](https://github.com/siddhantgoel/beancount-n26)
  - Volksbank & GLS-Bank: [beancount-importer-volksbank](https://github.com/Fjanks/beancount-importer-volksbank)

- **印度**
  - SBI, BOI, Paytm, HSBC, ICICI: [beancount-importers-india](https://github.com/dumbPy/beancount-importers-india)

- **荷兰**
  - ABN AMRO: [beancount-abnamro](https://github.com/deepakg/beancount-abnamro)

- **瑞士**

  - 常规：[tariochbctools](https://tariochbctools.readthedocs.io/) (BCGE, Neon, Raiffeisen, ZKB, Fidelity)
  - Finpension: [drnuke-bean](https://github.com/Dr-Nuke/drnuke-bean?tab=readme-ov-file#finpension-importer)
  - PostFinance: [tariochbctools](https://github.com/tarioch/beancounttools/blob/master/src/tariochbctools/importers/postfinance/importer.py), [drnuke-bean](https://github.com/Dr-Nuke/drnuke-bean?tab=readme-ov-file#postfinance-importer-swiss)

- **英国**

  - Monzo, Revolut, Wise: [Evernight/beancount-importers](https://github.com/Evernight/beancount-importers/)
  - Revolut, Wise: [tariochbctools](https://tariochbctools.readthedocs.io/en/latest/importers.html#revolut)

- **美国**

  - Amex, Chase, Citi, Schwab: [mterwill/gist](https://gist.github.com/mterwill/7fdcc573dc1aa158648aacd4e33786e8#file-importers-amex-py)
  - Capital One: [mtlynch/beancount-capitalone](https://github.com/mtlynch/beancount-capitalone)
  - Chase: [mtlynch/beancount-chase-bank](https://github.com/mtlynch/beancount-chase-bank), [ArthurFDLR/beancount-chase](https://github.com/ArthurFDLR/beancount-chase)
  - Clipper: [beancount-clipper](https://git.sr.ht/~goorzhel/beancount-clipper)
  - Mercury: [mtlynch/beancount-mercury](https://github.com/mtlynch/beancount-mercury)

- **区块链**
  - [tariochbctools](https://tariochbctools.readthedocs.io/en/latest/importers.html#blockchain)

### 4. 编辑器支持与工具

将 Beancount 集成到你的开发环境中，以简化编辑和维护工作的工具。

- **IDE 支持：** 提供语法高亮、自动补全和实时余额检查的插件。

  - [VSCode](https://marketplace.visualstudio.com/items?itemName=Lencerf.beancount)
  - [Emacs](https://github.com/beancount/beancount-mode)
  - [Vim](https://github.com/nathangrigg/vim-beancount)
  - [Zed](https://github.com/zed-extensions/beancount)
  - [Sublime Text](https://github.com/norseghost/sublime-beancount)
  - [Atom](https://atom.io/packages/beancount)
  - [Beancount Language Server](https://github.com/polarmutex/beancount-language-server)（适用于任何兼容 LSP 的编辑器）

- **自动化与实用工具：**

  - `bean-add`：从命令行交互式地添加交易。
  - `beancount-black`：一个规范的 Beancount 文件代码格式化工具。
  - `beancount-categorizer`：使用正则表达式规则自动对交易进行分类。
  - `beanahead`：管理并预测未来的交易。

- **数据迁移工具：** 将数据从其他会计系统转换的实用工具。

  - 来自 GnuCash：[henriquebastos/gc-to-bc](https://github.com/henriquebastos/gnucash-to-beancount/), [dtrai2/gc-to-bc](https://github.com/dtrai2/gnucash-to-beancount/)
  - 来自 Ledger/hledger：[travisdahlke/gist](https://gist.github.com/travisdahlke/71152286b0a8826249fe), [zacchiro/ledger2beancount](https://github.com/zacchiro/ledger2beancount)
  - 来自 YNAB：[hoostus/beancount-ynab](https://github.com/hoostus/beancount-ynab)

### 5. 插件（账本扩展）

在处理过程中运行的账本内 Python 模块，用于执行自定义规则、自动化交易或添加新功能。

- **预算管理：**
  - [fava-envelope](https://github.com/polarmutex/fava-envelope)：一个用于信封式预算的 Fava 扩展。

- **自动化与检查：**

  - [autobean.share](https://github.com/SEIAROTg/autobean/tree/master/autobean/share)：费用拆分与债务管理。
  - [autobean.sorted](https://github.com/SEIAROTg/autobean/tree/master/autobean/sorted)：确保交易按时间顺序排序。
  - [beancount-checkclosed](https://github.com/daniel-wells/beancount_checkclosed)：自动检查已关闭账户的余额是否为零。

- **数据操作：**

  - [autobean.narration](https://github.com/SEIAROTg/autobean/tree/master/autobean/narration)：自动生成交易摘要。
  - [beancount-lazy-plugins.filter\_map](https://github.com/Evernight/beancount-lazy-plugins/tree/main?tab=readme-ov-file#filter_map)：对过滤后的交易组执行操作。

### 6. 价格源

获取商品、股票和货币的历史及当前价格，用于跟踪投资价值的脚本。

- [beancount-exchangerates](https://github.com/xuhcc/beancount-exchangerates): 通过 `frankfurter.dev` 等 API 获取法定货币汇率。
- [pricehist](https://gitlab.com/chrisberkhout/pricehist): 一个多源价格获取工具。
- [beancount-cryptoassets](https://github.com/xuhcc/beancount-cryptoassets): 用于获取加密货币价格。
- [tariochbctools](https://tariochbctools.readthedocs.io/): 包含盈透证券 (Interactive Brokers) 的价格源。

***

## 学习与社区

### 书籍与深度指南

- **使用 Python 追踪个人财务 (Tracking Personal Finances using Python):** 一本提供使用 Beancount 构建个人财务系统全面指南的书籍。 ([网站](https://personalfinancespython.com/))
- **中文博客系列 (BYVoid):** [第一部分：为什么？](https://byvoid.com/zhs/blog/beancount-bookkeeping-1), [第二部分：借与贷](https://byvoid.com/zhs/blog/beancount-bookkeeping-2)

### 精选博客文章

- **英文**

  - [使用 Beancount 数豆子——以及更多](https://lwn.net/Articles/751874/)
  - [使用 Python 管理个人财务](https://sgoel.dev/posts/managing-personal-finances-using-python/)
  - [干货版 Beancount 介绍](https://web.archive.org/web/20221119110728/https://blog.leononame.dev/2019/08/beancount/)

- **法文**
  - [Beancount 或属于黑客的会计学](https://cyril.deguet.com/fr/2015/09/03/beancount-comptabilite-pour-hackers/)

- **中文**
  - [Beancount —— 命令行复式簿记](https://wzyboy.im/post/1063.html)

### 社区

- **邮件列表:** [Google Groups](https://groups.google.com/g/beancount) (主要讨论论坛)
- **实时聊天 (IRC):** [web.libera.chat 上的 #beancount 频道](https://web.libera.chat/gamja/?channels=%23beancount)
- **Telegram (中文):** [t.me/beancount\_zh](https://t.me/beancount_zh)

***

## 商业服务与应用

为希望在不自行管理基础设施的情况下使用 Beancount 强大功能的用户提供。

| 服务               | 描述                                                                                                                                                                                            |
| ---------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Beancount.io** | 一个提供开箱即用的 Beancount 和 Fava 实例的软件即服务 (SaaS) 平台。它还提供适用于 [iOS](https://apps.apple.com/app/id1527950512) 和 [Android](https://play.google.com/store/apps/details?id=io.beancount.android) 的专用移动应用。 |

## 让纯文本为你所用。

创建 Beancount 账本，或跟随入门指南搭建自己的环境。

[免费开始使用](https://beancount.io/sign-up/?next=%2Fledger%2F) [入门指南](https://beancount.io/zh/docs/getting-started)

## Where to look next

- [Sitemap](https://beancount.io/sitemap.xml) - all pages with hreflang alternates
- [LLMs index](https://beancount.io/llms.txt) - curated links for AI agents (also /llms-full.txt for full docs)
- [Documentation](https://beancount.io/docs) - every doc is also available as text/markdown via .md suffix or Accept negotiation
- [REST API reference](https://beancount.io/docs/api-reference) - interactive endpoints, schemas, authentication, and code samples
- [OpenAPI spec](https://beancount.io/openapi.json) - OpenAPI 3.1 spec for this website's public content endpoints; the product contract for ledger operations is at https://beancount.io/api-gateway/v1/openapi.json
- [GraphQL](https://beancount.io/graphql) - public, read-only content API over the blog and research logs (no credentials, no ledger data): 12 query fields over 23 types
- [MCP server](https://beancount.io/mcp) - Model Context Protocol at https://beancount.io/api-gateway/mcp
