GnuCash
Contact   Instructions
Bug 797512 - Transaction with stock symbol XLU won't balance, symbol IXLU does.
Summary: Transaction with stock symbol XLU won't balance, symbol IXLU does.
Status: RESOLVED INCOMPLETE
Alias: None
Product: GnuCash
Classification: Unclassified
Component: Currency and Commodity (show other bugs)
Version: 3.7
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: core
QA Contact: core
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-12-04 14:48 EST by stevenospam2000
Modified: 2021-06-24 19:27 EDT (History)
5 users (show)

See Also:


Attachments
XLU stock purchase loops with rebalance message (35.91 KB, image/jpeg)
2019-12-04 14:48 EST, stevenospam2000
no flags Details
Buy XLU transaction with trading and imbalance accounts. (19.40 KB, image/png)
2020-01-03 18:48 EST, John Ralls
no flags Details
Second transaction added in GNC 3.7 (24.99 KB, image/png)
2020-02-10 15:18 EST, sphakka
no flags Details
First transaction added in GNC 3.5 (32.94 KB, image/png)
2020-02-10 15:20 EST, sphakka
no flags Details
Price DB (24.78 KB, image/png)
2020-02-10 15:21 EST, sphakka
no flags Details
Buy security transaction (MySQL) (49.09 KB, image/png)
2020-02-11 06:25 EST, sphakka
no flags Details

Description stevenospam2000 2019-12-04 14:48:50 EST
Created attachment 373470 [details]
XLU stock purchase loops with rebalance message

Windows 10 x64 at current levels. GC Version: 3.7 Build ID: 3.7+(2019-09-07).
I created a stock, IBM in the security editor and then as a stock that is a subaccount of a brokerage account. I can enter a stock purchase transaction in the IBM stock account without a problem. I enter the split as total shares and purchase price and then the funding split from the brokerage cash account. GC generates the Trading:CURRENCY:USD entry and the Trading:NYSE:IBM entry. All is well.

If I use the same process to create and then record an XLU purchase, I get stuck in a rebalance dialog. GC creates the correct Trading:CURRENCY:USD entry and the Trading:NYSE:XLU dollar amount but Trading:NYSE:XLU is missing the -170 shares I would expect to see and I cannot enter the -170 shares. When I hit enter I get the rebalance message and to get out of it I have to select let GC create an adjusting entry. The adjusting entries created are Imbalance-USD buy 372,235,989,849,409.25 and Trading:NYSE:XLU sell 372,235,989,859,233.38. I'm then unable to hit enter and record the transaction. I keep getting the rebalance message.

Does GC not like stock symbols that begin with X?

I'm attaching a previous session screen capture.
Comment 1 stevenospam2000 2019-12-04 22:39:07 EST
I deleted the XLU security and stock account. I then recreated the security as IXLU and recreated the stock account. I was able to add the stock purchase without a problem. I then edited the security to make it XLU and saved it without issue. I'm thinking a security that begins with X might be what causes this bug to appear.
Comment 2 John Ralls 2020-01-03 18:48:36 EST
Created attachment 373514 [details]
Buy XLU transaction with trading and imbalance accounts.

I'm not able to reproduce with the steps you gave, the attachment shows what I got after hitting enter without putting an amount in the cash split.
Comment 3 John Ralls 2020-01-03 19:03:05 EST
Interesting that the imbalance in your original report is 9824.10, 3 cents short of the purchase amount but in the screenshot it's exactly double that.
Comment 4 John Ralls 2020-01-03 19:22:38 EST
Can you reproduce it in a small test file and attach that file after saving? 

