-
Notifications
You must be signed in to change notification settings - Fork 812
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update gnc-commodity.cpp for finance-quote 1.63 #2033
Conversation
Thanks. This at least brings the pick lists more or less up to date. Removing sources from the list is less helpful than one might think unless F::Q has stopped providing them altogether because everything F::Q returns in a To your details, most are fine. One exception:
How about You had some questions:
It's in both as are
Which makes
I suppose, to be symmetrical with
That just changes the UI unnecessarily. Leave it as-is. |
2a4420c
to
2349832
Compare
2349832
to
84e6a21
Compare
Glad I can help [...]
I decided to use full names of modules in order they are queried, limiting to two modules if there are 2 or more (but expanded the list in documentation).
This is a comment for multiple quote sources, but I guess it applies to single quote sources as well. I put the following sources in previous comment, but let me reiterate:
Thank you for that clarification. This is what I got when using Gnucash. I also gather that sources that have been selected by user are stored as text (module name only) in a That means there are 2 sources of potentially unknown modules: the |
I think you missed the point: I'm suggesting replacing Yahoo JSON with Motley Fool instead of FinanceAPI because FinanceAPI requires an API key while Motley Fool and Yahoo don't. Considering the strict quotes/day limits on AlphaVantage maybe replace that with FinanceAPI.
Yes, with a clarification: Sources are stored by the source name returned from F::Q's
I don't think F::Q has a way to enforce that. @bpschuck ? |
On 10/18/24 10:13 AM, John Ralls wrote:
I think you missed the point: I'm suggesting replacing Yahoo JSON with
Motley Fool instead of FinanceAPI because FinanceAPI requires an API key
while Motley Fool and Yahoo don't. Considering the strict quotes/day
limits on AlphaVantage maybe replace /that/ with FinanceAPI.
On the other hand, I would bet that 1 or 2 years down the road it is far
more likely the FinanceAPI module will work as is and YahooJSON may
break a few times.
Methods requiring API keys:
Pros - far less likely to change over time
Cons - limits on number of queries and/or throttling.
Personally, since I'm only getting quotes each day for about 2 dozen
securities and funds, I have switched all my YahooJSON sources to
FinanceAPI.
In any case Finance::Quote should not reuse names of sources. I.e.
cse stands for Colombo Stock Exchange today. Should it disappear,
and subsequently, say, a Cyprus Stock Exchange is added it should
not use cse. But it is OK for name to disappear and then appear
again as long as it has the same semantic (and preferably security
codes). I.e. when there was no source for given country for a while.
Are these assumptions correct?
I don't think F::Q has a way to enforce that. @bpschuck <https://
github.com/bpschuck> ?
Negative sir. Although future contributors could look in the
Modules-README.yml file and see a module name has already been used. Not
yet in that file, methods for each module. I *have* been thinking of that.
Regardless, I trust that you have your private sources named in such a
way that collisions with future F::Q names are unlikely.
Nope. If CSE were to be removed and a year or two down the road someone
creates a new unrelated module as in your example, nothing to stop that.
Me, I'd name the module and method(s) something more identifiable as
"Cyprus" and not "CSE". I guess I (or whoever may be the gatekeeper of
F::Q in the future), could ask contributors to rename when reviewing
pull requests. And the Hackers Guide/Docs could also contain a note
asking contributors to look at the Modules-README.yml file and not reuse
obsolete/removed module and method names.
Bruce S.
|
@bpschuck does Modules-README.yaml have sources removed before you created it in 2019? |
On 10/18/24 15:02, John Ralls wrote:
And the Hackers Guide/Docs could also contain a note asking
contributors to look at the Modules-README.yml file and not reuse
obsolete/removed module and method names.
@bpschuck <https://github.com/bpschuck> does Modules-README.yaml have
sources removed before you created it in 2019?
Negative sir. As far as I recall it started as a snapshot of what was in
the package at the time. Back then Erik was still running the show and I
was but a simple volunteer contributor. I primarily came up with the
format and basic fields while I believe it was Vincent who did the
initial grunt work of listing the modules and their related data.
BTW @pkryger, including "poland" as multi-source when it's only
referenced in Stooq.pm may not be a good idea. In the future if another
module that is primarily for the Warsaw exchange is added and also
advertises the "poland" method, then it makes sense. Because right now
if someone were to use "poland" as a source, the *only* method
used/tried would be the "stooq" method from Stooq.pm. Just my $0.02.
Bruce S.
|
Before it gets lost you should add the final form of your procedure as separate page |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At least for new sources we should add the region.
Think about a not US based user, who is looking for a source for their mixture of commodities. As the source names have been very cryptic at the beginning, the region is one criterion, which they should test,
libgnucash/engine/gnc-commodity.cpp
Outdated
{ false, SOURCE_SINGLE, "Google Web, US Stocks", "googleweb" }, | ||
{ false, SOURCE_SINGLE, "India Mutual", "indiamutual" }, | ||
{ false, SOURCE_SINGLE, "IEX (Investors Exchange), US", "iexcloud" }, | ||
{ false, SOURCE_SINGLE, "Market Watch", "marketwatch" }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Region? Seems to be US based.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah - but I was able to find quotes for Japanees, Chineese, Australian, German, UK, and Polish based stocks there. They seem to be positioning themselves similarly to say Bloomberg. Leaving this and other sources that are not clear to me yet as open issues for now.
Let's continue the discussion here
libgnucash/engine/gnc-commodity.cpp
Outdated
{ false, SOURCE_SINGLE, "Morningstar, GB", "morningstaruk" }, | ||
{ false, SOURCE_SINGLE, "Morningstar, JP", "morningstarjp" }, | ||
{ false, SOURCE_SINGLE, "Motley Fool", "fool" }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Region?
libgnucash/engine/gnc-commodity.cpp
Outdated
{ false, SOURCE_SINGLE, "SIX Swiss Exchange shares, CH", "six" }, | ||
{ false, SOURCE_SINGLE, "Skandinaviska Enskilda Banken, SE", "seb_funds" }, | ||
{ false, SOURCE_SINGLE, "Sharenet, ZA", "za" }, | ||
{ false, SOURCE_SINGLE, "StockData", "stockdata" }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Region?
libgnucash/engine/gnc-commodity.cpp
Outdated
{ false, SOURCE_SINGLE, "T. Rowe Price, US", "troweprice_direct" }, | ||
{ false, SOURCE_SINGLE, "Tradegate, DE", "tradegate" }, | ||
{ false, SOURCE_SINGLE, "Treasury Direct bonds, US", "treasurydirect" }, | ||
{ false, SOURCE_SINGLE, "Twelve Data", "twelvedata" }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Region?
FYI
ASX (native method "asx", also advertises "australia") is failing and
will be removed in F::Q v1.64.
MorningStarAU (native "morningstarau", advertises "aufunds") is also
failing. Being researched for possible fix by F::Q v1.65 (not v1.64).
Bruce S.
|
There are a bunch of Australian GnuCash users of that price source. Please flag that it's got problems on gnucash-user and see if anyone steps up to maintain it. |
On 10/19/24 5:33 PM, John Ralls wrote:
ASX (native method "asx", also advertises "australia") is failing
and will be removed in F::Q v1.64.
There are a bunch of Australian GnuCash users of that price source.
Please flag that it's got problems on gnucash-user and see if anyone
steps up to maintain it.
There has been an issue opened since May.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ASX (native method "asx", also advertises "australia") is failing and will be removed in F::Q v1.64.
Add @bpschuck: should I remove it with this effort? Or give it some time?
libgnucash/engine/gnc-commodity.cpp
Outdated
{ false, SOURCE_SINGLE, "Google Web, US Stocks", "googleweb" }, | ||
{ false, SOURCE_SINGLE, "India Mutual", "indiamutual" }, | ||
{ false, SOURCE_SINGLE, "IEX (Investors Exchange), US", "iexcloud" }, | ||
{ false, SOURCE_SINGLE, "Market Watch", "marketwatch" }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah - but I was able to find quotes for Japanees, Chineese, Australian, German, UK, and Polish based stocks there. They seem to be positioning themselves similarly to say Bloomberg. Leaving this and other sources that are not clear to me yet as open issues for now.
Let's continue the discussion here
On the surface it's pretty trivial, you just wrap the strings with |
The ASX source "sort of" works. It uses 2 different URLs, if the first one fails it tries its second URL. The 1st URL always fails. ASX is utilizing a JavaScript tool called Incapsula. The 2nd URL, while providing basic price data, does not include a trade date. I assumed that since there have been no issues raised on the trade date not being included that there are few users of the module. |
Leave it for now. However, while doing some cleanup I found IEXCloud has been retired. Definitely will be removed in F::Q v1.64. "We have retired IEX Cloud. All IEX Cloud products and support concluded on August 31, 2024. To help customers with this transition, we have signed a referral agreement with Intrinio, a full service data management company." A quick look at Intrinio I did not find free or inexpensive data plans. |
My pragmatical view: |
I guess this is source based. While
Should the regions end up in documentation, perhaps it would warrant adding an extra region column. That way the description can be more verbose, i.e., for What's more: what data is provided by each source could change. I could easily see players to add and remove regions and asset classes as they sing and end contracts with other data providers. This is out of control of Perhaps Wiki is a good place for that, as updating sources should be easier. Maybe even provide a link to the table in Security Editor? All in all please let me know if I should remove regions from code. |
In documentation it can be written out in complete sentences like "Stooq: Comprehensive for Polish securities, also provides prices for German, French, UK and US stocks."
Another reason for it to be in the wiki instead of the manual, so lots of users can contribute what they've learned about particular sources. |
It is difficult to respond to that without sarcasm. You're suggesting that we should deliberately make it impossible to translate parts of the UI for what you suppose to be the convenience of translators. @SziaTomi is putting in that work because they want a complete translation of the UI into Hungarian. It seems very unlikely to me that they want you deciding that there are parts that they have to leave in English.
|
My bad - I shouldn't have use quote source names when I ment entity names. But you have answered my question. I updated names in the list to use English names. Also marked strings for translations. |
libgnucash/engine/gnc-commodity.cpp
Outdated
{ false, SOURCE_SINGLE, "Yahoo as JSON", "yahoo_json" }, | ||
{ false, SOURCE_SINGLE, "Yahoo Web", "yahooweb" }, | ||
{ false, SOURCE_SINGLE, "YH Finance (FinanceAPI)", "financeapi" }, | ||
{ false, SOURCE_SINGLE, N_("Alphavantage"), "alphavantage" }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMHO we should then add a msgcontext, e.g.:
{ false, SOURCE_SINGLE, C_("FQ source", "Alphavantage"), "alphavantage" },
…
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, we need a delay. I fear we have no macro for that defined, @jralls ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should call g_dpgettext2 (…) as used in gnucash/gnome/assistant-stock-transaction.cpp.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, we need a delay. I fear we have no macro for that defined, @jralls ?
No worries. The macro comes from glib/gi18n.h and it's already flagged for xgettext.
{ false, SOURCE_SINGLE, C_("FQ source", "Alphavantage"), "alphavantage" },
A poor choice, that's a trademark. Nobody's going to think it's anything else. Likely nobody will translate it, either, considering it's a company name. "Any of the countries are much better exemplars of needing a translation context. But that raises an interesting question: Some of the non-English user names, like Borsa Italiana and Bursa de Valori Bucuresti, are descriptive and should be rendered in English in gnc-commodity.cpp and translated back, but others (FinanzPartners perhaps?) are company names trademarked in their countries; those should be left alone. I suppose that they shouldn't be marked for translation either. Or am I overthinking this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know that the following is probably mudding waters even more, instead of driving to a solution, but I think it's even more subtle.
When I originally added Borsa Italiana I went to their home pages and it doesn't seem they are encouraging translation of their name. So: is it a trademark that should be left as is?
Some languages that don't use latin script may want to translate names that could be recognised as trademarks. One example could be Commerzbank that could be rendered in Cyrillic script as Коммерцбанк. I know that French, despite using latin script, also like to stick to their own language. But not sure how prolific it is in accounting applications translations.
There's even more. @bpschuck mentioned, that future versions of GnuCash would use dynamically just out of curiosity, how such strings that come from another application, could be translated?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I originally added Borsa Italiana I went to their home pages and it doesn't seem they are encouraging translation of their name. So: is it a trademark that should be left as is?
The intro on that webpage says "Borsa Italiana has been founded after the privatisation of the exchange" and "from 29th April 2021, Borsa Italiana is part of Euronext Group." So I guess that it is indeed a company name.
You have a good point about translating (or transliterating, but for our purposes there's no difference) for non-Latin scripts. That argues for marking all of them and providing a translator comment on the ones that are company names. I guess that might turn out to be all of them.
You're right that translating strings from another project requires that project to have a message catalog to retrieve the translations from and Finance::Quote at present doesn't. Using methodinfo
in GnuCash will require a pretty big design change and (as @bpschuck pointed out in his reply) another piece of that redesign needs to be a way to handle obsolete sources. Let's keep this PR focused on the current design.
22a8b61
to
c8c493a
Compare
libgnucash/engine/gnc-commodity.cpp
Outdated
{ false, SOURCE_SINGLE, "Yahoo as JSON", "yahoo_json" }, | ||
{ false, SOURCE_SINGLE, "Yahoo Web", "yahooweb" }, | ||
{ false, SOURCE_SINGLE, "YH Finance (FinanceAPI)", "financeapi" }, | ||
{ false, SOURCE_SINGLE, C_("FQ Source", "Alphavantage"), "alphavantage" }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, you want NC_("FQ Source", "Alphavantage"), "alphavantage"
and then you have to search each usage and decide translate it —C_("FQ Source", "…")
I think — (shown to the user) or not (stored in the file or log files)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I used NC for all as suggested. However, my time has become more limited now and not sure if I will have enough of it to do anything more involved. Because of that constraint if this is not what you've been looking for, I propose to remove the translation markers, merge just the updated list and proceed with translations as a separate PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not so hard: The user name is retrieved in exactly one place, so to perform the translation you need only do
--- a/gnucash/gnome-utils/dialog-commodity.cpp
+++ b/gnucash/gnome-utils/dialog-commodity.cpp
@@ -778,7 +778,7 @@ gnc_ui_source_menu_create(QuoteSourceType type)
supported = gnc_quote_source_get_supported(source);
gtk_list_store_append(store, &iter);
gtk_list_store_set(store, &iter,
- SOURCE_COL_NAME, name,
+ SOURCE_COL_NAME, C_("FQ Source", name),
SOURCE_COL_FQ_SUPPORTED, supported,
-1);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
c8c493a
to
4356aa5
Compare
4356aa5
to
cba8682
Compare
Thanks! |
A few weeks ago @bpschuck asked for help with updating
Gnucash
for recent version offinance-quote
. I hope this work a reasonable starting point.I run the following code in [
finance-quote-wrapper](https://github.com/Gnucash/gnucash/blob/05aadd0/libgnucash/quotes/finance-quote-wrapper.in#L114)
to get multiple quote sources (i.e. more than one module):Which yielded the following methods:
Then got single quote sources list using the script above, but used
@$v == 1
. Cross checked withfinance-quote/Modules-README.yml
, and tried to apply the following rules, while updating the list of modules ingnc-commodity.cpp
:While I think this work is probably a reasonable first cut, I think the following comments and questions should be at least reviewed by someone with more experience in this subject:
FinanceAPI
instead ofyahoo_json
in multiple quote sources descriptions.intiamutual
looks like a multiple quote source, but has only one source, leave as is?australia
,dutch
indiamutual
,france
, andromania
.india
,hungary
,greece
, andpoland
.aufund
be added to multiple quote sources?troweprice
has been in multiple quote sources, but it has only one module. Not sure why. Removed from multiple quote sources. Also removedtroweprice_direct
in favour oftroweprice
in the single quote sources. Added as alternative in manual.tratedate
andxetra
as they seem to use more specific URL thansinvestor
does.tsx
be renamed totmx
for Toronto Stock eXchange? The list originally hadtsx
(left it as is). Alternatively change the name to Toronto Stock eXchange (TMX), CA to highlight what TMX is.bats
- omitted in favour ofgoogleweb
. Or shall I add it, as say BATS Global Markets, US with a link in manual pointing to https://cboe.com (per Wikipedia)tradeville
- omitted in favour ofbvb
.mstaruk
- omitted, in favour ofmorningstaruk
that has already been in the list. Added as alternative in manual.hu
module, that is failing ATM, that is:bamosz
,bet
,hufund
,hustock
, andhu
. Moved section to deprecated in manual.morningstarau
- omitted, module is failing ATM.oslobors
- omitted, module is failing ATM.cse
- added, module is actually working (marked as failing inModules-README.yml
, will send a separate PR to address this).comdirect
- strictly speaking it is failing in 1.63, but fixed recently - included.There's a complimentary Gnucash/gnucash-docs#345 to update relevant tables in gnucash-docs manual.
Since the change itself doesn't affect any logic (merely updates list contents) I believe a verification I performed with
ninja check
indebian:stable
container should be sufficient.