GNOME Bugzilla – Bug 123312
QIF Import: Autoselection of Stock Exchange during import
Last modified: 2018-06-29 20:37:46 UTC
When importing from a QIF, the user must manually select the stock exchange for each security imported. It would greatly enhance usability if 2 and 3 letter symbols autoselected to NYSE and 4 letter symbols autoselected to NASDAQ. Anything longer than 5 letters could autoselect to FUND. The user would then have the ability to fix if the autoselection were wrong, but would not have to select the correct exchange from a pull-down menu for every single security that the user has ever traded. Steps to reproduce the problem: 1. Import a QIF file that contains securities/stock transactions 2. Click through to the import of stocks and funds 3. Notice that no matter how many letters are in the symbol, the exchange always defaults to NYSE, even though shares traded on NYSE are never more than 3 letters long.
Better yet, look up the symbol names. There must be a way to do a web query, or ship a file with the most common stocks and funds. I have 118 securities in my QIF file. (I don't own that many, but the securities show up if they're on Quicken's "watch list".) I'm not going to look up each stock/fund, one at a time...it would take hours. That's what computers are for.
And what about all the other stock markets in the world? I think there are a few more than NYSA and NASDAQ out there. I am not sure that it is possible to automatically convert Quicken/Money's stock code to GnuCash (Yahoo).
Created attachment 102731 [details] QIF with NYSE, NASDAQ and FUND symbol styles This file contains varying formats of NYSE, NASDAQ, and mutual fund symbols.
Created attachment 102732 [details] [review] Proposed patch This patch provides a somewhat smarter default based on the ticker symbol: -NYSE for symbols of 1-3 characters with an optional .X or .XX suffix -NASDAQ for symbols of 4 characters -FUND for symbols of 5 or more characters If a smarter method of determination (perhaps leveraging the Internet) is added later, this code could still be useful as a last resort.
As far as adding other stockmarkets goes, I think someone (not me) would have to develop an Internet lookup that asks the user to select among the available choices. Even a simple symbol like ABC represents at least three different companies on three different exchanges (NYSE, London, Bahrain).
Created attachment 102757 [details] [review] Proposed patch v2 Whoops... this fixes the NYSE's XXX.XX case.
I don't think this patch snippet is right: (if (not ticker-symbol) - (set! ticker-symbol stock-name)) + (set! ticker-symbol stock-name) + (set! namespace + (qif-dialog:default-namespace ticker-symbol))) This means, effectively: if ! ticker-symbol; then set! ticker-symbol stock-name ; else set! namespace qif-dialog:default-namespace ticket-symbol I don't think this is what you want, is it?
Yes, that's what I want - that is, I only want to analyze the ticker symbol (to guess at the namespace) if that ticker symbol is non-empty, i.e. the ticker symbol was included in the QIF file. Otherwise, the ticker symbol gets defaulted to be the same as the stock name (this isn't a change) and the namespace gets defaulted to FUND in the "let" above it. I hope to enhance this default behavior soon via a separate "enhancement" bug (and patch) that will consider the QIF security "T" line (if any) when determining the default namespace. Example: This namespace should default to FUND: !Type:Security NSecurity without a symbol TMutual Fund ^ This namespace should default to STOCK: !Type:Security N2nd security without a symbol TStock ^
An enhancement request covering QIF securities without a symbol has been filed as bug #511231. In the meantime, this patch is good to go.
Derek, I went ahead and committed this patch as r16950. Requesting backport for 2.2.4.
Applied to branches/2.2 as r16969 for GnuCash 2.2.4. Thanks a lot!
GnuCash bug tracking has moved to a new Bugzilla host. This bug has been copied to https://bugs.gnucash.org/show_bug.cgi?id=123312. Please update any external references or bookmarks.