Bug 499441

Summary: Updating Stocks: Same regular expression does not work in master
Product: [Applications] kmymoney Reporter: jesse <jvapr27>
Component: generalAssignee: KMyMoney Devel Mailing List <kmymoney-devel>
Status: RESOLVED NOT A BUG    
Severity: normal    
Priority: NOR    
Version First Reported In: 5.1.3   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: First image
Error on master
Online settings for 5.1.9 where it is not working
Online settings for 5.1.3 where it is working

Description jesse 2025-02-03 04:46:28 UTC
Created attachment 177911 [details]
First image

SUMMARY
Updating stocks using yahoo as a source works in app image version 5.1.3-eef04f1 yet on master version 5.1.90-4fc2ef1 it does not work. 

The regular expression seems to be the same, yet on one of the it says it is not able to update the price.  

STEPS TO REPRODUCE
1. Open Kmy version 5.1.3-eef04f1 
2. go to investments
3. right click and select Update stocks and Currenty prices. 
4. 

OBSERVED RESULT
Under the version 5.1.3-eef04f1, it works fine. 
Under the version 5.1.90-4fc2ef1, it does not work. 

EXPECTED RESULT
Using the same regular expression it should work the same. 

SOFTWARE/OS VERSIONS
Windows: n/a
macOS: n/a
(available in the Info Center app, or by running `kinfo` in a terminal window)
Linux/KDE Plasma: Gnome 
KDE Plasma Version: n/a
KDE Frameworks Version: Version 5.115.0 
Qt Version: Version 5.15.13 (built against 5.15.12)

ADDITIONAL INFORMATION
Regular expression: 

https://query1.finance.yahoo.com/v8/finance/chart/%1
"regularMarketPrice":((\d+|\d{1,3}(?:[,]\d{3})).\d+)
Comment 1 jesse 2025-02-03 04:47:07 UTC
Created attachment 177912 [details]
Error on master
Comment 2 jesse 2025-02-03 04:48:14 UTC
Created attachment 177913 [details]
Online settings for 5.1.9 where it is not working

Image of the settings on master 5.1.9. It fails.
Comment 3 jesse 2025-02-03 04:49:02 UTC
Created attachment 177914 [details]
Online settings for 5.1.3 where it is working

It works with 5.1.3 but not 5.1.9 with the same reg ex.
Comment 4 Thomas Baumgart 2025-02-03 07:08:03 UTC
Your problem seems to be the missing date format. Here are the working settings for master:

Online quote settings generated with Alkimia 8.1.92-6d27032-webengine-qtnetwork

URL: https://query1.finance.yahoo.com/v8/finance/chart/%1
Download mode: Default
Data format: Stripped HTML
Identifier: 
Select by: Symbol
Price: "regularMarketPrice":((\d+|\d{1,3}(?:[,]\d{3})).\d+)
Price decimal separator: Legacy
Date: "regularMarketTime":([\d]+)
Date format: %u
Default identifier: 
Remote source: not checked

and here is the result:

(Debug) symbol=CSCO id=CSCO...
Fetching URL https://query1.finance.yahoo.com/v8/finance/chart/CSCO...
URL found: https://query1.finance.yahoo.com/v8/finance/chart/CSCO...
Symbol found: ''
Price found: '60.6' (60,6)
Date found: '1738357201'
Date format found: '1738357201' -> 'Fr. Jan. 31 2025'
CSCO CSCO Fr. Jan. 31 2025 60.6
Comment 5 jesse 2025-02-03 15:11:42 UTC
You are correct. I was missing the date format. 

That fixed the problem. 

Thanks!