get_trades {cryptowatchR} | R Documentation |
Get trades of cryptocurrencies
Description
Get data.frame with trades of cryptocurrencies using the REST API of cryptowat.ch. The route is trades and returns trades for a specified market. See https://docs.cryptowat.ch/rest-api/markets/trades for further information.
Usage
get_trades(pair, since = NULL, limit = NULL, exchange = "kraken",
datetime = TRUE, api_key = NULL, allowance = FALSE)
Arguments
pair |
A character string containing a pair symbol, e.g. btcusd (required argument). Run |
since |
An integer if datetime is |
limit |
An integer: Limit the number of trades (optional). Max: 1000. |
exchange |
A character string containing the exchange. Default is kraken. Run |
datetime |
A logical. |
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 data.frame containing trades of a given pair of currencies. If allowance is TRUE
, get_trades()
returns a list.
References
See https://docs.cryptowat.ch/rest-api for further information.
See Also
get_markets
, get_assets
, get_exchanges
, get_pairs
Examples
## Not run:
# Most recent trades (default is 50)
trades <- get_trades(pair)
# 200 trades (maximum is 1000) since 1589571417 (unix timestamp)
trades.unix <- get_trades(pair, since = 1589571417, limit = 200, datetime = FALSE)
# 1000 trades and datetime is TRUE
trades.datetime <- get_trades(pair, since = "2021-06-01", limit = 1000)
## End(Not run)