Order Book

get
Order Book

https://api.cryptowat.ch/markets/:exchange/:pair/orderbook
Gets the order book for a given market. An order book consists of two arrays, bids and asks. Each order is a 2-element array [Price, Amount].
Request
Response
Request
Path Parameters
exchange
required
string
Exchange symbol
pair
required
string
Pair symbol
Query Parameters
depth
optional
number
Only return orders cumulating up to this size
span
optional
number
Only return orders within this percentage of the midpoint. Example: 0.5 (meaning 0.5%)
limit
optional
integer
Limits the number of orders on each side of the book
Response
200: OK
https://api.cryptowat.ch/markets/kraken/btceur/orderbook
{
"result": {
"asks": [
[
6501.6,
3
],
[
6502.6,
0.63
],
// ...
],
"bids": [
[
6501.5,
2.58
],
[
6501.3,
3
],
// ...
],
"seqNum": 1272241
}
}

Each response includes a seqNum which is intended for use with the WebSocket API; you can use this to resynchronize your order book and replay deltas received over the live feed which have a higher seqNum.

Examples

Fetching the entire order book:

curl
python
curl
curl "https://api.cryptowat.ch/markets/kraken/btcusd/orderbook"
python
import requests
def main():
resp = requests.get("https://api.cryptowat.ch/markets/kraken/btcusd/orderbook")
orderbook = resp.json()['result']
print orderbook
if __name__ == '__main__':
main()

Fetching only the spread (best bid and best ask):

curl "https://api.cryptowat.ch/markets/binance/btcusdt/orderbook?limit=1"

Fetching only the orders within 0.5% of the top of the book:

curl "https://api.cryptowat.ch/markets/binance/btcusdt/orderbook?span=0.5"

Fetching only enough orders to add up to 100 BTC on each side:

curl "https://api.cryptowat.ch/markets/binance/btcusdt/orderbook?depth=100"

get
Order Book Liquidity

https://api.cryptowat.ch/markets/:exchange/:pair/orderbook/liquidity
Provides liquidity sums at several basis point levels in the order book.
Request
Response
Request
Path Parameters
exchange
required
string
pair
required
string
Response
200: OK
{
"result": {
"bid": {
"base": {
"25": "42.68575532",
"50": "150.20769818",
"75": "206.84959818",
"100": "218.10759818",
"150": "258.62059818",
"200": "327.27659818",
"250": "348.34154648",
"300": "383.75054648",
"400": "502.67164085",
"500": "610.49064085"
},
"quote": {
"25": "313163.975021932",
"50": "1099872.240007476",
"75": "1513525.370107476",
"100": "1595484.645307476",
"150": "1889520.529007476",
"200": "2384944.812607476",
"250": "2536268.321074276",
"300": "2789505.394674276",
"400": "3632933.77625822",
"500": "4389383.45085822"
}
},
"ask": {
"base": {
"25": "60.52080426",
"50": "135.43265573",
"75": "230.67417345",
"100": "259.99744375",
"150": "326.09844375",
"200": "356.33344375",
"250": "405.9344691",
"300": "498.1004691",
"400": "592.0564691",
"500": "753.84801061"
},
"quote": {
"25": "445126.396201249",
"50": "997608.022688696",
"75": "1701256.8072791",
"100": "1918691.19773703",
"150": "2410404.10213703",
"200": "2636434.97803703",
"250": "3009225.13053995",
"300": "3704686.84893995",
"400": "4417540.34713995",
"500": "5659924.243671635"
}
}
}
}

get
Order Book Calculator

https://api.cryptowat.ch/markets/:exchange/:pair/orderbook/calculator
Provides a live quote from the order book for a given buy & sell amount
Request
Response
Request
Path Parameters
amount
optional
number
Amount to buy/sell
Response
200: OK
The response includes projections for the buy and sell side for the given amount. "Reach" indicates the farthest your fill would reach. "Avg" indicates the volume-weighted average.
{
"result": {
"buy": {
"avgPrice": "10759.4575759592",
"avgDelta": "3.1575759592",
"avgDeltaBps": "2",
"reachPrice": "10762.7",
"reachDelta": "6.4",
"reachDeltaBps": "5",
"spend": "107594.575759592"
},
"sell": {
"avgPrice": "10755.3768292831",
"avgDelta": "-0.8231707169",
"avgDeltaBps": "-1",
"reachPrice": "10754.2",
"reachDelta": "-2",
"reachDeltaBps": "-2",
"receive": "107553.768292831"
}
}
}

Example usage:

# Project cost to buy 50 BTC
curl --silent -G \
https://api.cryptowat.ch/markets/binance/btcusdt/orderbook/calculator \
-d 'amount=50' | jq ".result.buy.spend"
# Project average price received for selling 12.5 BTC
curl --silent -G \
https://api.cryptowat.ch/markets/binance/btcusdt/orderbook/calculator \
-d 'amount=12.5' | jq ".result.sell.avgPrice"
# Project average slippage, in basis points, for buying 150 BTC
curl --silent -G \
https://api.cryptowat.ch/markets/binance/btcusdt/orderbook/calculator \
-d 'amount=150' | jq ".result.buy.avgDeltaBps"