Skip to content

Allow auto posting rules based on balance, not just posting amount #2475

@alerque

Description

@alerque

As far as I understand it the current auto posting system only allows automated amounts as a multiplier of the posting amount. Here is a very rough scenario where this might be used:

# I have money in a savings account
2025-10-01 Opening balance
    Assets:Savings                                  $99,000.00
    Equity

# Somebody gives me money to hand onto, and I leave it in my savings
2025-10-01 PersonA
    Assets:Savings                                  $ 1,000.00
    Liabilities:PersonA

# My bank pays out interest
2025-10-31 Bank payout
    Assets:Savings                                     $360.00
    Income:Interest

# I want to make sure I don't just pocket interest on their capital
= Income:Interest
    Liabilities:PersonA                                  *0.01
    Income:Interest

In this case, what Hledger is going to compute is at auto posting based on a multiplier of the posting amount. I carefully contrived the balances so that the 0.01 multiplier is about right and shows about what I should owe PersonA:

$ hledger reg PersonA --auto
2025-10-02 PersonA               Li::PersonA            $-1,000.00    $-1,000.00
2025-10-04 Bank payout           Li::PersonA                $-3.60    $-1,003.60

Whata I would like to do is use a multiplier of the balance of account Liabilities:PersonA instead, something like this:

= Income:Interest
    Liabilities:PersonA                          (balance*0.0036)
    Income:Interest

Obviously this isn't a perfect pseudo scenario (interest applied over date ranges is complicated) but I think this simple ability to compute a posting value based on the account balance at that date instead of the matching posting value would be quite useful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-WISHSome kind of improvement request or proposal.affects3-fewAffects just a few users.journalThe journal file format, and its features.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions