Bug 414333 - Investments - Edit and New investments - Unable to display online source list for Finance::Quote
Summary: Investments - Edit and New investments - Unable to display online source list...
Status: RESOLVED FIXED
Alias: None
Product: kmymoney
Classification: Applications
Component: general (show other bugs)
Version: 5.0.7
Platform: Debian stable Linux
: NOR major
Target Milestone: ---
Assignee: KMyMoney Devel Mailing List
URL:
Keywords:
: 390549 (view as bug list)
Depends on:
Blocks:
 
Reported: 2019-11-20 17:36 UTC by timothy
Modified: 2020-07-18 23:50 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.0.8
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description timothy 2019-11-20 17:36:46 UTC
SUMMARY
When creating a new investment or editing an existing investment

STEPS TO REPRODUCE
1. Open investment account; Select Investments view in left hand view selector; 
   Right click on an investment; Choose 'Edit Investment...' from the drop down 
   box; The investment detail wizard opens; Hit next; Hit next.
2. You are now in Select online source box; Select 'Use Finance::Quote' tick 
   box.
3. Now click in the 'Online Source' box which should give a list of sources for 
   F::Q.

OBSERVED RESULT
   The box fills in with solid colour and no drop down source list is produced.
   The 'Factor' box is greyed out. It is thus not possible to update the online
   Price/Date for any new or editted F::Q investments. No error messages are 
   shown. 
   This result is also valid for 'New Investments...' In this case one cannot 
   get an online quote for the new investment. The manual 'Price Update' is 
   still operational however.


EXPECTED RESULT
   When clicking in the 'Online Source' box a list of sources for F::Q should
   be shown. One would then select the appropriate source and factor and the 
   investment would then be updated when the 'Tools/Update Stock and Currency 
   Prices...' is selected.
   


SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: Debian GNU/Linux 10.2 Buster MATE
(available in About System)
KDE Plasma Version: n/a
KDE Frameworks Version: 5.54.0
Qt Version: Qt 5.11.3 (built against 5.11.3)

ADDITIONAL INFORMATION
This bug would could have occurred some time back as it would only be evident in new or editted investments using F::Q. Otherwise everything was normal and  share prices of existing investments were being updated as expected.
Unfortunately I do not have a version of KMM when the error occurred.
Comment 1 Thomas Baumgart 2019-11-20 19:14:29 UTC
I tried to duplicate the problem here, but apparently I am missing some Perl modules. Can you try what happens if you start /usr/share/kmymoney/misc/financequote.pl from the command line? Could be, that the file is installed in a different location on your distro.
Comment 2 Jack 2019-11-20 20:04:18 UTC
I get "Error 1" (with no trailing line break.) Which seems to come from financequote.pl around line 94, implying that no hash was returned from the $q->fetch call.  Now to figure out why that happens.
Comment 3 Jack 2019-11-20 21:01:09 UTC
I'm suspecting something in F::Q because it's returning no data almost immediately, even if I turn back on the automatic fallover, which should have it check all sources if the stock is not found at the first one.  I think this will take a debug trace deeper into the F::Q code.
Comment 4 Jack 2019-11-20 21:51:46 UTC
What version of F::Q are you using?  I currently have 1.47 (1.470 in some palces) but it looks like 1.49 is available.  1.47 still tried to access Yahoo which is completely dead, so whether or not it ruturns anything probably depends on which source you feed to F::Q.  I was trying "usa" which is supposed to check multiple US sources, but so far I only find it checking Yahoo.  I'll try to update F::Q and try again.
Comment 5 Jack 2019-11-21 00:39:52 UTC
With an updated F::Q (and associated other perl CPAN modules) I have success, but there seem to be wrinkles.  Using a source of "yahoo_json" or "fool" I do get a result.  Using "usa" I get a request to get an Alphavantage API key.  With the failover turned on, it always succeeds, but it seems the result hash also includes previous values, which was confusing until I realized what it was doing.  However, one of the hash keys indicates which source actually did succeed, so we might consider this option.

Separate issue, as mentioned in the email thread - in configuring the online source, when you check the "Use Finance::Quote" checkbox, it clears the dropdown for the online source.  Thomas mentioned on the mailing list that the checked state of the checkbox is only saved if there is a value in the dropdown, so that logic doesn't make sense, separate of actually getting a quote.
Comment 6 timothy 2019-11-21 06:37:09 UTC
My command line returns the symbol, price and date of fund requested.
I am using source za and za_unittrusts for south african shares and funds.
The F::Q perl modules are in /usr/local/share/perl/5.28.1/Finance/Quote/
I have updated to F::Q v1.49, but IMHO (humble) I do not think the problem is in F::Q as one has not even got the source list yet. I guess the source list must be stored in KMM because I remember asking Thomas to update KMM when F::Q finally got the za_unittrust module going and it did not autumatically appear in KMM source list.
Comment 7 timothy 2019-11-21 06:48:28 UTC
F::Q is absolutely necessary for a South African investment portfolio as it is the only module that accesses the JSE (Johannesburg Stock Exchange) in za and za_unittrusts. But as said before, I do not think we have even got to F::Q yet since my problem is only selecting the module for later updating of share prices in 'Update Share and Currency Prices".
Comment 8 timothy 2019-11-21 07:20:07 UTC
There is a command "/usr/share/kmymoney/misc/financequote.pl -l" which gives a listing of all F::Q sources. Maybe this is used to show the source list in KMM.
Comment 9 timothy 2019-11-21 12:04:28 UTC
Runnung KMM from the command line: as soon as I click on 'Use Finance::Quote' the F::Q source list is generated in the terminal. When I click on "Finish" the following error code appears. 

qt.qpa.xcb: QXcbConnection: XCB error: 3 (BadWindow), sequence: 2193, resource id: 13436031, major code: 40 (TranslateCoords), minor code: 0

I hhope that helps.
Comment 10 Jack 2019-11-21 23:22:23 UTC
I do not think that error is related, and I'm getting a "Unknown view '' in slotOpenURL()" which I also think is not related, but I'm not certain.

However, it does seem clear that "financequote.pl -l" is getting called, and the results are echoed to stdout, but not being used to populate the sources dropdown.  I'm trying to trace through the code, but have not yet figured out where those results are getting lost.
Comment 11 Thomas Baumgart 2019-11-22 14:04:21 UTC
Git commit 2d73384be87dc786fe1aecdd050b3759722e0033 by Thomas Baumgart.
Committed on 22/11/2019 at 14:04.
Pushed by tbaumgart into branch '5.0'.

Fix loading of Finance::Quote supported sources
FIXED-IN: 5.0.8

M  +1    -1    kmymoney/converter/webpricequote.cpp

https://commits.kde.org/kmymoney/2d73384be87dc786fe1aecdd050b3759722e0033
Comment 12 Thomas Baumgart 2019-11-22 14:05:31 UTC
Git commit 56d118b136f697af756e796688dda0b41727df02 by Thomas Baumgart.
Committed on 22/11/2019 at 14:05.
Pushed by tbaumgart into branch 'master'.

Fix loading of Finance::Quote supported sources
FIXED-IN: 5.0.8
(cherry picked from commit 2d73384be87dc786fe1aecdd050b3759722e0033)

M  +1    -1    kmymoney/converter/webpricequote.cpp

https://commits.kde.org/kmymoney/56d118b136f697af756e796688dda0b41727df02
Comment 13 Jack 2020-07-18 23:50:25 UTC
*** Bug 390549 has been marked as a duplicate of this bug. ***