q_price_single <- function(ticker,
start_date = NULL,
end_date = NULL,
frequency = NULL){
if(is.null(start_date)){
start_date = "2000-12-31"
}
dat <- q_construct_url(ticker = ticker,
start_date = start_date,
end_date = end_date,
frequency = frequency) %>%
jsonlite::fromJSON() %>%
as_tibble() %>%
mutate(date = as.Date(date),
q_ticker = ticker) %>%
mutate_at(c("close",
"high",
"low",
"open",
"volume",
"adjClose",
"adjHigh",
"adjLow",
"adjOpen",
"adjVolume",
"divCash","splitFactor"),
as.double) %>%
mutate_at(c("close",
"high",
"low",
"open",
"volume",
"adjClose",
"adjHigh",
"adjLow",
"adjOpen",
"adjVolume",
"divCash","splitFactor"),
round,digits = 2) %>%
dplyr::select(q_ticker,everything()) %>%
dplyr::filter(date <= Sys.Date())
dat
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.