How do you get free historical market data?

· Market Data

This is a very important and usual task. Historical data is mainly required for risk management purposes, model validation and back-testing. For these tasks software systems like Theta Suite, Matlab, Java or Excel are the main work space. We need to import the data here.

Other Posts in this Series

Starting with MS Excel and usual market data

Free historical data is available at several resources, depending on your market preferences, they might be more or less relevant:

A comprehensive list of free data sources

Besides the above usual data sources, there are numerous other sources. A pretty cool list is available here:

and another list is in my other post: List of Free Historical Market Data Sources.

Read Customized data from Matlab

If market data is available on the web, and you cannot download it easily, there are convenient ways for importing the data:

  • A great option for reading data from the web is getTableFromWeb_mod.m which allows you to choose a data table of an HTML and import it to Matlab. To get table data, it is necessary to know from which url you want to read in the data and from which table. If you have an url but no idea which table with the specified table number has the data – besides trial and error – you can use the getTableFromWeb and just click on the table you need.
  • If your data is not in a table, it is more challenging. A good help for your required custom code could be JSoup:  A simple Java HTML reader. With JSoup, you can do things like
url_string = '';
doc = org.jsoup.Jsoup.connect(url_string);
parser = org.jsoup.Jsoup.parse(char(doc.get()));
doc = parser.getElementsByTag('td');
text = {};
for i=1:doc.size
    text{i,1} =  char(doc.get(i-1).text());

Now, text{} contains a Matlab cell with e.g. USD/EUR.

Push historical data from Yahoo! into Matlab

If you just want go grab some historical data from yahoo into Matlab you also might just try: and get “get_hist_stock_data.m”. This works great for most cases and you have no hassle programming.

I hope, this helps. If you know of other free and convenient methods, feel free and drop me a line in the comment!


Comments RSS
  1. Donglin Wang

    Andreas. Long time no see. I really like this blog!

  2. Anonymous

    nice blog!

  3. TJ

    Trying to install FinAnSu-
    When I save FinAnSu.xll into %AppData%\Microsoft\AddIns and click Office Button > Excel Options… > Add-Ins, and in the Manage: dropdown at the bottom, click Excel Add-ins and Go,
    FinAnSu.xll is not in the list. However, when I click browse, it is right there. But when I click it, I get the error message that “…\AppData\Roaming\Microsoft\AddIns\FinAnSu.xll’ is not a valid add-in.”

    • Andreas Grau

      You probably need the 32bit version of FinAnSu – most Excel versions are 32bit, even on 64bit Windows.

  4. add

    Nice post. I used to be checking continuously this bog and
    I’m inspired! Very useful info specifically the last section 🙂 I maintain such inf a lot.
    I used to be looking for this particular info for a very lengthy time.
    Thank you and good luck.

  5. Fred G. Sanford

    Barchart’s data is extremely unreliable. Querying minute bar data on five US equities yielded results that were not even close to where the market traded. When seeking assistance from Barchart’s support we were informed that their ‘prices came directly from the exchanges’ and there was nothing they could do about any inaccuracies. Serious traders/developer should avoid.

  6. helloworld

    Tried to find 1980 to present Dow and other index data in Excel. The sites listed seem to have vanished.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

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