Skip to content

piecash ledger create incorrect output for commodities #238

@meman987

Description

@meman987

Commodities have thousand separators in the ledger output. This gives incorrect balances. See below:

2022-03-10 Buy XYZ
    Assets:Cash                         SEK -120,000.00
    Assets:Avanza                       XYZ 1,200 @@ SEK 120,000.00

2023-01-02 Sell XYZ
    Assets:_:ALBBV:13 Avanza 1          XYZ -120 @@ SEK 14,000.00
    Assets:Cash                         SEK 14,400.00
    PL:Capital Gains

hledger bal -f tmp.txt                                                                                              [18:11:09]
           XYZ 1,200  Assets:Avanza
     SEK -105,600.00  Assets:Cash
        XYZ -120,000  Assets:_:ALBBV:13 Avanza 1
         SEK -400.00  PL:Capital Gains
--------------------
     SEK -106,000.00
        XYZ -118,800

It should be

2022-03-10 Buy XYZ
    Assets:Cash                         SEK -120,000.00
    Assets:Avanza                       XYZ 1200 @@ SEK 120,000.00

2023-01-02 Sell XYZ
    Assets:_:ALBBV:13 Avanza 1          XYZ -120 @@ SEK 14,000.00
    Assets:Cash                         SEK 14,400.00
    PL:Capital Gains

 hledger bal -f tmp2.txt                                                                                              [18:10:52]
            XYZ 1200  Assets:Avanza
     SEK -105,600.00  Assets:Cash
            XYZ -120  Assets:_:ALBBV:13 Avanza 1
         SEK -400.00  PL:Capital Gains
--------------------
     SEK -106,000.00
            XYZ 1080

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions