Possible price conversion issue with mixed-currency quotes

John Ralls jralls at ceridwen.us
Mon Nov 2 12:10:32 EST 2026


Denis,

It’s not that simple. Two-step pricing has to assume that the two prices are concurrent. If they’re not the resulting price becomes less reliable and a simple date rubric wouldn’t necessarily be sufficient to evaluate the reliability because a special event (the GBP busting out of the European Exchange Rate Mechanism in 1992 comes to mind) can drastically distort a two-step price even if the two are close in time if they’re on opposite sides of such an event. The error and computational complexity increases with every added commodity so GnuCash doesn’t even try to find a 3-step price.

Getting the accounting for investments priced in foreign currencies (not the same as investing in the foreign currencies themselves) is a bit tricky. https://bugs.gnucash.org/show_bug.cgi?id=797796 has an extensive discussion (254 comments and it’s not resolved!). Note that user CDB-Man is a licensed accountant in Canada.

Regards,
John Ralls

> On Nov 1, 2026, at 22:49, Denis Potapov <d at potapov.id.au> wrote:
> 
> Hi John,
> 
> No worries.
> 
> Is there a particular rationale behind this preference? From a purely algorithmic design and generality perspective, the goal is to have a single, general-purpose algorithm that finds the closest price using any combination of available price records.
> 
> Cheers,
> 
> D.
> 
> 
> On 2/11/26 15:01, John Ralls wrote:
>> Nope, it’s on purpose. Direct prices take precedence over indirect ones.
>> 
>> Regards,
>> John Ralls
>> 
>> 
>>> On Oct 29, 2026, at 16:24, Denis Potapov <d at potapov.id.au> wrote:
>>> 
>>> Hi all,
>>> 
>>> I think I may have found a bug in price conversion when a price database contains a mix of stock prices quoted in the book’s base currency and in another currency.
>>> 
>>> For example, my book’s base currency is AUD, but SSS is quoted in USD on the exchange. In the attached screenshot, the balance sheet and price editor show SSS valued at 1,500 AUD, using the SSS price in USD and the USD-to-AUD exchange rate.
>>> 
>>> The lower part of the screenshot shows the same windows, but with one additional price entry: an SSS price in AUD dated earlier than the USD-denominated prices. The balance sheet is set to use the price closest to the report date, but it uses the older AUD price and values SSS at 1,000 AUD instead.
>>> 
>>> I traced this behavior to get_nearest_price in gnc-pricedb.cpp. The direct_price_conversion call appears to take precedence over indirect_price_conversion. I also tried changing the code to use indirect_price_conversion for all conversions, which seemed to avoid the issue.
>>> 
>>> Does this sound like a bug that should be fixed? If so, I’d be happy to submit a patch or pull request.
>>> 
>>> Thanks,
>>> 
>>> D
>>> <bugreport.png>_______________________________________________
>>> gnucash-devel mailing list
>>> gnucash-devel at gnucash.org
>>> https://lists.gnucash.org/mailman/listinfo/gnucash-devel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gnucash.org/pipermail/gnucash-devel/attachments/20261102/0adcd01c/attachment.htm>


More information about the gnucash-devel mailing list