GNOME Bugzilla – Bug 735769
Setting exchange rate in commodity account with multiple currencies
Last modified: 2018-06-29 23:33:16 UTC
I'm going to describe this with an example which also shows how to reproduce it: I have a stock denominated in CAD that I want to buy. I am paying with money from my broker account which is denominated in SEK. Inside the commodity account I enter that I want to buy 10 shares at a total price of 1000 CAD. On the next line I enter my broker account and the amount 6500 SEK in the "Sell" column (exchange rate 1 CAD = 6.5 SEK) and hit Enter. At this time Gnucash creates an "Unbalanced-CAD" split with 5 500 CAD in the "Buy" column and three trading account splits: Trading:CURRENCY:SEK with 6500 in the buy column Trading:AMEX:STOCK with 1000 in the sell column Trading:CURRENCY:CAD with 5500 in the sell column The behaviour I would expect is that I would be asked the exchange rate between CAD / SEK, I would enter 6,5 SEK/CAD and the Unbalanced-CAD split wouldn't get created, and neither would the Trading:CURRENCY:CAD split. If I nevertheless save the transaction, and edit the transaction from the broker account I am able to set the exchange rate and balance the transaction. When doing this I can see that gnucash had assumed an exchange rate of 1 CAD = 1 SEK. This is with trading accounts enabled. Another way to accomplish a foreign stock purchase with a domestic account is described here, section 10.4.3: http://www.gnucash.org/docs/v2.4/C/gnucash-guide/currency_purchase1.html I'm creating this bug report since this was discussed in a thread in the gnucash-user list: http://lists.gnucash.org/pipermail/gnucash-user/2014-August/055833.html
There are some aspects of this that I don't fully understand. When you say that the stock is denominated in CAD, how does GnuCash know that? It doesn't keep track of the currency a stock is priced in. If you enter a transaction in the stock's commodity account, the currency for the transaction will be set to the currency of the parent account. Is this how you are establishing the pricing currency of the stock? Is the stock's account a child of a CAD account? GnuCash won't show the exchange rate dialog for a transaction in a commodity register since that register already has shares and price cells where this information can be entered. However, these cells are not currently enabled for any split in a currency account. I've changed it so that these fields are enabled if the currency of the split is not the same as the currency of the transaction. This will allow you to enter the exchange rate directly in the price cell of that split. Do you think this would solve your problem? I tried what I think are the steps you outlined and it seems to work.
Yes that is what I mean, the parent account is a CAD account in my example. It took me quite some time to figure out how this worked when one of my stocks ended up being priced in the wrong currency and I couldn't find anywhere this could be set. I wouldn't mind working only in SEK but I use Finance::Quote which fetches the stock's prices in CAD. Yes I think that would solve my problem. Thanks!
OK, I pushed this change. It should be in the next release. I will close this bug report assuming this is a satisfactory fix.
GnuCash bug tracking has moved to a new Bugzilla host. This bug has been copied to https://bugs.gnucash.org/show_bug.cgi?id=735769. Please update any external references or bookmarks.