INSTALLATION & AUTHENTICATION

INSTALLATION

You can download the NasdaqDataLink R package from CRANor from GitHub. Follow the installation instructions below.

A package is a collection of functions, data and documentation that extends R's basic functionality.

To install and load the NasdaqDataLink R package from CRAN:

install.packages("NasdaqDataLink")
library(NasdaqDataLink)

To install the NasdaqDataLink R package from GitHub using devtools:

install.packages("devtools")
library(devtools)
install_github("nasdaq/data-link-r")
library(NasdaqDataLink)

AUTHENTICATION

The NasdaqDataLink R package is free. If you would like to make more than 50 calls a day, however, you will need to create a free account and set your API key.

Similarly, you must set your API key to download the premium datasets to which you are subscribed.

To make full use of the package, set your API key as follows:

  1. Create or sign into your account here.
  2. Input your API key (with quotation marks) into the console: NasdaqDataLink.api_key("YOURAPIKEY").

Formats and types

Return types

The supported return types for the NasdaqDataLink() function are:

  • raw (which returns a dataframe)
  • ts
  • zoo
  • xts

To request a specific type, assign the type argument and the return type.

For example: data <- NasdaqDataLink('NSE/OIL', type = "xts")

Date formats

For example: data <- NasdaqDataLink('NSE/OIL', collapse = "quarterly", type = "zoo", limit = 3)

data will have indexes 2016 Q32016 Q4, and 2017 Q1:

OpenHighLow
2016 Q3459.8462.8452.45
2016 Q4448.0451.7445.10
2017 Q1456.0465.0454.15

NOTE: For conciseness, only three data columns appear in the above example response.