On Wed, Jul 23, 2014 at 3:50 PM, Martin Michlmayr <[email protected]> wrote:
> * tripun goel <[email protected]> [2014-07-17 07:15]: > > I am implementing rounding option and to do so at the correct level, > > I am trying to determine the importance of the order in which > > balance is calculated. > > I guess I don't fully understand why it's required to sort. Can you > tell me how ledger calculates the sum when you have one commodity > (e.g. AAA) and that's valued in another (e.g. USD). > > You said it does not use number of AAA * value of AAA in USA. So how > is each individual step valued? > > let's say we have 2 AAA and then we have 2 P entries showing that the > value of AAA in USD changes. How does ledger calculate this? > > What if we have 1 AAA and later get another 2 AAA, how are the 3 > valued in USD? > > What I'm trying to get at: at the moment, ledger keeps all precision, > but it shows you the info in whatever you specify with D. Sometimes, > ledger generates an "Adjustment" entry when rounding happens. > > Why cannot we generate such Adjustment entries too when necessary? > e.g. let's take an example > > D $1000.00 > > 2014-05-01 Test 1 > Assets:Investment 1 AAA at $10.454 > Assets:Cash > > 2014-06-01 Test 2 > Assets:Investment 1 AAA at $10.454 > Assets:Cash > > ledger reg: > 2014-05-01 Test 1 $10.450 $10.450 > 2014-06-01 Test 2 $10.450 $10.450 > 2014-06-01 <Adjustment> $0.010 $20.910 > > Why is this not possible? > > Hmm, I remember in one of our previous conversations arguing against > such a thing; maybe this is something that needs to be configurable; > for example, when you have expenses of $10.454 on 2014-05-1 and again > $10.454 on 2014-06-01 you probably want your total to be $20.90 (with > rounding); but when I track how much my shares are worth, I definitely > want the result as number of shares * current value, so we'd need to > do the Adjustment above. > > As far as I understand, ledger keeps a list of amounts from each post with balance object , before displaying a value function is called and then it iterates again through the list. The amounts are then valued and added to the balance. The total is accurate because there is no rounding in any calculation here. Why this is needed? I think it has more to do with object oriented design the ledger has. A balance value is value equivalent amounts valued determined by market valuation at specific time. Any better explanation will be helpful. if we round per transaction and keep an adjustment account with each commodity doesn't seems to be a good idea. Although , I have not investigated this path but I feel it will be more complex. Why I need to sort? iterating through the sorted lists it will be easier to round subtotals and hence matching the multiplication of total of quantity * current price . -- > Martin Michlmayr > http://www.cyrius.com/ > > -- > > --- > You received this message because you are subscribed to a topic in the > Google Groups "Ledger" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/ledger-cli/yX1PFXXJekM/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- --- 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.
