Main Content


Quandl connection


The quandl function creates a quandl object, which represents a Quandl® connection. To establish the connection, you must obtain a Quandl API key from the Quandl website by creating an account.

After you create a quandl object, you can use the history function to retrieve historical data.




c = quandl(apikey) creates a Quandl connection using a Quandl API key.

Input Arguments

expand all

Quandl API key, specified as a character vector or string scalar. To obtain your API key, create an account using the Quandl website.

Data Types: char | string


expand all

Timeout, specified as a numeric scalar that indicates the number of seconds to wait for data to return before canceling the request.

Example: 15

Data Types: double

Object Functions

historyRetrieve Quandl historical data


collapse all

Use a Quandl connection to retrieve historical data for a security within the available date range for the specified security.

Create a Quandl connection using a Quandl API key.

apikey = 'abcdef12345';
c = quandl(apikey)
c = 

  quandl with properties:

    TimeOut: 100

c is the quandl connection object with the TimeOut property. The TimeOut property specifies waiting for a maximum of 100 seconds to return historical data before canceling the request.

Adjust the display format to display currency.

format bank

Retrieve historical data for the CHRIS/ASX_WM2 security within the available date range for the security. This security provides historical future prices for Eastern Australian Wheat Futures, Continuous Contract #2. The specified security indicates the default periodicity (in this case, daily). d is a timetable with the time in the first variable and the previous settlement price in the second variable.

s = 'CHRIS/ASX_WM2';
d = history(c,s);

Display the first few rows of historical prices.

ans =

  8×1 timetable

       Time        PreviousSettlement
    ___________    __________________

    28-Apr-2018          294.00      
    27-Apr-2018          294.00      
    26-Apr-2018          294.00      
    25-Apr-2018          287.00      
    24-Apr-2018          287.00      
    23-Apr-2018          289.50      
    21-Apr-2018          291.00      
    20-Apr-2018          291.00      

Decide to buy or sell this contract based on the historical prices.

Version History

Introduced in R2018b

See Also

External Websites