Code Monkey home page Code Monkey logo

Comments (3)

apauley avatar apauley commented on June 12, 2024 1

Thanks for raising this @lestephane, I think this is mostly a gap in our documentation at the moment.

The solution is to change your rules files to introduce an intermediate account as soon as you start importing statements for both accounts.

I use Assets:Transfers:*.

In your example bank1 would move money into something like Assets:Transfers:Bank1Bank2, and bank2 would use the same transfer account to fetch the money from.

Any posting to Assets:Transfers:* indicates in "in-flight" amount, and you would expect the balance of Assets:Transfers to be zero most of the time.
Whenever it isn't zero it means that you either don't yet have the other side of the transfer, or that something is wrong in your rules.

You can just use Assets:Transfers without any subaccounts, but I found it useful to use subaccounts, because I monitor Assets:Transfers in my reports, and then the subaccounts shows me where I should look for the missing transfer transaction.

I typically use the sorted account names as the subaccount (Python code sample):

"Assets:Transfers:" + "".join(sorted(["Bank2", "Bank1"]))

This approach is based on what is described in Full-fledged hledger:
https://github.com/adept/full-fledged-hledger/wiki/Adding-more-accounts#lets-make-sure-that-transfers-are-not-double-counted

from hledger-flow.

lestephane avatar lestephane commented on June 12, 2024

Thanks for the explanation and the full-fledged hledger page (which somehow passed me by),
it's a saner way of handling it.

I want the directionality of the transfer to be apparent without digging in the journal,
so I settled for a ":TopUp" prefix to my "Assets:" accounts. So if you have regular transfers
between two accounts in both directions, you'll have a pair of transfer accounts.

Example:
You want to buy and sell stocks regularly

  • Bank -> Depot (for a buy order) uses Assets:Broker:Depot:TopUp
  • Depot -> Bank (for a sell order) uses Assets:Bank:Girokonto:TopUp

I think this issue can be closed for now, as the problem seems well known, has a solution,
and the solution is well documented in the full-fledged hledger page.

from hledger-flow.

apauley avatar apauley commented on June 12, 2024

I've updated the FAQ with this solution:
https://github.com/apauley/hledger-flow#faq

from hledger-flow.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.