Nasdaq Data Link | Gaining insights from ready-to-use datasets using Quandl API in Python

8 min read

By Anshul Tayal

If you have worked with data before, you know how painstakingly difficult it can be to fetch and convert raw data into a usable format. As data analysts, we are always looking for ready-to-use datasets that can save us time scraping, cleaning, and standardising the data.

Another challenge is extracting information from data has become a needle in a haystack problem because of the quintillion bytes of data generated every day. The haystack keeps growing, so finding the needles keeps getting fiendishly hard. A fundamental challenge with data-driven decisions is to find those few needles.

Given this backdrop when it comes to traditional datasets, the investing/finance world is also looking at unusual data sources. We call them alternative datasets. Market participants are increasingly using alternative data to gain an edge over their competitors.

This article introduces you to Nasdaq Data Link, a platform with an extensive collection of traditional and alternative data sources.

This article has the following sections:


Quandl was founded in 2011 by Tameer Kalem, a quant who worked in the hedge fund industry for more than a decade. It was created as a “Wikipedia for numerical data” and aimed to extract value from the colossal amount of data available today. In 2018, Nasdaq acquired Quandl to complement its data and analytics business.

In September 2021, Nasdaq launched its new platform Nasdaq data link built using the Quandl infrastructure.

Nasdaq Data Link allows you to access both proprietary data (Nasdaq, Quandl, etc.) and datasets via third parties (ex. Trading Economics, IQ Banker, etc.)


Nasdaq Data Link provides three types of datasets:

  • Core financial data
  • Environmental, Social and Corporate Governance (ESG) data
  • Alternative data

Core financial data

These are the traditional financial datasets used by investors to analyse and predict behaviour in stock prices. They range from bond yields to stock and forex derivatives to oil databases. There are 223 datasets here.

These datasets are categorised across:

  • Asset class
  • Data type
  • Region
  • Publisher

Let’s look a little bit further into these categories. The following table shows the distribution of datasets under “Asset class”:

ASSET CLASSES

FREE

PAID

Equities

7

114

Currencies

3

16

Interest Rates & Fixed Income

5

8

Options

1

9

Indexes

8

11

Mutual Funds & ETFs

1

27

Real Estate

3

2

Venture Capital & Private Equity

0

1

Economy & Society

15

4

Energy

9

4

Agriculture

7

7

Metals

4

8

Futures

5

13

Other

4

14

Total

72

238

The following table shows the distribution of datasets under “Data type.”

DATA TYPES

FREE

PAID

Prices & Volumes

15

87

Estimates

1

15

Fundamentals

6

37

Corporate Actions

0

8

Sentiment

1

7

Derived Metrics

0

16

National Statistics

15

4

Technical Analysis

0

3

Others

5

16

Total

43

193


The following table shows the distribution of datasets under “Region.”

REGION

FREE

PAID

United States

24

116

China

8

29

Europe

13

45

Africa

8

23

North America

24

103

Latin America

10

22

Asia

12

44

Oceania

9

23

Middle East

1

5

Global

11

45

India

8

19

Total 

128

474

For more details about each dataset, you can go here.

ESG Data

This section contains datasets that quantify data such as the impact of companies on the environment, health and society. It provides datasets related to GHG emission, insights on natural disasters, biodiversity reports, gender equality metrics, ESG risk metrics, etc. There are a total of 9 datasets in this section.

Datasets in this section are categorised across:

  • Area of impact
    • Environment
    • Social
    • Corporate Governance
  • Sustainable development goals (SDGs)

For more details about each dataset, you can go here.

Alternative data

This section contains the alternative datasets created using various raw datasets. To give a few examples:

  • A company’s spending and payments,
  • Tracking of corporate air travels that can give insights into M&A deals and expansion plans,
  • Daily data on crop yield forecasts,
  • Using AI on satellite images to generate a real-time global index of metal supply and much more.

Datasets in this section are categorised based on the following:

  • Asset classes
    • Commodities
    • Currencies
    • Equity
    • Fixed Income
    • Real Estate
  • Data origin
    • Business Exhaust
    • Consumer Activity
    • Primary Research
    • Satellites & Sensors
    • Sentiment & Internet
    • Others
  • Industry/Sector
    • Auto
    • B2B
    • Construction
    • Energy
    • Finance
    • Logistics
    • Retail
    • Security
    • Technology
  • Investment style
    • Fundamental
    • Quantitative
    • Technical
    • Others

Here’s a catalogue with details of all the alternative datasets provided: Alternative data catalogue.

However, alternative datasets are only available for institutional clients. If you wish to register as an institutional client to access the data, you can go here.


Even though Quandl is just one of the data providers of Nasdaq data link, you can still fetch all the datasets provided by Nasdaq Data Link using a Quandl API (Application Programming Interface) call. Let’s first understand the term “API call”.

What is an API call?

API defines the rules for communication between two systems. To give an analogy, you cannot just go to a printing facility and print a cheque book of a bank for yourself. There’s a procedure that you have to follow.

You go to the bank website, fill up the form, attach your documents and submit. The system then processes in the background, and when your account is ready, account details and the cheque book is handed over to you.

This is precisely how an API works. The bank is the system that we want to communicate with, and we don’t have access to the system’s internals; we can only talk through the API layer, i.e. the bank website where we fill up the form and submit the documents. This is called an endpoint.

