GnuCash
Contact   Instructions
Bug 797278 - create an option to define what type of commodity prices are being imported from CSV
Summary: create an option to define what type of commodity prices are being imported f...
Status: NEW
Alias: None
Product: GnuCash
Classification: Unclassified
Component: Import - CSV (show other bugs)
Version: unspecified
Hardware: PC All
: Normal enhancement
Target Milestone: ---
Assignee: import
QA Contact: import
URL: https://gnucash.uservoice.com/forums/...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-06-11 09:44 EDT by Frank H. Ellenberger
Modified: 2021-09-23 17:18 EDT (History)
7 users (show)

See Also:


Attachments

Description Frank H. Ellenberger 2019-06-11 09:44:55 EDT
[This bug report s a copy of https://gnucash.uservoice.com/admin/v3/suggestions/37860628/]

Once a week I download the week ending prices of all the stocks that I have owned to a csv file. Almost all of them import well. 2 do not. Those two are COP and ADP, because GnuCash assumes both are currencies.

i.e.
My CSV file has Conoco Phillips (COP) price and GnuCash assigns the value to Columbian Peso (COP)

I would like an option to say that all of the imported prices are stocks, or to ignore currencies. Maybe a pop-up window asking what the individual price is associated with when there are multiple commodities with the same ticker. Mostly I would like something more convenient than opening the editor every time to correct both of those entries.
Comment 1 Frank H. Ellenberger 2019-06-11 09:57:16 EDT
If you are no uservoice admin use the link in URL instead.

The OP was crater21_98@yahoo.com.

I just did a test: In the Commodity_From List are both: in the currencies COP (Columbian Peso) and at the end COP (Conoco Phillips) after I created it, but the data columns are missing a namespace column.
Comment 2 Bob 2019-06-11 16:19:03 EDT
Well I never thought of that...

So I could add a tick box under 'Allow existing prices...' with the text "Imported commodity prices are non currencies" and with this ticked by default the existing columns could be used.

Then add another property column of "Commodity Is Currency" which would have CSV values of translated "Yes/No"

These new options would be mutually exclusive so selecting one would deselect the other.

Looking at the code it does a unique table lookup, then a currency table lookup and then tries in all namespaces so I think this would fit in well. 

Any thoughts?
Comment 3 John Ralls 2019-06-11 16:48:21 EDT
Or add another column "namespace" which would align well with the pricedb model.
Comment 4 Geert Janssens 2019-06-12 02:44:08 EDT
(In reply to John Ralls from comment #3)
> Or add another column "namespace" which would align well with the pricedb
> model.

+1
Comment 5 Bob 2019-06-12 05:10:31 EDT
I think I am getting confused with the namespace for currency that I would match on.

Is it "CURRENCY" or translated "Currencies"
Comment 6 John Ralls 2019-06-12 09:39:51 EDT
It's either CURRENCY or ISO4217.
Comment 7 Geert Janssens 2019-06-12 09:47:51 EDT
That's an implementation detail really. Rather use
gboolean gnc_commodity_namespace_is_iso(const char *name_space)
Comment 8 Bob 2019-06-23 07:38:09 EDT
I have change the 'Commodity from' CSV import to require two populated columns, they are 'Namespace' and 'Symbol' that match the columns available in the 'Security Editor'. As long as the namespace / symbol combination matches the price database the 'Commodity from' will be valid.

This will be available in 3.6, please test when available and report back so that this bug can be closed.
Comment 9 David Carlson 2019-07-07 17:36:58 EDT
Are both Namespace and Symbol required for each commodity separately?
I cannot test this yet.
Comment 10 John Layman 2019-07-07 19:19:06 EDT
Requiring 'namespace' for each import entry is not an ideal solution because it requires that an internal GnuCash element be supplied.  Yeah, it aligns with the pricedb model, but it can't readily be derived from an external source.  I've been importing a mix of mutual fund, ETF, and stock prices from a source with an unpredictable order, and no way to infer the 'namespace' except eyeballs.  Providing 'namespace' requires about the same effort needed to enter prices manually using the price tool editor.  In my view, this "fix" breaks the general case to solve a rather rare one.
Comment 11 David Carlson 2019-07-07 20:33:15 EDT
Could the 'namespace' field be set up to act roughly the same way that the 'account' field does while editing transactions?  ie, a drop down list appears, but it is still possible to enter free form text?
Comment 12 Geert Janssens 2019-07-08 03:24:57 EDT
(In reply to John Layman from comment #10)
> Requiring 'namespace' for each import entry is not an ideal solution because
> it requires that an internal GnuCash element be supplied.  Yeah, it aligns
> with the pricedb model, but it can't readily be derived from an external
> source.  I've been importing a mix of mutual fund, ETF, and stock prices
> from a source with an unpredictable order, and no way to infer the
> 'namespace' except eyeballs.  Providing 'namespace' requires about the same
> effort needed to enter prices manually using the price tool editor.  In my
> view, this "fix" breaks the general case to solve a rather rare one.

I believe this is a valid point. Perhaps we should limit this to require a namespace in case of ambiguity only. Or adjust the importer to ask for clarification in case it detects ambiguity.

When going that route an additional challenge is to write that in such a way that it doesn't *require* a gui. It should remain possible to run the importers from say a python script in which the script script should be able to do most of the importer tweaking as the gui would allow.
Comment 13 John Ralls 2019-07-08 10:07:18 EDT
Since the actual issue is currencies vs. securities perhaps a simple currency yes/no would be better than requiring the user to remember in what namespace he configured the security. We might go so far as to default it to non-currency.

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