#' @title Bid-Ask Price
#' @description Get bid-ask prices
#'
#' @param symbol Stock ticker
#'
#' @importFrom purrr set_names
#' @importFrom dplyr mutate select everything
#'
#' @return
#' @export
#'
#' @examples
#' bid_ask('NVDA')
bid_ask <- function(symbol, ...){
url <- finnhub_endpoint('bid_ask')
df <- retry_get(url,
query = list(token = finnhub_key(),
symbol = symbol))
df %>%
bind_rows %>%
dplyr::mutate(t = as.character(t),
symbol = symbol) %>%
purrr::set_names(c('ask_price', 'ask_volume', 'bid_price', 'bid_volume',
'unixtime', 'symbol')) %>%
dplyr::select(symbol, unixtime, dplyr::everything())
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.