Skip to main content

beancount importers for Chinese

Project description

beancount-daoru

PyPI - Version Ask DeepWiki

一个专为中文用户设计的 Beancount 账单导入工具,让复式记账更高效。

项目仍在开发中,API 可能会发生变化,欢迎反馈或建议。

功能

亮点:

  • 多源账单覆盖:支持主流支付平台,以及部分银行账单

  • 原生格式解析:直接导入 PDF/CSV/XLSX 原始账单,无需手动转换

  • LLM 智能分类:集成大语言模型自动预测交易分类

  • 官方生态兼容:适配 Beangulp导入流程, 支持 Fava 可视化导入

  • 灵活账户映射:支持多账户区分,自定义币种配置

当前支持的账单源:

导出方式 格式
支付宝 APP导出,全部勾选,发送到邮箱 csv
微信 APP导出,全部勾选,发送到邮箱 xlsx
京东 APP导出,全部勾选,发送到邮箱 csv
美团 APP导出,全部勾选,发送到邮箱 csv
中国银行 APP导出,全部勾选,APP内下载 pdf
交通银行 APP导出,全部勾选,发送到邮箱 pdf

使用

安装

pip install beancount-daoru

如果需要使用 LLM 功能,需要安装额外依赖:

pip install beancount-daoru[llm]

简单用例

最简单的使用方式是创建一个导入配置脚本,例如 import.py

import beangulp
from beancount_daoru import AlipayImporter

CONFIG = [
    AlipayImporter(
        account_mapping={
            "your-alipay-account-name": {
                None: "Assets:Alipay",
                "余额": "Assets:Alipay:Balance",
                "余额宝": "Assets:Alipay:YuEBao",
                "中国银行(xxxx)": "Assets:Bank:BOC",
            }
        },
        currency_mapping={
            None: "CNY",
        },
    ),
]

if __name__ == "__main__":
    ingest = beangulp.Ingest(CONFIG)
    ingest()

然后运行 beangulp 命令识别、导入并归档账单文件,例如:

# 识别账单文件
python import.py identify /path/to/your/bills/dir
# 导入账单文件
python import.py extract /path/to/your/bills/dir -o output.beancount
# 归档账单文件
python import.py archive /path/to/your/bills/dir -o /path/to/your/archive/dir

另一种方法是在 Fava 中进行可视化导入,需要在主账本中添加import-configimport-dirs 这两个配置,具体参阅 Fava 帮助文档

工具通过文件名识别账单,导入时务必保留账单原始文件名。 更多使用用例可参考源码中示例。

延伸

相关项目

国内项目:

  • double-entry-generator: 基于规则将各种账单格式转换为 Beancount 或 Ledger 格式
    • BeanBridge: double-entry-generator 的 Web 前端实现
    • bill-parser: 将非 Excel 账单文件(PDF/EML 等)转换为 CSV 格式
  • beancount-gs: 基于 beancount 提供个人记账财务管理的 RESTful API 服务(包含前端页面)
  • Beancount-Trans: 一款(自托管)智能账单转换平台,帮助用户轻松将日常账单(如支付宝、微信支付、银行账单等)转换为专业记账格式,并提供完整的财务报表服务。
  • china_bean_importers: Beancount 导入脚本,不支持 Beancount 3
  • beancount-homemade-importers: 一些在中国用的Beancount导入设置
  • beancount_cc_importers: Simple importers for personal usage

国外项目:

  • smart_importer: beancount 官方提供的基于机器学习的分类预测器
  • Beancount Red's Importers: Simple ingesting tools for Beancount. More importantly, a framework to allow you to easily write your own importers.
  • Beanborg: Automatic AI-powered transactions categorizer for Beancount.
  • BeanHub Import: a simple, declarative, smart, and easy-to-use library for importing extracted transactions from beanhub-extract.
  • beanquery-mcp: Beancount MCP Server is an experimental implementation that utilizes the Model Context Protocol (MCP) to enable AI assistants to query and analyze Beancount ledger files using Beancount Query Language (BQL) and the beanquery tool.

不活跃项目:

  • bento: A personal finance management system built with Beancount and Fava, providing automated transaction imports and classification.
  • Beancount-CSVImporter: CSVImporter for beancount, mainly used to import transaction records of Alipay and WeChat
  • BeancountSample: BeancountSample
  • beancount_importer: a GUI tool for importing Alipay/Wechat bill to beancount file
  • beancollect: 为 beancount 开发的账单导入工具

推荐阅读

基础:

使用分享:

自动化探讨:

LLM 研究:

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

beancount_daoru-0.1.0.tar.gz (197.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

beancount_daoru-0.1.0-py3-none-any.whl (34.1 kB view details)

Uploaded Python 3

File details

Details for the file beancount_daoru-0.1.0.tar.gz.

File metadata

  • Download URL: beancount_daoru-0.1.0.tar.gz
  • Upload date:
  • Size: 197.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for beancount_daoru-0.1.0.tar.gz
Algorithm Hash digest
SHA256 04d49a8a27e8a6e94b0a3e2f68cf0cd075dd165eefc1a672c3c823eecfacc9de
MD5 9cb224820c66fa75c4a13cb07ea125a9
BLAKE2b-256 bbbdd35c562f03b13fb193e8ccbc4b2ae8fe99536d8fced44a2bcc56ee15de04

See more details on using hashes here.

Provenance

The following attestation bundles were made for beancount_daoru-0.1.0.tar.gz:

Publisher: release.yml on aqni/beancount-daoru

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file beancount_daoru-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for beancount_daoru-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 74c99c21debb5004e19b12bd7ec4f11c438d58954da6635dd4cadfda01235514
MD5 c199a9d154d5c43f63c8de5d3f822f59
BLAKE2b-256 49a3b3fca8f84f1395616babe3c2b2e95c95f23a81d2ef3820f99f2d52998154

See more details on using hashes here.

Provenance

The following attestation bundles were made for beancount_daoru-0.1.0-py3-none-any.whl:

Publisher: release.yml on aqni/beancount-daoru

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page