Learn R Programming

cryptowatchR (version 0.1.0)

markets: Get prices for cryptocurrencies

Description

Get data.frame with prices for cryptocurrencies using the REST API of cryptowat.ch.

Usage

markets(pair, params = NULL, exchange = "kraken", route = "ohlc", datetime = TRUE)

Arguments

pair

A string containing a pair symbol, e.g. btcusd (required argument).

params

A list containing before, after and periods (optional). See https://docs.cryptowat.ch/rest-api/markets/ohlc for further information.

exchange

A string containing the exchange. Default is kraken.

route

A string containing market prices. Possible values: price, trades, summary, orderbook, ohlc. Default is ohlc.

datetime

A logical. TRUE indicates that datetime type is used. FALSE indicates unix timestamp. Default is TRUE.

Value

df.data A data.frame containing price data for a given pair of currencies.

References

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

See Also

get_markets, get_assets, get_exchanges, get_pairs

Examples

Run this code
# NOT RUN {
df.btcusd.data <- markets("btcusd")
df.btcusd.data2 <- markets("btcusd", list(periods = 3600, before = 1609851600,
                                          after = 1609506000), datetime = FALSE)
df.btceur.data3 <- markets("btceur", list(periods = 86400, before = "2021-05-12",
                                          after = "2021-01-01"), datetime = TRUE)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab