About the API
Every single dataset on Quandl is available via our API, irrespective of where or how or in what format the data was originally published.
Things to keep in mind:
- Anonymous API calls are welcome but limited to 50 requests per (UTC) day.
- Signed-in Quandl users get 500 API calls per day.
- Users can request higher thresholds for free by contacting me. No request is ever refused. We just like to know the people who are making heavy use of the API. (Please note speed limit of 5000 calls per hour.)
To get all data points for the Prague Stock Index in json, do this call:
Or, if you want the data as csv, do this:
Registered users should include their auth_token like this:
You can find your auth_token on the Account page, under the API tab.
If you just want a few specific days, do this:
Quandl is really just a light web app that sits on top of the same API described on this page. The basic idea is that every dataset is identified by a unique id. The Prague Stock Index is uniquely identified by the code 'PRAGUESE/PX'. The unique code for any dataset is always visible on the dataset page beside the word "Quandl Code".
Once you know the Quandl code for a dataset, you can access it by API by simply appending it with the format you want the data in:
Please suggest more formats. Thanks!
Append any basic API call with parameters to indicate start date and end date. Set the start date with:
Set the end date with:
To get the Prague Stock Index data points for November 2012:
Quandl can transform data before serving it. Currently there are four transformations available: "diff", "rdiff", "cumul", and "normalize". If the data is denoted as y[i] and the transformed data as y'[i]:
|diff||y'[i] = y[i] - y[i-1]|
|rdiff||y'[i] = (y[i] - y[i-1])/y[i-1]|
|cumul||y'[i] = y[i] +y[i-1] + ... + y|
|normalize||y'[i] = (y[i]/y) * 100|
Append any basic API call with parameters to indicate the desired transformation:
To get the Canadian GDP annual per cent change:
Append any basic API call with parameters to indicate the desired frequency.
When you change the frequency of a dataset, Quandl returns the last observation for the given period. So, if you collapse a daily dataset to "monthly", you will get a sample of the original dataset where the observation for each month is the last data point available for that month.
To get crude oil prices on a quarterly basis from the EIA's daily spot price:
You can choose the sort order, descending is the default:
You can use
rows=n to get only the first n rows of your query. Use
rows=1 to get the latest observation for any dataset.
You can exclude headers on csv API calls:
So to get the latest price of the Prague stock exchange, data only, you could do:
A Complex Example
Annual per cent change in oil prices since 2005:
The API allows you to upload your own data to the site.
To upload to Quandl you need to submit an HTML form, which can be done from your favourite programming language.
For every upload you need the following:
- Authorization token: To associate your data and acount. See here for more.
- Data: As a percent-encoded CSV string, with dates as the first column.
- Code: Quandl Code you want to give your data, consisting of only capital letters, numbers and undescores.
- Title: The title of your dataset.
- Description (optional): A description of your dataset.
The base call is:
All the other information must be sent as data in your HTTP POST.
To override an already exisiting dataset at the code you wish to use (defaults to false):
You can now get a list of a user's favourite datasets via the API in XML or JSON:
To get the metadata on any dataset:
For csv files containing all stock tickers, futures symbols, country codes and currencies please see our API resources page.
Also keep in mind that this API is a work in progress. Tell us about bugs or additional needed features.