Reading share prices based on their ISIN via free online APIs

Share price icon
0 0
Read Time:2 Minute, 42 Second

Each beginning of a month, I keep manually entering share prices to one of my many Excel sheets so I can track the overall price of shares in my depot over time. As I’ve been thinking for a while, this seems to be unnecessarily tedious – why do I have to manually perform this task once per month? So I researched free (for private use) online APIs that would allow my to query the current and historical price based on their ISIN (German users could also use the WKN, but usually you are shown both anyway).

For my purposes, I found two providers that offer an API and can easily handle an ISIN as a parameter:

First provider

I’ve signed up (for free) at lemon.markets to request an API key. Following their documentation you can use the REST API to e.g. query for a certain ISIN with the latest quotes, e.g.

https://data.lemon.markets/v1/quotes/latest?isin=LU0629459743

which results in

	{
	  "status": "ok",
	  "time": "2022-12-17T20:33:45.654+00:00",
	  "results": [
		{
		  "isin": "LU0629459743",
		  "b_v": 190,
		  "a_v": 190,
		  "b": 108.62,
		  "a": 108.78,
		  "t": "2022-12-16T20:59:55.000+00:00",
		  "mic": "XMUN"
		}
	  ],
	  "previous": null,
	  "next": null,
	  "total": 1,
	  "page": 1,
	  "pages": 1
	}

Alternatively, you can also query historical data for certain dates (and times), e.g.:

https://data.lemon.markets/v1/quotes?isin=LU0629459743&from=2022-01-03T00:00:00.000%2B0000&limit=1

	{
		"status": "ok",
		"time": "2022-12-17T20:34:59.288+00:00",
		"results": [
			{
				"isin": "LU0629459743",
				"b_v": 80,
				"a_v": 80,
				"b": 134.72,
				"a": 135.44,
				"t": "2022-01-03T07:43:37.000+00:00",
				"mic": "XMUN"
			}
		],
		"previous": null,
		"next": "https://data.lemon.markets/v1/quotes?isin=lu0629459743&from=2022-01-03T00%3A00%3A00.000%2B0000&limit=1&page=2",
		"total": 22003,
		"page": 1,
		"pages": 22003
	}

Note (1): You need to request an API key and send it with the request, so just clicking on the links above without that information won’t work

Note (2): You won’t get any data for days that aren’t business days for the stock exchange, so make sure to take that into account

Second provider

A second provider is leeway.tech – you also have to sign up for a free API key and then use this query to find out your Symbol and Exchange

https://api.leeway.tech/api/v1/public/general/isin/LU0629459743?apitoken=token-goes-here

	
	[
	  {
		"Code": "UC44",
		"Exchange": "LSE",
		"Name": "UBS MSCI World Socially Responsible UCITS USD A-dis",
		"Type": "ETF",
		"ISIN": "LU0629459743",
		"previousClose": 9449,
		"previousCloseDate": "2022-12-16",
		"countryName": "UK",
		"currencyCode": "GBX"
	  },
	 ...
	 {
		"Code": "WSRUSA",
		"Exchange": "SW",
		"Name": "UBS MSCI World Socially Responsible UCITS USD A-dis",
		"Type": "ETF",
		"ISIN": "LU0629459743",
		"previousClose": 107.6,
		"previousCloseDate": "2022-12-16",
		"countryName": "Switzerland",
		"currencyCode": "CHF"
	  }
	]

Then choose your Symbol from the response (here it is Code) and the Exchange and query for historical quotes:

https://api.leeway.tech/api/v1/public/historicalquotes/WSRUSA.SW?apitoken=token-goes-here&from=2022-01-03&to=2022-01-03

	[
	  {
		"date": "2022-01-03",
		"open": 135.48,
		"high": 135.98,
		"low": 134.78,
		"close": 135.2,
		"adjusted_close": 133.5272,
		"volume": 127570
	  }
	]

For reference: My post on quant.stackexchange.com.

About Post Author

tim

Happy
Happy
0 %
Sad
Sad
0 %
Excited
Excited
0 %
Sleepy
Sleepy
0 %
Angry
Angry
0 %
Surprise
Surprise
0 %

Average Rating

5 Star
0%
4 Star
0%
3 Star
0%
2 Star
0%
1 Star
0%

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.