{ ^_^ } sinustrom Solving life, one problem at a time!

KMyMoney stock quotes via IEXTrading

Author: Zoltan Puskas
Categories: linux

In recent KMyMoney releases the list of choices for online stock quotes has significantly decreased, mainly due to financial web services terminating public access to data. Some of the available sources are missing certain U.S. based ETF quotes, or occasionally the API will mismatch certain symbols (when specified without :EXCHANGE) for a similarly named one on the European market, and thus returning the wrong price. To remediate this one can add the open IEXTrading API as a source for quoting the U.S. stock market.

Not so public stock market data

Unfortunately very few companies provide open access to detailed financial market data, which makes personal finance management a bit harder than it should be. One widely used provider, Yahoo! finance, has closed their API on the 1st of November, 2017, leaving a lot of users stranded. Many KMyMoney users on the KDE forums opted for scraping Google finance website, however there is a better, faster, and more privacy friendly alternative: using the open IEXTrading API.

Adding new online quote source

Before proceeding first make sure you agree with their, IMHO fairly reasonable, terms of use. To set them up as your quote source fire up KMyMoney and follow these steps:

  1. Open Settings->Configure KMyMoney... in the navigation menu.
  2. Go to the Online Quotes tab.
  3. At the bottom click the New button.
  4. Find the item New Qoute Source you’ve just created in the sources list and rename it by double clicking on it (e.g. to IEXTrading).
  5. Fill out the fields in the Details section as follows:
    • URL: https://api.iextrading.com/1.0/stock/%1/quote
    • Identify by: Symbol
    • Price: "latestPrice":(\d+\.\d+),
    • Date: "latestUpdate":(\d+)\d{3},
    • Date Format: %s
    • Skip HTML stripping: checked
  6. Click on the Update button to save your changes to the quote source.

Completed KMyMoney online quotes setup dialog

Updating investments to use new quote source

When done with the above you will have to update your investments to use the new quote source. To do that:

  1. On the left go to the Investments view, and select the Equities tab.
  2. Select your account containing securities traded in the U.S. stock market.
  3. Right click on investment item and choose Edit investment....
  4. Go to the online source setting, by clicking Next twice and select the newly set up source. Save the change by clicking Finish.
  5. Repeat above steps for your other U.S. traded securities.

An investment set to use the new online quote source

Now you can run Tools->Update Stock and Currency Prices... and have your prices updated. Happy accounting!