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

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

Value

<tbl_df> Results from Quandl in tibble form.

Details

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

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

quandl_key_set() # get one day of prices on Apple from Wiki Prices quandl_datatable("WIKI/PRICES", ticker = "AAPL", date = "2018-01-02")
#> # A tibble: 1 x 14 #> ticker date open high low close volume `ex-dividend` split_ratio #> <chr> <date> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 AAPL 2018-01-02 170. 172. 169. 172. 25048048 0 1 #> # ... with 5 more variables: adj_open <dbl>, adj_high <dbl>, adj_low <dbl>, #> # adj_close <dbl>, adj_volume <dbl>
# 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" )
#> # A tibble: 42 x 14 #> ticker date open high low close volume `ex-dividend` split_ratio #> <chr> <date> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 AAPL 2018-01-02 170. 172. 169. 172. 25048048 0 1 #> 2 AAPL 2018-01-03 173. 175. 172. 172. 28819653 0 1 #> 3 AAPL 2018-01-04 173. 173. 172. 173. 22211345 0 1 #> 4 AAPL 2018-01-05 173. 175. 173. 175 23016177 0 1 #> 5 AAPL 2018-01-08 174. 176. 174. 174. 20134092 0 1 #> 6 AAPL 2018-01-09 175. 175. 173. 174. 21262614 0 1 #> 7 AAPL 2018-01-10 173. 174. 173 174. 23589129 0 1 #> 8 AAPL 2018-01-11 175. 175. 174. 175. 17523256 0 1 #> 9 AAPL 2018-01-12 176. 177. 176. 177. 25039531 0 1 #> 10 AAPL 2018-01-16 178. 179. 176. 176. 29159005 0 1 #> # ... with 32 more rows, and 5 more variables: adj_open <dbl>, adj_high <dbl>, #> # adj_low <dbl>, adj_close <dbl>, adj_volume <dbl>
# only return some columns quandl_datatable( "WIKI/PRICES", ticker = "AAPL", date = "2018-01-02", qopts.columns = c("date", "ticker", "close") )
#> # A tibble: 1 x 3 #> date ticker close #> <date> <chr> <dbl> #> 1 2018-01-02 AAPL 172.