Strange sorting when using --market and multiple currencies

28 views
Skip to first unread message

Viraj Alankar

unread,
Apr 14, 2023, 3:42:09 AM4/14/23
to Ledger
Hi,

I'm trying to understand why sorting by amount doesn't seem to work right when using multiple currencies and --market:

ledger -f ledger.ledger --price-db prices.db -Y -V -c --period-sort '(amount)' -b "2023" register ^expenses

...
Expenses:Blah1                             $7225.12             $22613.89
Expenses:Blah2                            $10888.14             $33502.03
Expenses:Blah3                                $9.29             $33511.32
Expenses:Blah4                               $47.30             $33558.62

...

ledger -f ledger.ledger --price-db prices.db -Y -c --period-sort '(amount)' -b "2023" register ^expenses

Expenses:Blah1                             $7225.12             $22580.11
                                                                                                                            30.00 CHF
Expenses:Blah2                             $10888.14             $33468.25
                                                                                                                            30.00 CHF
Expenses:Blah3                             8.25 CHF             $33468.25
                                                                                                                            38.25 CHF
Expenses:Blah4                             42.00 CHF             $33468.25
                                                                                                                            80.25 CHF


It seems to be sorting the currencies separately regardless of using --market. Is there a way to sort by the converted market value?

Thanks,

Viraj.

John Wiegley

unread,
Apr 14, 2023, 11:53:00 AM4/14/23
to Viraj Alankar, Ledger
>>>>> "VA" == Viraj Alankar <vala...@gmail.com> writes:

VA> I'm trying to understand why sorting by amount doesn't seem to work
VA> right when using multiple currencies and --market:

VA> ledger -f ledger.ledger --price-db prices.db -Y -V -c --period-sort '
VA> (amount)' -b "2023" register ^expenses

Please try sorting by the `display_amount`.

John

Viraj Alankar

unread,
Apr 14, 2023, 11:58:42 AM4/14/23
to Viraj Alankar, Ledger
Hm, strange it gives me a segmentation fault:

ledger -f ledger.ledger --price-db prices.db -Y -V -c --period-sort '(display_amount)' -b "2023" register ^expenses
Segmentation fault

ledger --version
Ledger 3.2.1-20200518, the command-line accounting tool

Perhaps I should try a newer version? This is installed from conda-forge.

John Wiegley

unread,
Apr 14, 2023, 8:39:25 PM4/14/23
to Viraj Alankar, Ledger
>>>>> "VA" == Viraj Alankar <vala...@gmail.com> writes:

VA> Hm, strange it gives me a segmentation fault:
VA> ledger -f ledger.ledger --price-db prices.db -Y -V -c --period-sort '
VA> (display_amount)' -b "2023" register ^expenses
VA> Segmentation fault

Using this same options with my own data, I didn't not see a segmentation
fault. I'd like to get to the bottom of that!

VA> ledger --version
VA> Ledger 3.2.1-20200518, the command-line accounting tool

VA> Perhaps I should try a newer version? This is installed from
VA> conda-forge.

If you can, it would be helpful. Also, is there a small example you'd be
willing to send me directly, that exhibits the crash?

John
Reply all
Reply to author
Forward
0 new messages