If you can't get it to save the transaction any other way try adding a balancing split to somewhere other than Schwab Steve's IRA.
Comment 5 John Ralls 2020-01-05 18:01:10 EST
A user reported a similar problem on the gnucash-user mailing list, but with INTC. It turns out that he has two INTC trading accounts, one in NYSE the other in NASDAQ though only a NASDAQ:INTC security. Do you have more than one XLU trading account? Note that one might be hidden on your chart of accounts either because you marked it hidden or because it has a 0 balance and you've set the preference to hide 0 balance accounts.
Comment 6 stevenospam2000 2020-01-06 20:35:08 EST
I checked the accounts and don't find a duplicate. I put all ticker symbols under NYSE and I don't have a NASDAQ or other exchange designation.

I'll create the test file as soon as I get a chance. I need to finish year end and budgeting first.
Comment 7 sphakka 2020-02-10 15:16:53 EST
In GNC v3.5 trough 3.7, it looks like this always happens irrespectively of the security used when trading in a foreign currency. I tried with USD as a home currency and adding a mutual fund transaction in EUR (with a security price originally set in EUR, and with extra trading and expense accounts in EUR) -- see attached pictures. Funny enough, the imbalance split is not the same between the two tested GBC versions.

Have a look at the Price DB picture, please. The last line (highlighted) is the original one entered via the the editor (in EUR), but the other two lines were added automatically when entering the two test transactions: they show a price in USD!? I have to say, indeed, that the original price was not automatically proposed when adding the split (should I expect that?): I had to write it in manually -- and no extra price dialog showed up, as it used to do in the past (or something like that), thus it seems that GNC is fooled into thinking that the price is in the home currency.
Comment 8 sphakka 2020-02-10 15:18:26 EST
Created attachment 373576 [details]
Second transaction added in GNC 3.7
Comment 9 sphakka 2020-02-10 15:20:49 EST
Created attachment 373577 [details]
First transaction added in GNC 3.5
Comment 10 sphakka 2020-02-10 15:21:33 EST
Created attachment 373578 [details]
Price DB
Comment 11 sphakka 2020-02-11 06:24:53 EST
My previous tests were done on an XML DB file. When working on a MySQL-backed GNC-3.7 instance, I see an even more annoying behaviour: a transaction for a security traded (buying) in a foreign currency can be entered correctly -- no imbalance or orphan amounts shown. Now, close GNC and restart: that last transaction will now show an orphan amount in the foreign currency balanced by an equivalent amount in a newly created top-level trading account bearing the same (short) name of the original security account.

I'd expect that:
1. the new trading account be filed under "Trading:FUND" as usual, instead of being top-level;
2. the orphaned amount appear as a split in the corresponding "Trading:CURRENCY" account.
3. if the above is correct, that the automatic splits appear immediately on entering the transaction, before closing GNC.

Right? See attached picture "Buy security transaction (MySQL)".

Apparently, all is well when selling...
Comment 12 sphakka 2020-02-11 06:25:14 EST
Created attachment 373579 [details]
Buy security transaction (MySQL)
Comment 13 Frank H. Ellenberger 2020-02-11 12:34:08 EST
Comment on attachment 373578 [details]
Price DB

In the transactions the price is in USD, but the NAV is in EUR with the same rate. As the rate USD:EUR is not 1, this confuses me.
Comment 14 sphakka 2020-04-05 12:31:41 EDT
Same (as per my Comment #11) with GNC-3.8b+ :-(
Comment 15 John Ralls 2020-04-05 12:47:54 EDT
sphakka,

1. Your issue is different from the subject of this bug. Please don't hijack bugs.
2. It looks like you have a defective account setup. Stock accounts must be children of accounts denominated in the currency in which they're traded so if you have US stocks they must be under a parent asset account denominated in USD while Euro-zone stocks must be under a parent asset account denominated in EUR.
3. The current release is 3.9.
Comment 16 sphakka 2020-04-14 15:16:00 EDT
Oops, sorry, I really thought it was the same. I'll check my setup, thanks for the tip!
Comment 17 John Ralls 2021-06-24 19:27:14 EDT
stevenospam2000 please reopen if you're able to create a test book demonstrating the problem on a recent GnuCash release.

Note You need to log in before you can comment on or make changes to this bug.