cc_symbol_price: Symbols Price

View source: R/cc_symbol_price.R

cc_symbol_priceR Documentation

Symbols Price

Description

Get the current price of any cryptocurrency in any other currency that you need.

Usage

cc_symbol_price(symbol = NULL, 
                exchange = NULL, 
                currency = "USD", 
                api_key = NULL)

Arguments

symbol

Character vector. The cryptocurrency symbol of interest, e.g. "BTC", "ETH", "BNB". Default is NULL.

currency

Character vector. Currency symbols to convert into, e.g. "USD", "USDT", "BNB", "EUR". If NULL, the default, will be used "USD".

exchange

Character vector. The exchange to obtain data from. If NULL, the default, will be returned a global mean between all the exchanges.

api_key

character

quiet

Logical. Default is FALSE. If TRUE suppress messages and warnings.

Details

If the crypto does not trade directly into the symbol requested, BTC will be used for conversion. If the opposite pair trades we invert it, e.g. BTC-XMR.

Value

Return a tibble. The number of columns will depends on the lenght of currency parameter. There are 3 columns always present:

  • date: POSIXt, time of the snapshot.

  • exchange: Character, reference exchange. If exchange is NULL will be classified as Global.

  • symbol: Character, tcryptocurrency symbol of interest.

Examples

# Mean price for BTCUSD between all the exchanges
cc_symbol_price(symbol = "BTC", exchange = NULL, currency = "USD")

# Mean price for BTCUSD and ETHUSD between all the exchanges
cc_symbol_price(symbol = c("BTC", "ETH"), exchange = NULL, currency = "USD")

# Mean price for BTCUSDT, ETHUSDT on Binance
cc_symbol_price(symbol = c("BTC", "ETH"),
                exchange = "Binance",
                currency = c("USDT"))
                

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