Has worked previously. Disabled firewall without success. I am not using manually defined proxy server for internet.
library(TTR)
stockSymbols()
Fetching NASDAQ symbols...
Error in curl::curl_download(nasdaq.url, destfile = tmp) :
Timeout was reached: [] Connection timed out after 10000 milliseconds
> sessionInfo()
R version 4.0.5 (2021-03-31)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 8.1 x64 (build 9600)
Matrix products: default
locale:
[1] LC_COLLATE=English_United Kingdom.1252
[2] LC_CTYPE=English_United Kingdom.1252
[3] LC_MONETARY=English_United Kingdom.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United Kingdom.1252
system code page: 1257
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] httr_1.4.2 TTR_0.24.2
loaded via a namespace (and not attached):
[1] zoo_1.8-9 compiler_4.0.5 R6_2.5.0 cli_2.4.0
[5] tools_4.0.5 withr_2.4.2 glue_1.4.2 xts_0.12.1
[9] curl_4.3 grid_4.0.5 lattice_0.20-41 sessioninfo_1.1.1
> stockSymbols
function (exchange = c("AMEX", "NASDAQ", "NYSE",
"ARCA", "BATS", "IEX"), sort.by = c("Exchange",
"Symbol"), quiet = FALSE)
{
symbols.colnames <- c("Symbol", "Name", "LastSale",
"MarketCap", "IPOyear", "Sector", "Industry",
"Exchange", "Test.Issue", "Round.Lot.Size",
"ETF", "Market.Category", "Financial.Status",
"Next.Shares", "ACT.Symbol", "CQS.Symbol")
exchange <- match.arg(exchange, several.ok = TRUE)
sort.by <- match.arg(sort.by, symbols.colnames, several.ok = TRUE)
nasdaq.colnames <- c("Symbol", "Security.Name",
"Market.Category", "Test.Issue", "Financial.Status",
"Round.Lot.Size", "ETF", "NextShares")
.market.category <- c(Q = "NASDAQ Global Select MarketSM",
G = "NASDAQ Global MarketSM", S = "NASDAQ Capital Market")
other.colnames <- c("ACT.Symbol", "Security.Name",
"Exchange", "CQS.Symbol", "ETF", "Round.Lot.Size",
"Test.Issue", "NASDAQ.Symbol")
.exchange <- c(A = "AMEX", N = "NYSE", P = "ARCA",
Z = "BATS", V = "IEX")
.financial.status <- c(D = "Deficient", E = "Delinquent",
Q = "Bankrupt", N = "Normal (Default)", G = "Deficient and Bankrupt",
H = "Deficient and Delinquent", J = "Delinquent and Bankrupt",
K = "Deficient, Delinquent, and Bankrupt")
tmp <- tempfile()
base.url <- "ftp://ftp.nasdaqtrader.com/SymbolDirectory/"
nasdaq.url <- paste0(base.url, "nasdaqlisted.txt")
other.url <- paste0(base.url, "otherlisted.txt")
nasdaq <- NULL
if ("NASDAQ" %in% exchange) {
if (!quiet) {
message("Fetching NASDAQ symbols...")
flush.console()
}
curl::curl_download(nasdaq.url, destfile = tmp)
nasdaq <- read.table(tmp, header = TRUE, sep = "|",
quote = "", fill = TRUE)
nasdaq$Name <- nasdaq$Security.Name
nasdaq$Exchange <- "NASDAQ"
nasdaq[, setdiff(symbols.colnames, colnames(nasdaq))] <- NA
nasdaq <- nasdaq[, symbols.colnames]
nasdaq$Market.Category <- .market.category[nasdaq$Market.Category]
nasdaq$Financial.Status <- .financial.status[nasdaq$Financial.Status]
}
other <- NULL
if (length(exchange) > 1L) {
if (!quiet) {
message("Fetching non-NASDAQ symbols...")
flush.console()
}
curl::curl_download(other.url, destfile = tmp)
other <- read.table(tmp, header = TRUE, sep = "|",
quote = "", fill = TRUE)
other <- other[-nrow(other), ]
other$Name <- other$Security.Name
other$Symbol <- other$NASDAQ.Symbol
other[, setdiff(symbols.colnames, colnames(other))] <- NA
other$Exchange <- .exchange[other$Exchange]
other <- other[, symbols.colnames]
}
symbols <- rbind(nasdaq, other)
symbols$NASDAQ.Symbol <- symbols$Symbol
symbols$Symbol <- sub("-(.?)$", "-P\\1", symbols$Symbol)
symbols$Symbol <- sub("\\.(.?)$", "-\\1", symbols$Symbol)
symbols$Symbol <- sub("\\+(.?)$", "-WT\\1", symbols$Symbol)
symbols$Symbol <- sub("\\=$", "-UN", symbols$Symbol)
symbols$Symbol <- sub("\\^$", "-R", symbols$Symbol)
symbols$ETF <- ("Y" == symbols$ETF)
symbols$Test.Issue <- ("Y" == symbols$Test.Issue)
symbols <- symbols[do.call("order", symbols[, sort.by]),
]
rownames(symbols) <- NULL
return(symbols)
}
<bytecode: 0x09d4cbf8>
<environment: namespace:TTR>
>