Skip to content

Commit

Permalink
rename download_locate_code to download_stock_directory
Browse files Browse the repository at this point in the history
  • Loading branch information
DavZim committed Dec 17, 2020
1 parent eae9d2c commit 0734103
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ export(count_stock_directory)
export(count_system_events)
export(count_trades)
export(count_trading_status)
export(download_locate_code)
export(download_sample_file)
export(download_stock_directory)
export(get_date_from_filename)
export(get_exchange_from_filename)
export(get_meta_data)
Expand Down
12 changes: 6 additions & 6 deletions R/locate_code.R → R/download_stock_directory.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' Downloads the locate code for a given date and exchange
#' Downloads the stock directory (stock locate codes) for a given date and exchange
#'
#' The data is downloaded from NASDAQs FTP server, which can be found here
#' \url{ftp://emi.nasdaq.com/ITCH/Stock_Locate_Codes/}
Expand All @@ -7,15 +7,15 @@
#' @param date The date, should be of class Date. If not the value is converted using \code{as.Date}.
#' @param quiet If the download function should be quiet, default is FALSE.
#'
#' @return a data.table of the tickers, the respective locate codes, and the exchange/date information
#' @return a data.table of the tickers, the respective stock locate codes, and the exchange/date information
#' @export
#'
#' @examples
#' \dontrun{
#' download_locate_code("BX", "2019-07-02")
#' download_locate_code(c("BX", "NDQ"), c("2019-07-02", "2019-07-03"))
#' download_stock_directory("BX", "2019-07-02")
#' download_stock_directory(c("BX", "NDQ"), c("2019-07-02", "2019-07-03"))
#' }
download_locate_code <- function(exchange, date, quiet = FALSE) {
download_stock_directory <- function(exchange, date, quiet = FALSE) {

exchange <- ifelse(tolower(exchange) == "nasdaq", "ndq", tolower(exchange))
if (!all(exchange %in% c("ndq", "bx", "psx")))
Expand All @@ -29,7 +29,7 @@ download_locate_code <- function(exchange, date, quiet = FALSE) {
if (length(exchange) > 1 || length(date) > 1) {
vals <- expand.grid(ex = exchange, d = date, stringsAsFactors = FALSE)

res <- lapply(1:nrow(vals), function(i) download_locate_code(vals$ex[i],
res <- lapply(1:nrow(vals), function(i) download_stock_directory(vals$ex[i],
vals$d[i]))
d <- data.table::rbindlist(res)

Expand Down
2 changes: 1 addition & 1 deletion R/read_functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
#' @param stock_directory A data.frame containing the stock-locate_code relationship.
#' As outputted by \code{\link{read_stock_directory}}.
#' Only used if \code{filter_stock} is set. To download the stock directory from
#' NASDAQs FTP server, use \code{\link{download_locate_code}}.
#' NASDAQs FTP server, use \code{\link{download_stock_directory}}.
#' @param buffer_size the size of the buffer in bytes, defaults to 1e8 (100 MB),
#' if you have a large amount of RAM, 1e9 (1GB) might be faster
#' @param quiet if TRUE, the status messages are suppressed, defaults to FALSE
Expand Down
16 changes: 8 additions & 8 deletions man/download_locate_code.Rd → man/download_stock_directory.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/read_functions.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 0734103

Please sign in to comment.