MATLAB Stock API Example

It’s easy to use our API with MatLab, below you can find a very simple example with explanations for MatLab users.

url = ‘http://eodhistoricaldata.com/api/table.csv?s=AAPL.US&api_token=YOUR_API_KEY&a=0&b=1&c=2000&d=5&e=16&f=2017&g=d’;

[s,status] = urlread(url,’Timeout’,60);

C = textscan(s, ‘%s%f%f%f%f%f%f’, ‘HeaderLines’, 1, ‘delimiter’, ‘,’, ‘CollectOutput’, 0);

disp(C)

For testing purposes you can use this API Key: api_token=OeAFFmMliFG5orCUuwAKQ8l4WWFQ67YX. Works with AAPL.US only.

As you see, it’s easy to use. Usually, if you used before Yahoo Finance, then URL variable should look like this: ‘http://ichart.finance.yahoo.com/table.csv…..‘ and basically, all you need is to change the beginning of the URL to ‘http://eodhistoricaldata.com/api/table.csv‘ and then add your API Key as an additional parameter.

Please note, that it’s better to use HTTP instead of HTTPS for MatLab projects.

Subscribe to API