SUMMARY With kmymoney5, support for WebPriceQuote has been extended to download online prices based on a date range, which is currently missing in alkimia. In kmymoney this is done by connecting the WebPriceQuote::csvquote() signal to a method, then calling the WebPriceQuote::setDate(from, to) [1] method, followed by a call to WebPriceQuote::launch(...) which triggers the mentioned signal. The signal returns the queried online prices in an instance of a class known only to kmymoney. Another method would have to be used here. Currently there is the following signal defined: void quote(const QString&, const QString&, const QDate&, const double&) To cover multiple values an additional signal should be added providing a map of online prices void quote(const QString&, const QString&, QMap<QDateTime, double>); The type QDateTime was chosen to support also dates with times. [2] The URL used to download such online prices can contain variables to replace year, month and day, as seen in the following example: http://www.nasdaqbaltic.com/market/?instrument=%1&pg=details&tab=historical&lang=en&date=&start=%d.%m.%y&end=%d.%m.%y&pg=details&pg2=equity&downloadcsv=1&csv_style=english [3] An implementation would need to support this, but also alternative dates, for example in Unix time format, as can be seen in this example: https://query1.finance.yahoo.com/v7/finance/download/ORCL?period1=1593696392&period2=1625232392&interval=1d&events=history&includeAdjustedClose=true. The supported variable names should be unique for the start and end dates to be immune to a change in parameter order, which is not the case for [3]. For [1] a better method name would be setDateRange(...) and the parameter types should be changed to QDateTime for the same reasons mentioned at [2], so the complete signature is setDateRange(const QDateTime &from, const QDateTime &to).
(In reply to Ralf Habacker from comment #0) To support this format and additional property the current checkbox for "stripping HTML" should be converted to a "data format" combo box with supported values "HTML" and "Raw text" to which the new csv format can be added.
(In reply to Ralf Habacker from comment #0) > In kmymoney this is done by connecting the WebPriceQuote::csvquote() signal > to a method, then calling the WebPriceQuote::setDate(from, to) [1] method, > followed by a call to WebPriceQuote::launch(...) which triggers the > mentioned signal. The signal returns the queried online prices in an > instance of a class known only to kmymoney. Another method would have to be > used here. > > Currently there is the following signal defined: > > void quote(const QString&, const QString&, const QDate&, const double&) > > To cover multiple values an additional signal should be added providing a > map of online prices > > void quote(const QString&, const QString&, QMap<QDateTime, double>); > > The type QDateTime was chosen to support also dates with times. [2] It turns out that such a signal is a basic requirement for retrieving rate data in csv format, which is handled by bug 474061. Adding a date range is then limited to patching the url template and filtering the retrieved values.
Git commit 4715c3fa7749e41945b5d17d151e99bec516d648 by Ralf Habacker. Committed on 28/09/2023 at 15:05. Pushed by habacker into branch 'master'. Add parsing of online offers in csv format For this purpose, the "date" and "price" attributes of the online quote source are used to specify column names from which the information to be extracted is read, and the "date format" attribute is used to extract the date. It is assumed that the first line of the downloaded csv file contains the names of the columns. The column separator used is determined automatically, currently supported are [,; \t]. The extracted values are collected in a QMap and sent to the caller via the signal AlkOnlineQuote::quotes(...). Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de> M +91 -1 src/alkonlinequote.cpp M +5 -1 src/alkonlinequote.h M +4 -0 src/alkonlinequotesource.cpp M +2 -1 src/alkonlinequotesource.h M +16 -0 src/alkonlinequoteswidget.cpp https://invent.kde.org/office/alkimia/-/commit/4715c3fa7749e41945b5d17d151e99bec516d648
Git commit 84d49ff66156143ac2485d2ff3eb324ba3fc319a by Ralf Habacker. Committed on 22/12/2023 at 14:50. Pushed by habacker into branch 'master'. Add support for downloading online prices based on a date range This support has been added to the download of online prices in CSV format, as only there are several days available. FIXED-IN:8.1.72 M +12 -0 src/alkonlinequote.cpp M +7 -0 src/alkonlinequote.h https://invent.kde.org/office/alkimia/-/commit/84d49ff66156143ac2485d2ff3eb324ba3fc319a