While fetching data, you also need an API key for the system to keep a record of your identity, just as you need your bank account no. for any transaction.

An API call provides the inputs to the system to access the data we need. Each system has a different API, just as each bank’s website has a different web address.

For example:

Example  of an API call: https://newsapi.org/v2/everything?q=tesla&from=2021-07-26&sortBy=publishedAt&apiKey=API_KEY

In the above example,

  • Endpoint  - https://newsapi.org/v2/everything
  • Inputs       - Tesla, start date, i.e. 2021-07-26,
  • Sort by     -  “Published” and,
  • API_KEY - Your API-key generated while creating the account

To search for API endpoints, you can go to Programmable Web, one of the largest API directories available. Also, a detailed description of an API can be found here.

Now that you have understood how an API call works, let’s see how we can access data from Quandl API using python.

How to get a free Quandl API key?

The first step to fetch data using Quandl API is to generate a free API key by creating an account on Nasdaq Data Link. You can find your API key in the account settings section once the account has been successfully created.

Here’s what the account settings section looks like:

generating a free API key by creating an account on Nasdaq Data Link
Generating a free API key by creating an account on Nasdaq Data Link

How to install the Quandl package in Python?

Use this code to install the Quandl package in Python:

## Install the quandl library
!pip install quandl

How to access various types of datasets using Quandl API in Python?

To access various types of datasets using Quandl API in Python, use this code:

## Importing library
import quandl

Historical stock price data

# Configuring API key
# We use the get() function to fetch the historical stock price data for Tesla
quandl.ApiConfig.api_key = (YOUR-API-KEY-HERE)
tsla = quandl.get('WIKI/TSLA', start_date = "2010-06-29", end_date = "2018-03-27")

A dataframe is returned as output and stored in the variable “tsla”. You can use any ticker symbol instead of ‘TSLA’ to get data for any other stock.

Here’s what the output looks like:

output for tsla stock
Output for TSLA stock

Let’s plot a time series graph to see how price has changed over time.

## Plotting the close price of Tesla
fig = tsla['Close'].plot(grid=True, figsize=(15,8))
fig.set_xlabel("")
fig.set_ylabel("Price", size=18)

Here’s what the output looks like:

graph for the close price of tesla
graph for the close price of Tesla

We can collapse the data into weekly, monthly, quarterly, etc., using the collapse parameter.

Tsla_monthly = quandl.get('WIKI/TSLA', start_date = "2010-01-01", end_date = "2021-08-01", collapse = “monthly”)

Data from London Bullion Market Association

London Bullion Market Association is an international trade association for gold and silver markets. This is a free dataset.

Here’s how we can access the dataset:

## Getting the silver data from LBMA
quandl.get('LBMA/SILVER', start_date='2011-09-06', end_date='2021-09-08')

Here’s what the output looks like:

data output for silver markets from london bullion market association
Data output for Silver markets from London Bullion Market Association

Core US Fundamental Data - Sample of a premium subscription dataset

Here’s how you can get the data for Tesla (for example)

## Getting fundamental data for Tesla
quandl.get_table('SHARADAR/DAILY', ticker='TSLA')

Here’s what the output looks like:

fundamental data for Tesla stock
Fundamental data for Tesla stock

Steps to get access to any dataset through Quandl API in Python

These steps will guide you about getting access to any dataset through Quandl API in Python.

Step 1 - Go to the Nasdaq Data Link catalogue here.

Step 2 - Select any dataset you find interesting and read the description.

Step 3 - Go to the “Usage” section and select python.

Step 4 - You’ll be presented with the command to download the data using Quandl API in Python.

Once this is done, you have the dataset at your disposal.


Quandl provides a large variety of free datasets. However, it also has datasets that come under a paid subscription.

The following are the details:

  • Nasdaq Data Link provides over 250+ datasets, out of which 40 have free access.
  • Most premium datasets provide free samples as well.

Users with a free subscription have a limit of 300 calls per 10 seconds, 2,000 calls per 10 minutes and a limit of 50,000 calls per day.

  • Users with a premium subscription have a limit of 5,000 calls per 10 minutes and a limit of 720,000 calls per day.
  • Other free and premium subscription features include full API access, downloads in multiple formats, export and visualisation options, and more.

Suggested reads


Bibliography


Conclusion

This article introduced you to a newly launched platform (Nasdaq Data Link) that provides access to ready-to-use traditional and alternative datasets and demonstrated the process of fetching datasets from various publishers (on Nasdaq Data Link) using Quandl API in python.

We looked at various types of datasets offered by Nasdaq Data Link and their accessibility based on subscription.

Getting access to clean data is crucial for building and backtesting trading strategies, and Nasdaq Data Link with Quandl API will help you in this journey. If you wish to learn more about building trading strategies, check out the Quantitative Trading Strategies and Models course on Quantra.


Disclaimer: All data and information provided in this article are for informational purposes only. QuantInsti® makes no representations as to accuracy, completeness, currentness, suitability, or validity of any information in this article and will not be liable for any errors, omissions, or delays in this information or any losses, injuries, or damages arising from its display or use. All information is provided on an as-is basis.

Algo & Quant Trading Webinar