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:
- Create or sign into your account here.
- 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:
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 Q3
, 2016 Q4
, and 2017 Q1
:
Open | High | Low | |
---|---|---|---|
2016 Q3 | 459.8 | 462.8 | 452.45 |
2016 Q4 | 448.0 | 451.7 | 445.10 |
2017 Q1 | 456.0 | 465.0 | 454.15 |
NOTE: For conciseness, only three data columns appear in the above example response.
Updated 7 months ago