Description Usage Arguments Value References See Also Examples
View source: R/get_orderbook.R
Get the order book of cryptocurrencies using the REST API of cryptowat.ch. The route is orderbook and returns two arrays, bids and asks. See https://docs.cryptowat.ch/rest-api/markets/order-book for further information.
1 2 |
pair |
A string containing a pair symbol, e.g. btcusd (required argument). Run |
depth |
A number: Only return orders cumulating up to this size (optional). |
span |
A number: Only return orders within this percentage of the midpoint (optional). Example: 0.5 (meaning 0.5 percent). |
limit |
An integer limiting the number of orders on each side of the book (optional). |
exchange |
A character string containing the exchange. Default is kraken. Run |
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 |
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 https://docs.cryptowat.ch/rest-api for further information.
get_markets
, get_orderbook_liquidity
, get_exchanges
, get_pairs
1 2 3 4 5 6 7 8 9 10 11 | ## 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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.