Bug 495118 - Downloading quote data from yahoo.com in csv format is broken
Summary: Downloading quote data from yahoo.com in csv format is broken
Status: RESOLVED FIXED
Alias: None
Product: alkimia
Classification: Frameworks and Libraries
Component: Online quotes widget (show other bugs)
Version: 8.1.76
Platform: Other Other
: NOR critical
Target Milestone: 8.2
Assignee: KMyMoney Devel Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-10-20 23:53 UTC by Ralf Habacker
Modified: 2024-10-30 19:27 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In: 8.1.90
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-10-20 23:53:52 UTC
STEPS TO REPRODUCE
1. Enter https://query1.finance.yahoo.com/v7/finance/download/BTC-USD?events=history&includeAdjustedClose=true in a browser

OBSERVED RESULT
The browser returned  the following json string:

{"finance":{"result":null,"error":{"code":"unauthorized","description":"User is not logged in"}}}


EXPECTED RESULT
Such message should not appear and the request should return the requested data
Comment 1 Bug Janitor Service 2024-10-25 13:04:09 UTC
A possibly relevant merge request was started @ https://invent.kde.org/office/alkimia/-/merge_requests/49
Comment 2 Ralf Habacker 2024-10-25 14:47:04 UTC
Git commit 261f62216a0d12e293f45027a911f905628f971c by Ralf Habacker.
Committed on 25/10/2024 at 13:53.
Pushed by habacker into branch 'master'.

Add json file support

The identification of prices and data in a downloaded json file is carried
out in the interface via corresponding values in the input fields 'date'
and 'price' or programmatically via the corresponding methods of the
AlkOnlineQuoteSource class. The hierarchy present in a json file is mapped
by specifying it as a path (with colons as separators).

See autotests/alkonlinequoteprivatetest.cpp for an example.
FIXED-IN:8.1.90

M  +25   -2    autotests/alkonlinequoteprivatetest.cpp
M  +1    -0    autotests/alkonlinequoteprivatetest.h
A  +35   -0    autotests/alkonlinequoteprivatetest.json
M  +1    -0    autotests/alkonlinequoteprivatetest.qrc
M  +10   -0    src/alkonlinequote.cpp
M  +2    -0    src/alkonlinequote.h
M  +142  -0    src/alkonlinequote_p.cpp
M  +1    -0    src/alkonlinequote_p.h
M  +6    -0    src/alkonlinequotesource.cpp
M  +3    -0    src/alkonlinequotesource.h
M  +4    -0    src/alkonlinequotesource_p.h
M  +10   -9    src/alkonlinequoteswidget.cpp

https://invent.kde.org/office/alkimia/-/commit/261f62216a0d12e293f45027a911f905628f971c
Comment 3 Ralf Habacker 2024-10-25 15:40:39 UTC
Git commit f64efd5ce8fefce21211b6b0ba9a19211b1ae60b by Ralf Habacker.
Committed on 25/10/2024 at 15:40.
Pushed by habacker into branch 'master'.

Fixup detecting error condition in AlkOnlineQuote::Private::parseQuoteJson()

M  +5    -0    src/alkonlinequote.cpp
M  +1    -0    src/alkonlinequote.h
M  +1    -1    src/alkonlinequote_p.cpp

https://invent.kde.org/office/alkimia/-/commit/f64efd5ce8fefce21211b6b0ba9a19211b1ae60b
Comment 4 Ralf Habacker 2024-10-25 16:16:56 UTC
Git commit edd2a912bda393189b102d78d448322cf965f0f2 by Ralf Habacker.
Committed on 25/10/2024 at 16:16.
Pushed by habacker into branch 'master'.

Add method AlkOnlineQuoteSource::supportsDateRange()

New method to determine if this online source supports a date range.

M  +5    -0    src/alkonlinequotesource.cpp
M  +9    -0    src/alkonlinequotesource.h

https://invent.kde.org/office/alkimia/-/commit/edd2a912bda393189b102d78d448322cf965f0f2
Comment 5 Ralf Habacker 2024-10-29 19:32:04 UTC
Git commit 01014f5780442595f413ad6434808729c981e77a by Ralf Habacker.
Committed on 29/10/2024 at 19:23.
Pushed by habacker into branch 'master'.

Extend date range support in a URL for downloading quotes

In URLs of online course sources, a start and end date in the
UTC time zone can be used with '%utc' variables in the order
listed. This is necessary for querying prices e.g. at yahoo.com.

For the use of local time zones, the variable '%u' has been
added, which was previously already available when parsing a
date.

M  +30   -9    autotests/alkonlinequoteprivatetest.cpp
M  +1    -1    autotests/alkonlinequoteprivatetest.h
M  +49   -31   src/alkonlinequote_p.cpp

https://invent.kde.org/office/alkimia/-/commit/01014f5780442595f413ad6434808729c981e77a
Comment 6 Ralf Habacker 2024-10-29 19:32:12 UTC
Git commit 5b5f15c4f004a25e42c1ad6e255f243aaaf7814c by Ralf Habacker.
Committed on 29/10/2024 at 19:29.
Pushed by habacker into branch 'master'.

Limiting the end date when adding date ranges to the download URL

In the AlkOnlineQuote class, the end date is now limited to the
current time, as individual services such as yahoo.com otherwise
respond with an error.

M  +11   -0    autotests/alkonlinequoteprivatetest.cpp
M  +7    -0    src/alkonlinequote_p.cpp

https://invent.kde.org/office/alkimia/-/commit/5b5f15c4f004a25e42c1ad6e255f243aaaf7814c
Comment 7 Ralf Habacker 2024-10-30 19:27:37 UTC
Git commit 3068065246ffdfdaef7fb25be091ed2e5b42ac0b by Ralf Habacker.
Committed on 30/10/2024 at 19:20.
Pushed by habacker into branch 'master'.

Add additional test quote sources for json data format to the test profile

M  +5    -3    src/alkonlinequotesource.cpp
M  +14   -0    src/alkonlinequotesprofile_p.cpp

https://invent.kde.org/office/alkimia/-/commit/3068065246ffdfdaef7fb25be091ed2e5b42ac0b
Comment 8 Ralf Habacker 2024-10-30 19:27:45 UTC
Git commit c84f6601a0fac4ec43cb86128aaa52477048a7fb by Ralf Habacker.
Committed on 30/10/2024 at 19:18.
Pushed by habacker into branch 'master'.

Fix endless loop when using date or price pattern not found in the json data hierachy

M  +2    -0    src/alkonlinequote.h
M  +14   -2    src/alkonlinequote_p.cpp

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