From 07341038b38ac0faf130cfc140c2cf6e35315232 Mon Sep 17 00:00:00 2001 From: David Date: Thu, 17 Dec 2020 16:36:35 +0100 Subject: [PATCH] rename download_locate_code to download_stock_directory --- NAMESPACE | 2 +- R/{locate_code.R => download_stock_directory.R} | 12 ++++++------ R/read_functions.R | 2 +- ...ocate_code.Rd => download_stock_directory.Rd} | 16 ++++++++-------- man/read_functions.Rd | 2 +- 5 files changed, 17 insertions(+), 17 deletions(-) rename R/{locate_code.R => download_stock_directory.R} (75%) rename man/{download_locate_code.Rd => download_stock_directory.Rd} (50%) diff --git a/NAMESPACE b/NAMESPACE index cd0bf23..9714c46 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -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) diff --git a/R/locate_code.R b/R/download_stock_directory.R similarity index 75% rename from R/locate_code.R rename to R/download_stock_directory.R index a04388d..399229c 100644 --- a/R/locate_code.R +++ b/R/download_stock_directory.R @@ -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/} @@ -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"))) @@ -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) diff --git a/R/read_functions.R b/R/read_functions.R index 0eca1da..6e0dac9 100644 --- a/R/read_functions.R +++ b/R/read_functions.R @@ -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 diff --git a/man/download_locate_code.Rd b/man/download_stock_directory.Rd similarity index 50% rename from man/download_locate_code.Rd rename to man/download_stock_directory.Rd index 39fee73..bd373cb 100644 --- a/man/download_locate_code.Rd +++ b/man/download_stock_directory.Rd @@ -1,10 +1,10 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/locate_code.R -\name{download_locate_code} -\alias{download_locate_code} -\title{Downloads the locate code for a given date and exchange} +% Please edit documentation in R/download_stock_directory.R +\name{download_stock_directory} +\alias{download_stock_directory} +\title{Downloads the stock directory (stock locate codes) for a given date and exchange} \usage{ -download_locate_code(exchange, date, quiet = FALSE) +download_stock_directory(exchange, date, quiet = FALSE) } \arguments{ \item{exchange}{The exchange, either NASDAQ (equivalent to NDQ), BX, or PSX} @@ -14,7 +14,7 @@ download_locate_code(exchange, date, quiet = FALSE) \item{quiet}{If the download function should be quiet, default is FALSE.} } \value{ -a data.table of the tickers, the respective locate codes, and the exchange/date information +a data.table of the tickers, the respective stock locate codes, and the exchange/date information } \description{ The data is downloaded from NASDAQs FTP server, which can be found here @@ -22,7 +22,7 @@ The data is downloaded from NASDAQs FTP server, which can be found here } \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")) } } diff --git a/man/read_functions.Rd b/man/read_functions.Rd index 4ed2604..e52d4a3 100644 --- a/man/read_functions.Rd +++ b/man/read_functions.Rd @@ -106,7 +106,7 @@ else an error is thrown.} \item{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}}.} \item{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}