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 should use https #62

Closed Javdat closed 5 years ago

Javdat commented 6 years ago

Currently:

url <- paste("http://www.nasdaq.com/screening/companies-by-name.aspx", 
            "?letter=0&exchange=", i, "&render=download", sep = "")

This URL gets redirected to https version. For R-3.3.3 or higher with libcurl capabilities this will work with a warning:

>stockSymbols()
Warning messages:
1: In file(file, "rt") :
  "internal" method cannot handle https redirection to: 'https://www.nasdaq.com/screening/companies-by-name.aspx?letter=0&exchange=AMEX&render=download'
2: In file(file, "rt") : "internal" method failed, so trying "libcurl"

For lower R versions this will fail.

Simple fix to https:

url <- paste("https://www.nasdaq.com/screening/companies-by-name.aspx", 
            "?letter=0&exchange=", i, "&render=download", sep = "")