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 noted that ledger calculates and add to balance in order of 
parsing the postings. Even if I change the order of the postings without 
changing dates and any other data , the result is going to be the same, 
since ledger does not round at all for precision. Here is an example in 
which I have two commodities to be evaluated in terms of GBP. 

D 1000.000 GBP
   
2010-01-10 * Buy XXX
    Assets:P                      1 XXX @@ 8.123 GBP
    Assets:C

2010-01-11 * Buy XXX
    Assets:P                      1 XXX @@ 8.123 GBP
    Assets:C

2010-02-10 * Buy XXX
    Assets:P                      1 XXX @@ 8.123 GBP
    Assets:C

2010-03-10 * Buy XXX
    Assets:P                      1 XXX @@ 8.123 GBP
    Assets:C

2010-01-10 * Buy AAA
    Assets:P                      1 AAA @@ 9.123 GBP
    Assets:C
    
2010-02-10 * Buy AAA
    Assets:P                      1 AAA @@ 9.123 GBP
    Assets:C
    
2010-03-10 * Buy AAA
    Assets:P                      1 AAA @@ 9.123 GBP
    Assets:C
    
2010-01-12 * Buy AAA
    Assets:P                      1 AAA @@ 9.123 GBP
    Assets:C
    

P 2011/01/01 XXX  10.123 GBP
P 2011/01/01 AAA 10.123 GBP

or this example 

D 1000.000 GBP
   
2010-01-10 * Buy XXX
    Assets:P                      1 XXX @@ 8.123 GBP
    Assets:C1

2010-01-11 * Buy XXX
    Assets:P                      1 XXX @@ 8.123 GBP
    Assets:C1

2010-02-10 * Buy AAA
    Assets:P                      1 AAA @@ 9.123 GBP
    Assets:C
    
2010-03-10 * Buy AAA
    Assets:P                      1 AAA @@ 9.123 GBP
    Assets:C
    
2010-02-10 * Buy XXX
    Assets:P                      1 XXX @@ 8.123 GBP
    Assets:C1

2010-03-10 * Buy XXX
    Assets:P                      1 XXX @@ 8.123 GBP
    Assets:C1

2010-01-10 * Buy AAA
    Assets:P                      1 AAA @@ 9.123 GBP
    Assets:C
        
2010-01-12 * Buy AAA
    Assets:P                      1 AAA @@ 9.123 GBP
    Assets:C
    

P 2011/01/01 XXX 10.123 GBP
P 2011/01/01 AAA 10.123 GBP
 
gives the same result 

          12.000 GBP  Assets
         -36.492 GBP    C
         -32.492 GBP    C1
          80.984 GBP    P
--------------------
          12.000 GBP

, now if I round to two places after decimal  per posting that does not 
make sense since it does not add up to the total 

          12.000 GBP  Assets
         -36.480 GBP    C
         -32.480 GBP    C1
          80.960 GBP    P
--------------------
          12.000 GBP

So in order to round correctly , I must add the total such that it adds up 
postings of one commodity and round it and then add to the balance. So the 
result rounded to two places should be 
          12.000 GBP  Assets
         -36.490 GBP    C
         -32.490 GBP    C1
          80.980 GBP    P
--------------------
          12.000 GBP


My purpose is to sort the postings based on order of parsing and commodity. 
So that I can round the total amount calculated from postings per 
commodity,  to get something like 40.49 GBP (AAA) + 40.49 GBP (XXX) = 80.98 
GBP

- Will changing the order of postings affect other aspects or calculations? 
Any counter example? 

Regards
Tripun Goel

-- 

--- 
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.

Reply via email to