On Mon, Jun 23, 2014 at 12:30 PM, Simon Michael <[email protected]> wrote:
> Hi all, > > In current hledger, a balance assertion like > > some:account $1 = $4 > > asserts that after the $1 posting, some:account's balance is $4. > > I learned from https://github.com/simonmichael/hledger/issues/195 that in > Ledger, it means that some:account's *dollar* balance is $4, and says > nothing about any other commodities in the account. This should be > clarified at http://ledger-cli.org/3.0/doc/ledger3.html#Balance-assertions > . > Beancount's semantics is the same as Ledger's, that is, an assertion only checks that commodity's value, it looks like this (it's a separate entry): 2014-06-20 balance Assets:Some:Account 4 USD If invoked on a parent account, the balance checks against the sum of all subaccounts as well, but also only for that commodity. I find this a little harder to understand and explain, and unsatisfying > that a balance assertion doesn't definitively nail down (programmatically > and visually) what's in an account. You can add more postings, with 0 > amount if necessary, to assert the balance of each individual commodity: > > some:account $1 = $4 > some:account 0 = EUR 10 > some:account 0 = FRF 15 > > but you're still not absolutely sure of the account's balance - new > commodities can show up there and the assertions won't notice. > Just to be clear, it also makes sense to do this in Beancount: 2014-06-20 balance Assets:Some:Account 413.43 USD 2014-06-20 balance Assets:Some:Account 201.24 CAD I too have been wondering if a check on the totality of an inventory might be useful. Something like this: 2014-06-20 balance* Assets:Some:Account 413.43 USD, 201.24 CAD whereby if there are any other commodities in this account at that time (e.g., EUR) this would raise an error. This is a bit of a theoretical question though; in practice, I have few accounts that contain more than one or two commodities, and not having a complete check hasn't been a problem in maintaining my ledger. It's nagging me a bit though, I like to be strict. Also, what does it mean to assert a commodity-less zero balance ? Ledger > accepts all the assertions below, which seems wrong: > > 1/1 > a 1 = 1 > a $1 = $1 > a $-1 = 0 > a 1 = 0 > a 1 = 0 > b > > The advantage of Ledger's current way is that you can make at least some > assertions about a multi-commodity account. In current hledger this is > explicitly not supported, so if you really needed to assert a > multi-commodity balance you'd have to separate the commodities into > subaccounts. > > Compatible balance assertions are important for interoperability between > ledger-likes, so I'm wondering how to harmonise this. I can make hledger's > assertions work like current Ledger, or we could agree to target a new > design. Eg I propose we add a one-line syntax for multi-commodity amounts, > such as: > > some:account $1 = $4, EUR 10, FRF15 ; comma followed by a space > separates amounts > > and agree that assertions disallow commodities not explicitly mentioned. > What do you think ? > > There's at least one other incompatibility between Ledger and hledger > balance assertions: > > 1/1 > a 1 = 1 > a 1 = 1 ; Ledger expects a to be 1 again, ignoring the previous > posting; hledger expects 2 > b > > Can I persuade you that hledger's interpretation is better here ? > "Better" can be defined by "useful": is it useful if the user always have to repeat all the commodities in a balance assertion? e.g. let's say I have a lot of cash changes in an investment account. My assertions could have to look like this: 2014-03-20 balance* Assets:Some:Account 10 GOOG, 201.24 USD 2014-04-20 balance* Assets:Some:Account 10 GOOG, 762.30 USD 2014-05-20 balance* Assets:Some:Account 10 GOOG, 784.02 USD 2014-06-20 balance* Assets:Some:Account 10 GOOG, 640.40 USD Do I really want to have to repeat the 10 GOOG every time? > > Either way, I'd also like to have --no-balance-assertions or similar > widely supported, so that you can at least ignore them temporarily while > running another ledger-like on your data. > > Thoughts ? > I'm unsure which is best. -- --- You received this message because you are subscribed to the Google Groups "Ledger" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
