Kmymoney updating stock & mutual fund issue

Hi Section8, I would like to try your python code for quotes when it is available. Thanks. I am not clear on one thing; does this method mean that the stock quote retrieval is separate from KMM and thus you then Import the quotes through, say, a CSV file? or is the python script somehow integrated into KMM so that there is no need for import? A

Hi Atheist,
In its simplest form, you just set it up as an online quote source according to this paragraph in the “Online Price Quotes” section of the KmyMoney handbook:

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 getquote.sh that contains custom quote logic, taking the symbol as a single parameter. Your URL would be “file:/path/to/getquote.sh %1”.

I just set up an online quote source in kmm with a URL of “file:/path/to/tdquotes.py --fetch %1”. It will retrieve the quote from Twelve Data and wait a default of 8 seconds between quote retrievals - so this can take a while in kmm if you retrieve a lot of quotes.

The script also has a “–retrieve” option that can be configured to retrieve multiple quotes from Twelve Data and put the values in a .csv file. I have this configured to run in the background a couple of times a week using a systemd timer task on my linux system (you could also use crontab).

When you get online quotes from kmm, the “–fetch” option first looks in the .csv file for a matching quote and fetches the one with the earliest date if it finds any. It only goes directly to Twelve Data (with the 8 second delay) if it can’t find a match in the .csv file (or the .csv file doesn’t exist).

1 Like

Atheist - I have uploaded my python quote script to github here: https://github.com/SectionEight8/tdquotes. The README there should document how to set it up.

Currently, this only works on Linux. If anyone wants to use this with KMyMoney on Windows, that is still a work in progress, but I think it could be updated to run on Windows.

Thanks very much! Looking forward to trying it.