joshuaulrich / TTR

Technical analysis and other functions to construct technical trading rules with R
GNU General Public License v2.0
326 stars 102 forks source link

stockSymbols points to broken link #83

Closed Javdat closed 4 years ago

Javdat commented 4 years ago

After nasdaq website re-design stockSymbols() is broken. It points to https://www.nasdaq.com/screening/companies-by-name.aspx?letter=0&exchange=NASDAQ&render=download which doesn't exist anymore.

New screener seems to be located at: https://www.nasdaq.com/market-activity/stocks/screener

But it doesn't seem to have screening by exchanges.

> library(TTR)
> stockSymbols("NASDAQ")
Fetching NASDAQ symbols...
Error in file(file, "rt") : 
  cannot open the connection to 'http://www.nasdaq.com/screening/companies-by-name.aspx?letter=0&exchange=NASDAQ&render=download'
In addition: Warning message:
In file(file, "rt") :
  cannot open URL 'https://www.nasdaq.com/screening/companies-by-name.aspx?letter=0&exchange=NASDAQ&render=download': HTTP status was '404 Not Found'
joshuaulrich commented 4 years ago

Thanks for the report! I will look into the best way to fix this.

dcmg21 commented 4 years ago

I can't download all symbols anymore. I get the error Error in names(x) <- value : 'names' attribute [8] must be the same length as the vector [1]. Is this all related? When will it be fixed?

joshuaulrich commented 4 years ago

@dcmg21 Yes, that's related to this issue. It's fixed now and will be on CRAN soon.

joshuaulrich commented 4 years ago

@Javdat thanks again for this report! A patched version is on CRAN now. Windows binaries should be available in a few days.

ishonest commented 3 years ago

Hi Joshua, I'm getting NA fields

> packageVersion("TTR")
[1] ‘0.24.2’
> x <- TTR::stockSymbols()
Fetching NASDAQ symbols...
Fetching non-NASDAQ symbols...
> table(x$Sector)
< table of extent 0 >
joshuaulrich commented 3 years ago

@qedtec that's expected. See the commit message:

Use NASDAQ FTP to get stock symbols

Users have been getting timeout issues and errors using the URL: https://old.nasdaq.com/screening/companies-by-name.aspx

Switch to the FTP URL: ftp://ftp.nasdaqtrader.com/SymbolDirectory/.

Keep the column names from the old data set, but set all the values to NA. Also keep the columns in the same order, and append the new columns to the end of the output.

Several of the columns from the original data set are no longer available in the FTP file. I will add a note to the documentation to communicate this better to users.

joshuaulrich commented 3 years ago

@qedtec I added a note in https://github.com/joshuaulrich/TTR/commit/4ca5567499897462c5c49cee8249a908903491a1. It will be in the next release.