R – Scrape List Of ETF’s From Nasdaq.Com

Using the package data.table and the function fread() we can read a .csv file that is hosted on the internet without downloading it to our hard drive.

# Obtain List of ETFS From nasdaq.com
# Andrew Bannerman 10.4.2017


# Read ETF list csv file from nasdaq.com
# Use fread() from data.table package 
# install.packages("data.table")
read.data <- fread("http://www.nasdaq.com/investing/etfs/etf-finder-results.aspx?download=Yes")

# Subset Column 1, Symbol Column
symbol.col <- read.data$Symbol

# Export symbol column as .txt file 
write.table(symbol.col,"C:/R Projects/Data/etf_list_nasdaq_dot_com/etf.list.txt",append=TRUE,quote=FALSE,row.names=FALSE,col.names=FALSE)

# Count ETF tickers 

As of date 10.4.2017 there is a total of 1726 ETF’s listed on nasdaq.com.