Skip to content

feat: prices: add the --quoted option to filter prices by the commodity they're quoted in#2519

Closed
basvandijk wants to merge 1 commit intosimonmichael:masterfrom
basvandijk:prices-quoted-in-filtering
Closed

feat: prices: add the --quoted option to filter prices by the commodity they're quoted in#2519
basvandijk wants to merge 1 commit intosimonmichael:masterfrom
basvandijk:prices-quoted-in-filtering

Conversation

@basvandijk
Copy link
Copy Markdown
Contributor

@basvandijk basvandijk commented Jan 3, 2026

If you have prices of a commodity quoted in multiple currencies like:

hledger prices cur:EUR -p 2025-12-31              
P 2025-12-31 EUR CHF 0.93060
P 2025-12-31 EUR USD 1.17450

It's useful to be able to filter them on the currency they're quoted in:

hledger prices cur:EUR -p 2025-12-31 --quoted CHF
P 2025-12-31 EUR CHF 0.93060
hledger prices cur:EUR -p 2025-12-31 --quoted USD 
P 2025-12-31 EUR USD 1.17450

I'm not sure about the option name. --quoted-in might read better.

@simonmichael
Copy link
Copy Markdown
Owner

Thanks!

How necessary is this, compared to alternatives like hledger prices cur:EUR | grep CHF ?

@simonmichael simonmichael added A-BUG Something wrong, confusing or sub-standard in the software, docs, or user experience. prices A-WISH Some kind of improvement request or proposal. and removed A-BUG Something wrong, confusing or sub-standard in the software, docs, or user experience. labels Jan 7, 2026
@simonmichael
Copy link
Copy Markdown
Owner

Ping. I'm wondering if this feature is needed.

@basvandijk
Copy link
Copy Markdown
Contributor Author

How necessary is this, compared to alternatives like hledger prices cur:EUR | grep CHF ?

In my scripts I currently indeed do the filtering outside of hledger so it's not like not having this feature is blocking me from anything. I was just surprised this didn't exist because most other commands in hledger allow you to filter on the currency.

But this might not be worth the complexity.

@simonmichael
Copy link
Copy Markdown
Owner

I might be wrong, but it feels a little bit unintuitive and not that much needed. I think I'll hold off for now. We might hear more support, or think of another solution. (A new query type, othercur:, useful in other contexts ? Probably more complicated.)

@basvandijk
Copy link
Copy Markdown
Contributor Author

Works for me. Thanks.

@basvandijk basvandijk closed this Mar 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-WISH Some kind of improvement request or proposal. prices

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants