Bug 489484 - Online quote for currencies from yahoo.com does not provide a date/rate pair for the current day
Summary: Online quote for currencies from yahoo.com does not provide a date/rate pair ...
Status: RESOLVED FIXED
Alias: None
Product: alkimia
Classification: Frameworks and Libraries
Component: General (show other bugs)
Version: master
Platform: Other All
: NOR normal
Target Milestone: ---
Assignee: KMyMoney Devel Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-06-30 09:42 UTC by Ralf Habacker
Modified: 2024-07-08 17:37 UTC (History)
0 users

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ralf Habacker 2024-06-30 09:42:37 UTC
STEPS TO REPRODUCE
1. download snapshot for kmymoney from https://cdn.kde.org/ci-builds/office/kmymoney/master/windows/builds
2. unpack archive and start bin\onlinequoteseditor5
3. select profile "alkimia5"
4. press "install button" and install Yahoo.com [Currency]
5. Press "Check Source"

OBSERVED RESULT
(Debug) symbol=EUR-USD id=EUR-USD...
Adresse https://query1.finance.yahoo.com/v7/finance/download/EURUSD=X?events=history&includeAdjustedClose=true wird geholt ...
URL gefunden: https://query1.finance.yahoo.com/v7/finance/download/EURUSD=X?events=history&includeAdjustedClose=true...
Unable to find date/price pairs in quote data
EUR-USD EUR-USD

EXPECTED RESULT
A price and date should be returned

SOFTWARE/OS VERSIONS
Windows: 10
KDE Frameworks Version: 5.115.0
Qt Version: 5.15.12
Linux: openSUSE Leap 15.5
KDE Frameworks Version: 5.103.0
Qt Version: 5.15.8

ADDITIONAL INFORMATION
From the browser window you can see that the last delivered price is from the day before yesterday. For example on 2024-06-30 is returned

Date,Open,High,Low,Close,Adj Close,Volume
2024-06-28,1.070847,1.072099,1.068604,1.070847,1.070847,0 2024-06-28,1.070893,1.072731,1.068833,1.071582,1.071582,0
Comment 1 Thomas Baumgart 2024-06-30 13:31:35 UTC
Seems that the default for the start date is "today" and end date is also "today". Since no entry for this date is found in the returned set the result is OK. Would it make sense to change start date to the last work day if today is a holiday? Or set the start date to today - 1 week (which might be easier to implement)
Comment 2 Ralf Habacker 2024-07-01 11:53:57 UTC
(In reply to Thomas Baumgart from comment #1)
> Seems that the default for the start date is "today" and end date is also
> "today". Since no entry for this date is found in the returned set the
> result is OK. Would it make sense to change start date to the last work day
> if today is a holiday? Or set the start date to today - 1 week (which might
> be easier to implement)

With alkimia's current API, something like this would have to be implemented in every application that uses alkimia. Wouldn't it be better to solve this in alkimia in general ? 

I imagine this with a setter/getter for the class AlkOnlineQuote, with which you can enable an option: "if you have not found an entry in the interval, supply the last entry".  Applications can then decide whether they want this or not.

What do you think ?
Comment 3 Bug Janitor Service 2024-07-01 20:09:36 UTC
A possibly relevant merge request was started @ https://invent.kde.org/office/alkimia/-/merge_requests/45
Comment 4 Thomas Baumgart 2024-07-01 20:53:23 UTC
The default of this setting could be true when the date range has the same start and end date and it is identical to the current date. Just an idea to keep it simple for the user.
Comment 5 Ralf Habacker 2024-07-02 11:50:23 UTC
(In reply to Thomas Baumgart from comment #4)
> The default of this setting could be true when the date range has the same
> start and end date and it is identical to the current date. Just an idea to
> keep it simple for the user.

Good idea, I will change the bool type to an enum { Off, On, Auto }  with 'Auto' as default setting.
Comment 6 Ralf Habacker 2024-07-08 17:37:25 UTC
Git commit addab8fa480ee7c36c6d56cb9492927382757157 by Ralf Habacker.
Committed on 08/07/2024 at 10:50.
Pushed by habacker into branch 'master'.

Add support for handling special cases for price and date ranges
FIXED-IN:8.2

M  +10   -0    src/alkonlinequote.cpp
M  +45   -0    src/alkonlinequote.h
M  +20   -3    src/alkonlinequote_p.cpp
M  +1    -0    src/alkonlinequote_p.h

https://invent.kde.org/office/alkimia/-/commit/addab8fa480ee7c36c6d56cb9492927382757157