Skip to content

Latest commit

 

History

History
220 lines (155 loc) · 4.9 KB

README.md

File metadata and controls

220 lines (155 loc) · 4.9 KB

rcoinapi

R package for the CoinAPI.io REST API.

Requires an API key: https://www.coinapi.io/pricing?apikey

Documentation: https://docs.coinapi.io/

Installation

You can install the development version from GitHub with:

install.packages("devtools")
library("devtools")
devtools::install_github("Ramshreyas/rcoinapi")

Setup

Load the library

library(rcoinapi)

Set your API key (Get your API key at https://www.coinapi.io/pricing?apikey)

setApiKey("XXXXXXXXXXXXXXX")

Usage

Metadata

List all Exchanges, with details

getExchanges()
getExchanges("FTX")

List all Exchange Icons

getExchangeIcons(32)

List all Assets

getAssets()
getAssets("BTC")

List all Asset Icons

getAssetIcons(32)

List all Symbols

getCryptoSymbols()
getCryptoSymbols(filterSymbolId = "BTC")
getCryptoSymbols(filterSymbolId = "BTC", filterAssetId = "USD")
getCryptoSymbols(filterSymbolId = "BTC", filterAssetId = "USD", exchangeId = "FTX")

Exchange Rates

Get exchange rate between pair of requested assets at specific or current time.

getExchangeRate("BTC", "USD")

Get the current exchange rate between requested asset and all other assets.

getAllExchangeRates("BTC")

Get valid periods for historical exchange rates queries

getHistoricalExchangeRatePeriods()

Get the historical exchange rates between two assets as an XTS object for a given time period

getHistoricalExchangeRates("BTC", "USD", "1HRS", "2016-01-01T00:00:00", "2016-02-01T00:00:00", limit = 25)

OHLCV

Get valid period ids for OHLCV requests

getOHLCVPeriods()

Get OHLCV latest timeseries data returned in time descending order. Data can be requested by the period and symbol or asset pairs. If asset pairs are used then timeseries in the response will contain data consolidated across all most legitimate SPOT markets which contain both assets in any order.

getLatestOHLCV("BITSTAMP_SPOT_BTC_USD", periodId = "1MIN", limit = 25)
getLatestOHLCV("BTC", "USD", periodId = "1MIN", limit = 25)

Get OHLCV timeseries data returned in time ascending order. Data can be requested by the period and symbol or asset pairs. If asset pairs are used then timeseries in the response will contain data consolidated across all most legitimate SPOT markets which contain both assets in any order..

getHistoricalOHLCV("BTC", "USD", periodId = "1MIN", timeStart = "2016-01-01T00:00:00", limit = 25)

Trades

Get latest trades from all symbols up to 1 minute ago or get latest trades from a specific symbol without time limitation. Latest data is always returned in time descending order.

getTrades()
getTrades(filterSymbol = "BTC", limit = 25)
getTrades(symbol = "BITSTAMP_SPOT_BTC_USD", limit = 25)

Get historical transactions from specific symbol, returned in time ascending order.

getHistoricalTrades(symbol = "BITSTAMP_SPOT_BTC_USD", timeStart = "2016-01-01T00:00:00", limit = 25)
getHistoricalTrades(symbol = "BITSTAMP_SPOT_BTC_USD", timeStart = "2016-01-01T00:00:00", timeEnd = "2016-01-01T00:10:00", limit = 25)

Quotes

Get current quotes for all symbols or for a specific symbol.

getQuotes()
getQuotes(symbol = "BITSTAMP_SPOT_BTC_USD")
getQuotes(filterSymbol = "BTC")

Get latest quote updates up to 1 minute ago or get updates for a specific symbol without time limit. Latest data is always returned in time descending order.

getLatestQuotes()
#' getLatestQuotes(symbol = "BITSTAMP_SPOT_BTC_USD")
#' getLatestQuotes(filterSymbol = "BTC")

Get historical quote updates within requested time range, returned in time ascending order.

getHistoricalQuotes(symbol = "BITSTAMP_SPOT_BTC_USD", timeStart = "2016-01-01T00:00:00", timeEnd = "2016-01-01T00:10:00", limit = 25)

Orderbook

Get current order book snapshot for all or a specific symbol.

getOrderbook(symbol = "BITSTAMP_SPOT_BTC_USD", limitLevels = 1)
getOrderbook(filterSymbol = "BTC")

Get latest order book snapshots for a specific symbol, returned in time descending order.

getLatestOrderbook(symbol = "BITSTAMP_SPOT_BTC_USD", limitLevels = 1, limit = 25)

Get historical order book snapshots for a specific symbol within time range, returned in time ascending order.

getHistoricalOrderbook(symbol = "BITSTAMP_SPOT_BTC_USD", timeStart = "2016-01-01T00:00:00", timeEnd = "2016-01-01T00:10:00", limitLevels = 1, limit = 25)

OrderbookL3

Get current order book snapshot for all or a specific symbol.

getOrderbookL3(filterSymbol = "BTC", limitLevels = 1)
getOrderbookL3(symbol = "COINBASE_SPOT_BCH_USD", limitLevels = 1)