quandl_datatable: Retrieve data from a Quandl Tables API Endpoint

Description Usage Arguments Details Value Batching References Examples

Description

This is a replacement for Quandl::Quandl.datatable which allows for multiple attempts, batches long parameters into multiple requests, always fetches all results, and always returns a tibble.

Usage

1
quandl_datatable(code, ..., .batch = 50L)

Arguments

code

<character(1)> datatable code on Quandl

...

filters and options to pass as parameters

.batch

<integer(1)> maximum number of elements of any parameter in a single request; see Batching below

Details

Results are requested in CSV form and converted to a tibble via readr::read_csv().

Value

<tbl_df> Results from Quandl in tibble form.

Batching

The Quandl API can only support a limited number of parameters in one call. If we want to filter on e.g. 1000 tickers, that requires multiple requests to complete. This wrapper will handle this for you, automatically making multiple requests to fetch the desired output. Currently, only one ... input can be longer than .batch, so you can't filter on e.g. both 1000 tickers and 1000 dates.

References

API Documentation

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
quandl_key_set()

# get one day of prices on Apple from Wiki Prices
quandl_datatable("WIKI/PRICES", ticker = "AAPL", date = "2018-01-02")

# get one month of prices from two tickers
quandl_datatable(
  "WIKI/PRICES",
  ticker = c("AAPL", "MSFT"),
  date.gte = "2018-01-01",
  date.lt = "2018-02-01"
)

# only return some columns
quandl_datatable(
  "WIKI/PRICES",
  ticker = "AAPL",
  date = "2018-01-02",
  qopts.columns = c("date", "ticker", "close")
)

ClaytonJY/tidyquandl documentation built on May 3, 2019, 4:02 p.m.