Python script to fetch stock quotes

This is probably a question for a Kmymoney developer. I am in the process of hacking up a little python script to be called by Kmymoney to fetch stock quotes from Alphavantage, as is documented in Kmymoney handbook in the Online source quote section:

Note that the URL can also be a file: URL, which the quote fetcher takes to be the path to an executable script. It will pass any command-line arguments to it that you have specified, and feed the stdout to the page parser. For example, you might have a script called that contains custom quote logic, taking the symbol as a single parameter. Your URL would be “file:/path/to/ %1”.

If my script has some sort of internal error, is there a way for it to emit an error message that would appear to the kmymoney user in the “Update price” dialog?

I have tried printing a message to stdout and stderr, but in either case, all I see in kmymoney is the usual “Failed to retrieve a quote…” modal error message and the “Unable to update price for … (no price or no date)” error in the Update prices dialog.

Maybe, it is a good idea to read stderr as well and fill an error message and present it to the user if something is coming in through that channel. Which version of KMyMoney are you using?

Sorry, I meant to include that in the post above.

Running Kmymoney 5.1.3 on Linux:

Operating System: Arch Linux
KDE Plasma Version: 5.27.6
KDE Frameworks Version: 5.107.0
Qt Version: 5.15.10
Kernel Version: 6.3.9-zen1-1-zen (64-bit)
Graphics Platform: X11
Processors: 16 × AMD Ryzen 7 3700X 8-Core Processor
Memory: 31.3 GiB of RAM
Graphics Processor: AMD Radeon Graphics
Manufacturer: ASUS

The proposed change to receive on stderr and display in an error message will most likely happen in the current development version and not be backported to the 5.1 branch :frowning:

Thank you. I am looking forward to testing with this.

Code committed to the repository (master). Happy testing.