cc_price_historical: cc_price_historical

View source: R/cc_price_historical.R

cc_price_historicalR Documentation

cc_price_historical

Description

Get the Open, High, Low, Close, Volume, Open-Close change (OC) and High-Low change (HL) for the specified symbol.

Usage

cc_price_historical(
  symbol,
  start = NULL,
  end = NULL,
  exchange = NULL,
  currency = "USD",
  interval = c("daily", "hourly", "minutely"),
  api_key = NULL,
  verbose = TRUE
)

Arguments

symbol

A string or character vector containing the symbols of interest. (e.g. "BTC", "ETH", "BNB",...)

start

A Date or character vector containing the start date for importation.

end

A Date or character vector containing the end date for importation.

exchange

A string or character vector containing the exchange to use, if NULL it will be returned a mean between all the exchanges and denoted with "global".

currency

A string or character vector containing the currency in which convert the output (e.g. "USD", "USDT", "BNB", "EUR",...).

interval

A string or character vector containing the frequency of the data, it can be "daily", "hourly" or "minutely". The access to minutely data is restricted to the last 7 days, even with the free api key.

api_key

character containing your api key.

verbose

logical

Value

tibble, with 12 columns (Date, Symbol, Currency, Exchange, High, Low, Open, Volume, Close, Adj, OC, HL)

Examples

# Daily Data from General Exchange for the Pair BTC-USD
cc_price_historical(symbol = "BTC", start = "2022-01-01", end = "2023-01-01",
                    exchange = NULL, currency = "USD", interval = "daily")

# Hourly Data from General Exchange for the Pair BTC-USD
cc_price_historical(symbol = "BTC", start = "2022-01-01 00:00:00", end = "2023-01-01 00:00:00",
                    exchange = NULL, currency = "USD", interval = "hourly")

# Daily Data from Binance Exchange for the Pair BTC-BUSD
cc_price_historical(symbol = "BTC", start = "2022-01-01", end = "2023-01-01",
                    exchange = "Binance", currency = "BUSD", interval = "daily")

# Daily Data from Kucoin Exchange for the Pair BTC-USDT
cc_price_historical(symbol = "BTC", start = "2022-01-01", end = "2023-01-01",
                    exchange = "Kucoin", currency = "USDT", interval = "daily")

beniamino98/cryptocompareR documentation built on June 19, 2024, 12:37 a.m.