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

KMyMoney stock quotes via IEX Cloud

2019-06-01
Author: Zoltan Puskas
Categories: linux
Tags:

Last year I’ve made a post on how to add the open API of IEXTrading as a data source for stock and ETF price quotes in KMyMoney. As of today IEXTrading has gated most of it’s non-IEX data behind a new platform called IEX Cloud. Let’s see how can we make the data to flow again for personal accounting purposes.

Less open stock market data

Unfortunately IEXTrading now requires an account and an API key to access most useful financial data. Officially it’s due to third party legal requirements, to filter out “Limited Access Customers”, but I would not be surprised if some have abused the open API, or them simply trying to push users toward the paid tier more.

Fortunately, as per IEX Cloud terms, they still provide a free tier to small volume, personal, non-commercial users with a data non-distribution clause. There are some limitations though:

  • 500k messages/month, which translates to 16.1k messages/day for a 31 day month,
  • 100 requests/s per IP address rate,
  • no live or delayed stock quotes, only end of day values.

Since KMyMoney only stores one quote value per symbol per day anyway and most users are likely to have less than a thousand symbols, this will yield very few requests even if quotes are updated daily, thus making these limitations perfectly acceptable.

Important to note that by creating an account, one has to provide a name and e-mail address at minimum, which is a hit to privacy, since now they can log and tie the requested quotes (i.e. your market positions and research) to your account and potentially share it with third-parties. To reduce privacy risks I’d recommend using a separate e-mail address for this, maybe even a pseudo name with a throw away e-mail, especially since they don’t seem to support deleting accounts. Additionally requesting extra symbols to mask actually owned financial assets might help too.

Please do not abuse the free tier and do not create multiple accounts to circumvent limitations! It’s already hard to find a reliable, free, and mostly open source for financial data.

Getting an API key

After creating an account and verifying your e-mail address on the left side of the page go to the “API Tokens” menu to get your API key.


IEX Cloud menu for API tokens

Copy the PUBLISHABLE type key starting with pk_.


IEX Cloud API token list

Updating the IEXTrading online quote source

Before proceeding first make sure you still agree with their most recent terms of use and privacy policy. To update the previously set up IEXTrading quote source with the new IEX Cloud API fire up KMyMoney and follow these steps:

  1. Open Settings->Configure KMyMoney... in the navigation menu.
  2. Go to the Online Quotes tab.
  3. Find the previously added IEXTrading item
  4. Update the URL field while keeping the others unchanged in the Details section as follows (place your pk_* token in the token section of the URL):
    • URL: https://cloud.iexapis.com/stable/stock/%1/quote?token=<your token starting with pk_ here>&format=json
    • Identify by: Symbol
    • Price: "latestPrice":(\d+\.\d+),
    • Date: "latestUpdate":(\d+)\d{3},
    • Date Format: %s
    • Skip HTML stripping: checked
  5. Click on the Update button to save your changes to the quote source.

Completed KMyMoney online quotes setup dialog

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


Content