Problem in Trial Balance report with stocks and multiple currencies
Sherlock Holmes
sh025622 at gmail.com
Tue Sep 2 20:57:50 EDT 2025
Hi Chang,
If you haven't already, you may want to try to complete the registration
function again and file your bug on Bugzilla.
If you're not able, let me know and I'll attempt to file it for you.
Regards,
Sherlock
On 8/23/25 1:43 PM, Chang Wang wrote:
> Hi all,
> I noticed an issue with the Trial Balance report when using stock
> trading and multiple currencies. Even when transactions are balanced,
> the Trial Balance report appears to break due to incorrect calculation
> of unrealized gains.
>
> I've attached an uncompressed minimal example to illustrate the problem.
>
> Steps to reproduce:
> Open the attached book.
> Generate a Trial Balance report with reporting currency set to USD,
> price source set to Last up through report date, and enable Show
> Foreign Currencies and Exchange Rates.
>
> Observed behavior:
> The report shows an Unrealized Gain of $20,800, which is incorrect.
>
> Expected behavior:
> The Unrealized Gain should be $200.
>
> Explanation:
> The example contains three transactions:
> 1) 08/02/2025 - Buy one stock for 10,200 JPY.
> 2) 08/03/2025 - Exchange 100,000 JPY for 100,000 USD.
> 3) 08/04/2025 - Buy one stock for 10,400 JPY.
>
> The JPY/USD rate is fixed at 1 on all days, so there should be no
> realized or unrealized currency gains. Stock prices are set at 10X00
> JPY on 08/0X/2025, where X = 1, 2, 3, 4.
>
> Therefore, in USD reporting currency, the Trial Balance should show
> unrealized gains as:
> (10,400 * 2) - 10,200 - 10,400 = 200 JPY = 200 USD
>
> Notably, the Balance Sheet report does display the correct unrealized
> gain. And if transaction 3) or transaction 2) is removed, the Trial
> Balance turns out to be correct.
>
> I'm not familiar with Scheme, so I wasn't able to locate the problem
> in the source code. I also wasn't able to file a bug on Bugzilla,
> since the registration function appears to be broken.
>
> Thanks for your attention,
> Chang
>
> _______________________________________________
> gnucash-devel mailing list
> gnucash-devel at gnucash.org
> https://lists.gnucash.org/mailman/listinfo/gnucash-devel
More information about the gnucash-devel
mailing list