Learn R Programming

cryptowatchR (version 0.2.0)

markets: Get prices of cryptocurrencies

Description

Get data.frame with prices of 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 character string containing the exchange. Default is kraken.

route

A character string containing the route. Default is ohlc.

datetime

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

Value

A data.frame containing OHLC candlestick prices of 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.ohlc.hourly <- markets("btcusd")
df.ohlc.hourly2 <- markets("btcusd", list(periods = 3600, before = 1609851600,
                                          after = 1609506000), datetime = FALSE)
df.ohlc.daily <- 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