R/kosp_stock.R

#' Get price history of KOSPI stock
#'
#' \code{kosp_stock} returns price history of a given KOSPI stock from Google finance
#'
#' @param ticker a ticker code in the format as KRX:000000
#' @param start_date should be given as a format "2011-01-01"
#' @param end_date should be given as a format "2012-01-01"
#'
#' @return a df in the format as OHLC
#' @export
#'
#' @examples
#' kosp_stock("011000", "2011-01-01")
kosp_stock <- (function(ticker, from) {
  df <- ticker %>% paste("KRX:", ., sep = "") %>% quantmod::getSymbols(from = from, src = "google", auto.assign = FALSE)
  df
})
skylics/stock_analysis documentation built on May 29, 2019, 12:41 p.m.