Generate code for double-entry accounting language based on bills. Current bill support:
Current accounting languages support:
The architecture supports expansion. If you need to support new bills (such as bank bills, etc.), you can add a provider. If you need to support new accounting languages, you can add a compiler.
┌───────────┐ ┌──────────┐ ┌────┐ ┌──────────┐ ┌──────────┐
│ translate │->│ provider │->│ IR │->│ compiler │->│ analyser │
└───────────┘ └──────────┘ └────┘ └──────────┘ └──────────┘
alipay beancount alipay
wechat ledger wechat
huobi huobi
htsec htsec
icbc icbc
td td
bmo bmo
Install using Homebrew:
brew install deb-sig/tap/double-entry-generator
Update software using Homebrew:
brew upgrade deb-sig/tap/double-entry-generator
Just download the binary file of the corresponding architecture to your local computer from the GitHub Release page.
go get -u github.com/deb-sig/double-entry-generator
Please see the usage documentation
double-entry-generator translate
--config ./example/alipay/config.yaml
--output ./example/alipay/example-alipay-output.beancount
./example/alipay/example-alipay-records.csv
Among them, --config
is the configuration file. By default, Alipay is used as the provider, and --provider
can also be specified manually. Please refer to the usage documentation for details. The file generated by default is default_output.beancount
. If --output
or -o
specifies an output file, it will be output to the specified file. In the above example, the conversion results will be output to the ./example/alipay/example-alipay-output.beancount
file.
double-entry-generator translate
--config ./example/wechat/config.yaml
--provider wechat
--output ./example/wechat/example-wechat-output.beancount
./example/wechat/example-wechat-records.csv
double-entry-generator translate
--config ./example/huobi/config.yaml
--provider huobi
--output ./example/huobi/example-huobi-output.beancount
./example/huobi/example-huobi-records.csv
double-entry-generator translate
--config ./example/htsec/config.yaml
--provider htsec
--output ./example/htsec/example-htsec-output.beancount
./example/htsec/example-htsec-records.xlsx
double-entry-generator translate
--config ./example/icbc/credit/config.yaml
--provider icbc
--output ./example/icbc/credit/example-icbc-credit-output.beancount
./example/icbc/credit/example-icbc-credit-records.csv
double-entry-generator translate
--config ./example/td/config.yaml
--provider td
--output ./example/td/example-td-output.beancount
./example/td/example-td-records.csv
double-entry-generator translate
--config ./example/bmo/credit/config.yaml
--provider bmo
--output ./example/bmo/credit/example-bmo-output.beancount
./example/bmo/credit/example-bmo-records.csv
double-entry-generator translate
--config ./example/alipay/config.yaml
--target ledger
--output ./example/alipay/example-alipay-output.ledger
./example/alipay/example-alipay-records.csv
double-entry-generator translate
--config ./example/wechat/config.yaml
--provider wechat
--target ledger
--output ./example/wechat/example-wechat-output.ledger
./example/wechat/example-wechat-records.csv
double-entry-generator translate
--config ./example/huobi/config.yaml
--provider huobi
--target ledger
--output ./example/huobi/example-huobi-output.ledger
./example/huobi/example-huobi-records.csv
double-entry-generator translate
--config ./example/htsec/config.yaml
--provider htsec
--target ledger
--output ./example/htsec/example-htsec-output.ledger
./example/htsec/example-htsec-records.xlsx
double-entry-generator translate
--config ./example/icbc/credit/config.yaml
--provider icbc
--target ledger
--output ./example/icbc/credit/example-icbc-credit-output.ledger
./example/icbc/credit/example-icbc-credit-records.csv
double-entry-generator translate
--config ./example/td/config.yaml
--provider td
--target ledger
--output ./example/td/example-td-output.ledger
./example/td/example-td-records.csv
double-entry-generator translate
--config ./example/bmo/debit/config.yaml
--provider bmo
--target ledger
--output ./example/bmo/debit/example-bmo-output.ledger
./example/bmo/debit/example-bmo-records.csv
For versions v1.0.0
and above, please refer to this article to obtain the Alipay bill.
For versions v0.2.0
and below, please use this method to obtain the bill: After logging in to PC Alipay, visit here, select the time range, drop down to the bottom of the page, and click to download the query results. Note: Please download the query results, not the income and expenditure details.
example-alipay-records.csv
This example is the bill format obtained from the "Alipay" APP.
Example of converted result: exmaple-alipay-output.beancount.
See here for how to download WeChat Pay.
example-wechat-records.csv
Example of converted result: exmaple-wechat-output.beancount.
At present, the project only guarantees the conversion of currency-to-crypto trading orders, and has not yet tested contract, leverage and other trading orders.
PR welcome :)
Log in to the Huobi Global website, enter the transaction details page of the coin order, select the appropriate time range, and click the export button in the upper right corner of the transaction details.
exmaple-huobi-records.csv
Example of converted result: exmaple-huobi-output.beancount.
Log in to the eHaitongcai PC independent trading version PC client, select Query-Delivery Order in the left navigation bar, and click the query button on the right to export the delivery order excel file.
example-htsec-records.csv
Example of converted result: exmaple-htsec-output.beancount.
How to download the ICBC statement can be found here.
double-entry-generator
can automatically identify the bill type (debit card/credit card) of the Industrial and Commercial Bank of China.
Debit card bill example: example-icbc-debit-records.csv
Example of debit card bill conversion result: example-icbc-debit-output.beancount.
Credit card bill example: example-icbc-credit-records.csv
Example of the converted result of a credit card bill: example-icbc-credit-output.beancount.
example-td-records.csv
example-bmo-record.csv
example-jd-records.csv
defaultMinusAccount : Assets:FIXME
defaultPlusAccount : Expenses:FIXME
defaultCurrency : CNY
title : 测试
alipay :
rules :
- category : 日用百货
targetAccount : Expenses:Groceries
- category : 餐饮美食
time : 11:00-14:00
targetAccount : Expenses:Food:Lunch
- category : 餐饮美食
time : 16:00-22:00
targetAccount : Expenses:Food:Dinner
- peer : 滴露
targetAccount : Expenses:Groceries
- peer : 苏宁
targetAccount : Expenses:Electronics
- item : 相互宝
targetAccount : Expenses:Insurance
- method : 余额
fullMatch : true
methodAccount : Assets:Alipay
- method : 余额宝
fullMatch : true
methodAccount : Assets:Alipay
- method : 招商银行(9876)
fullMatch : true
methodAccount : Assets:Bank:CN:CMB-9876:Savings
- type : 收入 # 其他转账收款
targetAccount : Income:FIXME
methodAccount : Assets:Alipay
- type : 收入 # 收款码收款
item : 商品
targetAccount : Income:Alipay:ShouKuanMa
methodAccount : Assets:Alipay
# 交易类型为其他
- type : 其他
item : 收益发放
methodAccount : Income:Alipay:YuEBao:PnL
targetAccount : Assets:Alipay
- type : 其他
item : 余额宝-单次转入
targetAccount : Assets:Alipay
methodAccount : Assets:Alipay
- peer : 基金
type : 其他
item : 黄金-买入
methodAccount : Assets:Alipay
targetAccount : Assets:Alipay:Invest:Gold
- peer : 基金
type : 其他
item : 黄金-卖出
methodAccount : Assets:Alipay:Invest:Gold
targetAccount : Assets:Alipay
pnlAccount : Income:Alipay:Invest:PnL
- peer : 基金
type : 其他
item : 买入
methodAccount : Assets:Alipay
targetAccount : Assets:Alipay:Invest:Fund
- peer : 基金
type : 其他
item : 卖出
methodAccount : Assets:Alipay:Invest:Fund
targetAccount : Assets:Alipay
pnlAccount : Income:Alipay:Invest:PnL
defaultMinusAccount
, defaultPlusAccount
and defaultCurrency
are global required default values. Among them, defaultMinusAccount
is the account with the default amount reduced, defaultPlusAccount
is the account with the default amount increased. defaultCurrency
is the default currency.
alipay
is the provider-specific configuration. Alipay provider has rules matching mechanism.
Configuration related to alipay
ant bill. It provides rule-based matching. You can specify:
peer
(counterparty).item
(item description).type
(receipt/expense).method
(receipt/payment method).category
(transaction category).time
(trading time).Trading time can be written in the following two forms:
11:00-13:00
11:00:00-13:00:00
24-hour clock, start time and end time are separated by-
.
minPrice
(minimum amount) and maxPrice
(maximum amount).You can use the separator (sep) to fill in multiple keywords in a single rule. In the same object, there is an OR relationship between each keyword.
You can use fullMatch
to set character matching rules in a single rule. true
means using full match, false
means using partial match. If this item is not set, inclusive matching will be used by default.
In a single rule, you can use tag
to set the tag of the pipeline, and use sep
as the separator.
You can use ignore
in a single rule to set whether to ignore transactions matching the rule. true
means ignoring transactions matching the rule, fasle
means not ignoring, and the default is false
.
If the match is successful, targetAccount
, methodAccount
and other accounts defined in the rule will be used to overwrite the default defined account.
The order of rule matching is: start matching from the first item in the rules
configuration, and continue matching if the match is successful. That is, the priority of subsequent rules is higher than that of previous rules.
Alipay provides a "transaction method" field to identify funds entering and exiting the account. In this way, you can directly use the "Transaction Method" and the "Income/Expenditure" field to confirm whether the account is an increase or decrease. The double-entry accounting method requires at least two accounts for each transaction. The other account can be entered through "peer", "commodity" (item), "receipt/expense" (type) and "transaction method" (method). ) is obtained by multiple inclusion matches. If the match is successful, targetAccount
and methodAccount
defined in the rule will be used, and by confirming whether the transaction is income or expenditure, the positive and negative relationship between targetAccount
and methodAccount
will be determined to override the default defined increase or decrease account.
The account relationship between targetAccount
and methodAccount
is as follows:
Income/Expenditure | Transaction Classification | minusAccount | plusAccount |
---|---|---|---|
income | * | targetAccount | methodAccount |
income | Refund | targetAccount | methodAccount |
expenditure | * | methodAccount | targetAccount |
other | * | methodAccount | targetAccount |
other | Refund | targetAccount | methodAccount |
When the transaction type is "Other", you need to manually define the loan account yourself. At this time, the software will think
methodAccount
is a credit account andtargetAccount
is a debit account.
defaultMinusAccount : Assets:FIXME
defaultPlusAccount : Expenses:FIXME
defaultCommissionAccount : Expenses:Commission:FIXME
defaultCurrency : CNY
title : 测试
wechat :
rules :
# type (additional condition)
- type : 收入 # 微信红包
method : /
item : /
targetAccount : Income:Wechat:RedPacket
- type : / # 转入零钱通
txType : 转入零钱
peer : /
item : /
targetAccount : Assets:Digital:Wechat:Cash
- type : / # 零钱提现
txType : 零钱提现
targetAccount : Assets:Digital:Wechat:Cash
commissionAccount : Expenses:Wechat:Commission
- type : / # 零钱充值
txType : 零钱充值
targetAccount : Assets:Digital:Wechat:Cash
- type : / # 零钱通转出-到工商银行(9876)
txType : 零钱通转出-到工商银行(9876)
targetAccount : Assets:Bank:CN:ICBC:Savings
- peer : 云膳过桥米线,餐厅
sep : ' , '
time : 11:00-15:00
targetAccount : Expenses:Food:Meal:Lunch
- peer : 云膳过桥米线,餐厅
sep : ' , '
time : 16:30-21:30
targetAccount : Expenses:Food:Meal:Dinner
- peer : 餐厅
time : 23:55-00:10 # test T+1
targetAccount : Expenses:Food:Meal:MidNight
- peer : 餐厅
time : 23:50-00:05 # test T-1
targetAccount : Expenses:Food:Meal:MidNight
- peer : 房东
type : 支出
targetAccount : Expenses:Housing:Rent
- peer : 用户
type : 收入
targetAccount : Income:Service
- peer : 理财通
type : /
targetAccount : Assets:Trade:Tencent:LiCaiTong
- peer : 建设银行
txType : 信用卡还款
targetAccount : Liabilities:Bank:CN:CCB
- method : / # 一般为收入,存入零钱
methodAccount : Assets:Digital:Wechat:Cash
- method : 零钱
fullMatch : true
methodAccount : Assets:Digital:Wechat:Cash
- method : 零钱通
fullMatch : true
methodAccount : Assets:Digital:Wechat:Cash
- method : 工商银行
methodAccount : Assets:Bank:CN:ICBC:Savings
- method : 中国银行
methodAccount : Assets:Bank:CN:BOC:Savings
defaultMinusAccount
, defaultPlusAccount
and defaultCurrency
are global required default values. Among them, defaultMinusAccount
is the account with the default amount reduced, defaultPlusAccount
is the account with the default amount increased. defaultCurrency
is the default currency.
defaultCommissionAccount
is the default service fee account. If there are no service fee-related transactions, you do not need to fill it in. However, the author still recommends filling in a placeholder FIXME account, otherwise the converter will exit with an error when encountering a transaction with a service fee.
wechat
is the provider-specific configuration. WeChat provider has rules matching mechanism.
wechat
is WeChat related configuration. It provides rule-based matching. You can specify:
peer
(counterparty).item
(item name).type
(receipt/expense).txType
(transaction type).method
(payment method).time
(trading time).Trading time can be written in the following two forms:
11:00-13:00
11:00:00-13:00:00
24-hour clock, start time and end time are separated by-
.
minPrice
(minimum amount) and maxPrice
(maximum amount).You can use the separator (sep) to fill in multiple keywords in a single rule. In the same object, there is an OR relationship between each keyword.
You can use fullMatch
to set character matching rules in a single rule. true
means using full match, false
means using partial match. If this item is not set, inclusive matching will be used by default.
In a single rule, you can use tag
to set the tag of the pipeline, and use sep
as the separator.
You can use ignore
in a single rule to set whether to ignore transactions matching the rule. true
means ignoring transactions matching the rule, fasle
means not ignoring, and the default is false
.
If the match is successful, targetAccount
, methodAccount
and other accounts defined in the rule will be used to overwrite the default defined account.
The order of rule matching is: start matching from the first item in the rules
configuration, and continue matching if the match is successful. That is, the priority of subsequent rules is higher than that of previous rules.
WeChat bill provides a "transaction method" field to identify funds entering and exiting the account. In this way, you can directly use the "Transaction Method" and the "Income/Expenditure" field to confirm whether the account is an increase or decrease. The double-entry accounting method requires at least two accounts for each transaction. The other account can be entered through "peer", "commodity" (item), "receipt/expense" (type) and "transaction method" (method). ) is obtained by multiple inclusion matches. If the Alipay configuration is similar, if the matching is successful, targetAccount
and methodAccount
defined in the rules will be used, and by confirming whether the transaction is income or expenditure, the positive and negative relationship between targetAccount
and methodAccount
will be determined to override the default defined increase or decrease account.
The account relationship between targetAccount
and methodAccount
is as follows:
Income/Expenditure | minusAccount | plusAccount |
---|---|---|
income | targetAccount | methodAccount |
expenditure | methodAccount | targetAccount |
defaultCashAccount : Assets:Huobi:Cash
defaultPositionAccount : Assets:Huobi:Positions
defaultCommissionAccount : Expenses:Huobi:Commission
defaultPnlAccount : Income:Huobi:PnL
defaultCurrency : USDT
title : 测试
huobi :
rules :
- item : BTC/USDT,BTC1S/USDT # multiple keywords with separator
type : 买入
txType : 币币交易
fullMatch : true
sep : ' , ' # define separator as a comma
cashAccount : Assets:Rule1:Cash
positionAccount : Assets:Rule1:Positions
CommissionAccount : Expenses:Rule1:Commission
pnlAccount : Income:Rule1:PnL
defaultCashAccount
, defaultPositionAccount
, defaultCommissionAccount
, defaultPnlAccount
and defaultCurrency
are global required default values.
huobi
is the provider-specific configuration. Huobi provider has rules matching mechanism.
huobi
is the configuration related to Huobi. It provides rule-based matching. You can specify:
item
(trading pair).type
(trading direction).txType
(transaction type).time
(trading time).Trading time can be written in the following two forms:
11:00-13:00
11:00:00-13:00:00
24-hour clock, start time and end time are separated by-
.
You can use the separator (sep) to fill in multiple keywords in a single rule. In the same object, there is an OR relationship between each keyword.
You can use fullMatch
to set character matching rules in a single rule. true
means using full match, false
means using partial match. If this item is not set, inclusive matching will be used by default.
You can use ignore
in a single rule to set whether to ignore transactions matching the rule. true
means ignoring transactions matching the rule, fasle
means not ignoring, and the default is false
.
If the match is successful, cashAccount
, positionAccount
, commissionAccount
and pnlAccount
defined in the rule will be used to override the default definition.
The order of rule matching is: start matching from the first item in the rules
configuration, and continue matching if the match is successful. That is, the priority of subsequent rules is higher than that of previous rules.
in:
defaultCashAccount
is the default capital account, generally used to store USDT.defaultPositionAccount
is the default position account.defaultCommissionAccount
is the default commission account.defaultPnlAccount
is the default profit and loss account.defaultCurrency
is the default currency. defaultCashAccount : Assets:Htsec:Cash
defaultPositionAccount : Assets:Htsec:Positions
defaultCommissionAccount : Expenses:Htsec:Commission
defaultPnlAccount : Income:Htsec:PnL
defaultCurrency : CNY
title : 测试
htsec :
rules :
- item : 兴业转债
type : 卖
sep : ' , '
cashAccount : Assets:Rule1:Cash
positionAccount : Assets:Rule1:Positions
CommissionAccount : Expenses:Rule1:Commission
pnlAccount : Income:Rule1:PnL
defaultCashAccount
, defaultPositionAccount
, defaultCommissionAccount
, defaultPnlAccount
and defaultCurrency
are global required default values.
htsec
is the provider-specific configuration. Htsec provider has rules matching mechanism.
htsec
is a configuration related to Haitong Securities. It provides rule-based matching. You can specify:
item
(trading direction-security code-security market capitalization).type
(trading direction).time
(trading time).Trading time can be written in the following two forms:
11:00-13:00
11:00:00-13:00:00
> 24-hour clock, use-
to separate start time and end time.
You can use the separator (sep) to fill in multiple keywords in a single rule. In the same object, there is an OR relationship between each keyword.
You can use fullMatch
to set character matching rules in a single rule. true
means using full match, false
means using partial match. If this item is not set, inclusive matching will be used by default.
You can use ignore
in a single rule to set whether to ignore transactions matching the rule. true
means ignoring transactions matching the rule, fasle
means not ignoring, and the default is false
.
If the match is successful, cashAccount
, positionAccount
, commissionAccount
and pnlAccount
defined in the rule will be used to override the default definition.
The order of rule matching is: start matching from the first item in the rules
configuration, and continue matching if the match is successful. That is, the priority of subsequent rules is higher than that of previous rules.
in:
defaultCashAccount
is the default capital account, generally used to store available funds in securities accounts.defaultPositionAccount
is the default position account.defaultCommissionAccount
is the default commission account.defaultPnlAccount
is the default profit and loss account.defaultCurrency
is the default currency. defaultMinusAccount : Assets:FIXME
defaultPlusAccount : Expenses:FIXME
defaultCashAccount : Liabilities:Bank:CN:ICBC
defaultCurrency : CNY
title : 测试
icbc :
rules :
- peer : 财付通,支付宝
ignore : true
- peer : 广东联合电子收费股份
targetAccount : Expenses:Transport:Highway
- txType : 人民币自动转帐还款
targetAccount : Assets:Bank:CN:ICBC:Savings
- peer : XX旗舰店
targetAccount : Expenses:Joy
defaultMinusAccount
, defaultPlusAccount
, defaultCashAccount
and defaultCurrency
are global required default values. Among them, defaultMinusAccount
is the account with the default amount reduced, defaultPlusAccount
is the account with the default amount increased, defaultCashAccount
is the bank card account used by default in this configuration (equivalent to methodAccount
in Alipay/WeChat). defaultCurrency
is the default currency.
icbc
is the configuration related to the Industrial and Commercial Bank of China. It provides rule-based matching. You can specify:
peer
(counterparty).type
(receipt/expense).txType
(transaction type). In a single rule, you can use the separator sep
to fill in multiple keywords. In the same object, there is an OR relationship between each keyword.
You can use fullMatch
to set character matching rules in a single rule. true
means using full match, false
means using partial match. If this item is not set, inclusive matching will be used by default.
In a single rule, you can use tag
to set the tag of the pipeline, and use sep
as the separator.
You can use ignore
in a single rule to set whether to ignore transactions matching the rule. true
means ignoring transactions matching the rule, fasle
means not ignoring, and the default is false
.
If the match is successful, the targetAccount
account defined in the rule will be used to overwrite the default defined account.
The order of rule matching is: start matching from the first item in the rules
configuration, and continue matching if the match is successful. That is, the priority of subsequent rules is higher than that of previous rules.
The recorded amount in the ICBC statement is divided into income/expense. Through this mechanism, the positive and negative relationship between the bank card account in the transaction can be judged. If the Alipay configuration is similar, if the match is successful, targetAccount
and global value defaultCashAccount
defined in the rule will be used, and by confirming whether the transaction is income or expenditure, the positive and negative relationship between targetAccount
and defaultCashAccount
will be determined to override the default defined increase or decrease account.
The account relationship between targetAccount
and defaultCashAccount
is as follows:
Income/Expenditure | minusAccount | plusAccount |
---|---|---|
income | targetAccount | defaultCashAccount |
expenditure | defaultCashAccount | targetAccount |
defaultMinusAccount : Assets:FIXME
defaultPlusAccount : Expenses:FIXME
defaultCashAccount : Assets:DebitCard:TDChequing
defaultCurrency : CAD
title : 测试
td :
rules :
- item : " T T "
targetAccount : Expenses:Grocery
tag : tt_tag
- item : " DOLLARAMA "
targetAccount : Expenses:Grocery
tag : grocery_tag1,cheap_tag2
- item : " DEVELOPM MSP "
targetAccount : Income:Salary
- type : 收入
item : " SEND E-TFR "
targetAccount : Income:FIXME
defaultMinusAccount
, defaultPlusAccount
, defaultCashAccount
and defaultCurrency
are global required default values. Among them, defaultMinusAccount
is the account with the default amount reduced, defaultPlusAccount
is the account with the default amount increased, defaultCashAccount
is the bank card account used by default in this configuration (equivalent to methodAccount
in Alipay/WeChat). defaultCurrency
is the default currency.
td
is a configuration related to Toronto-Dominion Bank. It provides rule-based matching. Because TD's own bill is relatively simple, there are not many rules that can be specified:
item
: (trading item).type
: Exact/inclusive match of (receipt/expense). In a single rule, you can use the separator sep
to fill in multiple keywords. In the same object, there is an OR relationship between each keyword.
You can use fullMatch
to set character matching rules in a single rule. true
means using full match, false
means using partial match. If this item is not set, inclusive matching will be used by default.
In a single rule, you can use tag
to set the Beancount Tag or Ledger Meta Tag of the pipeline, and use sep
as the separator.
You can use ignore
in a single rule to set whether to ignore transactions matching the rule. true
means ignoring transactions matching the rule, fasle
means not ignoring, and the default is false
.
If the match is successful, the targetAccount
account defined in the rule will be used to overwrite the default defined account.
The order of rule matching is: start matching from the first item in the rules
configuration, and continue matching if the match is successful. That is, the priority of subsequent rules is higher than that of previous rules.
The recorded amount in the TD bill is divided into income/expense. Through this mechanism, the positive and negative relationship between the bank card account in the transaction can be judged. If the Alipay configuration is similar, if the match is successful, targetAccount
and global value defaultCashAccount
defined in the rule will be used, and by confirming whether the transaction is income or expenditure, the positive and negative relationship between targetAccount
and defaultCashAccount
will be determined to override the default defined increase or decrease account.
The account relationship between targetAccount
and defaultCashAccount
is as follows:
Income/Expenditure | minusAccount | plusAccount |
---|---|---|
income | targetAccount | defaultCashAccount |
expenditure | defaultCashAccount | targetAccount |
defaultMinusAccount : Assets:FIXME
defaultPlusAccount : Expenses:FIXME
defaultCashAccount : Assets:DebitCard:BMOChequing
defaultCurrency : CAD
title : 测试
bmo :
rules :
- item : " T T "
targetAccount : Expenses:Grocery
tag : tt_tag
- item : " DOLLARAMA "
targetAccount : Expenses:Grocery
tag : grocery_tag1,cheap_tag2
- item : " DEVELOPM MSP "
targetAccount : Income:Salary
- type : 收入
item : " SEND E-TFR "
targetAccount : Income:FIXME
defaultMinusAccount
, defaultPlusAccount
, defaultCashAccount
and defaultCurrency
are global required default values. Among them, defaultMinusAccount
is the account with the default amount reduced, defaultPlusAccount
is the account with the default amount increased, defaultCashAccount
is the bank card account used by default in this configuration (equivalent to methodAccount
in Alipay/WeChat). defaultCurrency
is the default currency.
bmo
is a configuration related to Toronto-Dominion Bank. It provides rule-based matching. Because BMO's own billing is relatively simple, there are not many rules that can be specified:
item
: (trading item).type
: Exact/inclusive match of (receipt/expense). In a single rule, you can use the separator sep
to fill in multiple keywords. In the same object, there is an OR relationship between each keyword.
You can use fullMatch
to set character matching rules in a single rule. true
means using full match, false
means using partial match. If this item is not set, inclusive matching will be used by default.
In a single rule, you can use tag
to set the Beancount Tag or Ledger Meta Tag of the pipeline, and use sep
as the separator.
You can use ignore
in a single rule to set whether to ignore transactions matching the rule. true
means ignoring transactions matching the rule, fasle
means not ignoring, and the default is false
.
If the match is successful, the targetAccount
account defined in the rule will be used to overwrite the default defined account.
The order of rule matching is: start matching from the first item in the rules
configuration, and continue matching if the match is successful. That is, the priority of subsequent rules is higher than that of previous rules.
The recorded amount in the BMO bill is divided into income/expense. Through this mechanism, the positive and negative relationship between the bank card account in the transaction can be judged. If the Alipay configuration is similar, if the match is successful, targetAccount
and global value defaultCashAccount
defined in the rule will be used, and by confirming whether the transaction is income or expenditure, the positive and negative relationship between targetAccount
and defaultCashAccount
will be determined to override the default defined increase or decrease account.
The account relationship between targetAccount
and defaultCashAccount
is as follows:
Income/Expenditure | minusAccount | plusAccount |
---|---|---|
income | targetAccount | defaultCashAccount |
expenditure | defaultCashAccount | targetAccount |
defaultMinusAccount : Assets:FIXME
defaultPlusAccount : Expenses:FIXME
defaultCurrency : CNY
title : 测试
jd :
rules :
- method : 京东白条
methodAccount : Liabilities:Baitiao
- method : 小金库零用钱
methodAccount : Assets:EPay:JD
- item : 椰子
targetAccount : Expenses:Food
- item : 京东小金库-转入
peer : 京东金融
targetAccount : Assets:EPay:JD
- category : 美妆个护
targetAccount : Expenses:MakeUp
- item : "食品酒饮"
targetAccount : Assets:Food
- peer : 亲密卡
targetAccount : Expenses:Prpaid
- item : 白条,还款
targetAccount : Liabilities:Baitiao
- item : 京东小金库收益
fullMatch : true
targetAccount : Income:PnL:JD
methodAccount : Assets:EPay:JD
The format of JD.com bills is generally similar to Alipay.
When the transaction category of JD.com’s bill is不计收支
, the account processing is divided into two situations:
General situation:收/付款方式
(that is, the field matched by method
) is generally the expenditure account, and交易分类
(that is, the field matched by category
) is generally the income account. For example, when bank card funds are transferred to Jingdong's small vault,收/付款方式
is bank card, and the transaction is交易分类
as small vault; when repaying the money from I Tiao,收/付款方式
is bank card or small vault pocket money, and交易分类
as Bai Tiao.
Special case: When the prefix of交易说明
(that is, the field matched by item
) is冻结-
or解冻-
it is a special case in which不计收支
. In the case of冻结-
,收/付款方式
is the expenditure account; in the case of解冻-
收/付款方式
is the income account but the amount is 0. Currently, all transactions related to冻结
and解冻
will be ignored.
The account relationship between targetAccount
and methodAccount
is as follows:
Income/Expenditure | minusAccount | plusAccount |
---|---|---|
income | targetAccount | methodAccount |
expenditure | methodAccount | targetAccount |
Regardless of income and expenses | methodAccount | targetAccount |