simonmichael · GitHub

[Related: #1813, #1816]

With this entry:

2022-01-01
    a        A -1
    b        B 1 @@ A 1

hledger 1.25 and 1.26 infer the same market price:

$ hledger-1.25 prices --infer-market-prices
P 2022-01-01 B A 1.0
$ hledger-1.26 prices --infer-market-prices
P 2022-01-01 B A 1.0

and produce the same valuation:

$ hledger-1.25 print --infer-market-prices -V
2022-01-01
    a            A -1
    b             A 1
$ hledger-1.26 print --infer-market-prices -V
2022-01-01
    a            A -1
    b             A 1

But with this entry, which is odd but currently considered legal and balanced, since the second posting's negatives cancel out:

2022-01-01
    a        A -1
    b        B -1 @@ A -1

hledger 1.25 inferred the market price correctly but produced an incorrect valuation (note both amounts are negative):

$ hledger-1.25 prices --infer-market-prices
P 2022-01-01 B A 1.0
$ hledger-1.25 print --infer-market-prices -V
2022-01-01
    a            A -1
    b            A -1

hledger 1.26 fixed the valuation, but now incorrectly infers a negative market price:

$ hledger-1.26 prices --infer-market-prices
P 2022-01-01 B A -1.0
$ hledger-1.26 print --infer-market-prices -V
2022-01-01
    a            A -1
    b             A 1

I had several of those odd double negative entries (generated by csv rules, unknowingly), and this caused hledger 1.26 to report an incorrect balance in one of my reports. A minimal example:

$ hledger-1.25 bal b -N -X A --infer-market-prices
                A -1  b
$ hledger-1.26 bal b -N -X A --infer-market-prices
                 A 1  b

Read the original on github.com ↗