0

I want to convert a call from IEX to a data table in R:

https://api.iextrading.com/1.0/ref-data/symbols

Thanks,

Mehdi Zare
  • 1,221
  • 1
  • 16
  • 32

1 Answers1

0

You can use fromJSON of rjson package then transform list to data.frame. Please see the code below:

library(rjson)
f <- (fromJSON(file = "https://api.iextrading.com/1.0/ref-data/symbols"))
df <- data.frame(t(sapply(f, unlist)), stringsAsFactors = FALSE)
str(df)

Output:

'data.frame':   8691 obs. of  6 variables:
 $ symbol   : chr  "A" "AA" "AAAU" "AABA" ...
 $ name     : chr  "Agilent Technologies Inc." "Alcoa Corporation" "Perth Mint Physical Gold" "Altaba Inc." ...
 $ date     : chr  "2018-09-19" "2018-09-19" "2018-09-19" "2018-09-19" ...
 $ isEnabled: chr  "TRUE" "TRUE" "TRUE" "TRUE" ...
 $ type     : chr  "cs" "cs" "N/A" "cs" ...
 $ iexId    : chr  "2" "12042" "14924" "7653" ...
Artem
  • 3,304
  • 3
  • 18
  • 41