get_markets {cryptowatchR} | R Documentation |
Get prices of cryptocurrencies
Description
Get prices of cryptocurrencies using the REST API of cryptowat.ch.
Usage
get_markets(route, pair = NULL, exchange = NULL, params = NULL,
api_key = NULL, allowance = FALSE)
Arguments
route |
A character string containing a market endpoint. Possible values: price, prices, trades, summary, summaries, orderbook, orderbook/liquidity, orderbooks/calculator, ohlc (required argument). See https://docs.cryptowat.ch/rest-api/markets for further information. |
pair |
A character string containing a pair symbol, e.g. btcusd (optional argument). Run |
exchange |
A character string containing the exchange (optional argument). Run |
params |
A list containing query parameters. E.g., for the route ohlc, this is |
api_key |
A character 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 |
Value
A list containing markets data.
References
See https://docs.cryptowat.ch/rest-api for further information
See Also
markets
, get_assets
, get_exchanges
, get_pairs
Examples
## Not run:
# Prices of Bitcoin in USD for all periods
btcusd.ohlc.all <- get_markets(route = "ohlc", pair = "btcusd", exchange = "kraken")
# Hourly prices of Bitcoin in USD for a specific time period
btcusd.ohlc.hourly <- get_markets(route = "ohlc", pair = "btcusd", exchange = "kraken",
list(periods = 3600, before = 1609851600, after = 1609506000))
## End(Not run)