get_orderbook {cryptowatchR}R Documentation

Get order book of cryptocurrencies


Get the order book of cryptocurrencies using the REST API of The route is orderbook and returns two arrays, bids and asks. See for further information.


get_orderbook(pair, depth = NULL, span = NULL, limit = NULL,
              exchange = "kraken", api_key = NULL, allowance = FALSE)



A string containing a pair symbol, e.g. btcusd (required argument). Run get_pairs() to find other available pairs.


A number: Only return orders cumulating up to this size (optional).


A number: Only return orders within this percentage of the midpoint (optional). Example: 0.5 (meaning 0.5 percent).


An integer limiting the number of orders on each side of the book (optional).


A character string containing the exchange. Default is kraken. Run get_exchanges() to find other available exchanges.


A character string containing the API key. See to learn how to create an account and how to generate an API key.


A logical (default is FALSE). If TRUE the function returns a list which includes allowance information, i.e. cost of the request, remaining credits and your account name.


A list containing an order book of a given pair of currencies. It contain two data.frames for bid and ask prices with columns Price and Amount. The function also returns the sequence number seqNum. If allowance is TRUE, get_orderbook() returns a list which additionally includes allowance information.


See for further information.

See Also

get_markets, get_orderbook_liquidity, get_exchanges, get_pairs


## Not run: 
# Entire order book of Bitcoin in USD
orderbook <- get_orderbook("btcusd")
# Order book of Bitcoin in USD: only the best bid and best ask, i.e. the spread
orderbook.limit <- get_orderbook("btcusd", limit = 1)
# Order book of Bitcoin in USD for orders within 0.5% of the top of the book
orderbook.span <- get_orderbook("btcusd", span = 0.5)
# Order book of Bitcoin in Euro for orders adding up to 100 BTC on each side
orderbook.depth <- get_orderbook("btceur", depth = 100)

## End(Not run)

[Package cryptowatchR version 0.2.0 Index]