get_current_price: Get current price of cryptocurrencies

View source: R/get_current_price.R

get_current_priceR Documentation

Get current price of cryptocurrencies

Description

Get current price of cryptocurrencies using the REST API of cryptowat.ch. The route is price or prices and returns the current price of a given pair or current prices of all pairs. See https://docs.cryptowat.ch/rest-api/markets/price for further information.

Usage

get_current_price(pair, exchange = "kraken", api_key = NULL,
                         allowance = FALSE)

Arguments

pair

A string containing a pair symbol, e.g. btcusd (required argument). Run get_pairs() to find other available pairs.

exchange

A string containing the exchange. Default is kraken. Run get_exchanges() to find other available exchanges.

api_key

A string containing the API key. See https://docs.cryptowat.ch/rest-api/rate-limit to learn how to create an account and how to generate an API key.

allowance

A logical (default is FALSE). If TRUE the function returns a list which includes allowance information, i.e. cost of the request, remaining credits and your account name.

Value

Current price of a given pair of currencies. If allowance is TRUE, get_current_price() returns a list.

References

See https://docs.cryptowat.ch/rest-api for further information.

See Also

get_markets, get_ohlc, get_exchanges, get_pairs

Examples

## Not run: 
# Daily prices of Bitcoin in USD
current_price <- get_current_price("btcusd")
current_prices <- get_current_price()

## End(Not run)

lorenzbr/cryptowatchR documentation built on April 15, 2022, 4:41 a.m.