Order Book
get
https://api.cryptowat.ch
/markets/:exchange/:pair/orderbook
Order Book
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
1
curl "https://api.cryptowat.ch/markets/kraken/btcusd/orderbook"
Copied!
1
import requests
2
3
def main():
4
resp = requests.get("https://api.cryptowat.ch/markets/kraken/btcusd/orderbook")
5
orderbook = resp.json()['result']
6
print orderbook
7
8
if __name__ == '__main__':
9
main()
Copied!
Fetching only the spread (best bid and best ask):
1
curl "https://api.cryptowat.ch/markets/binance/btcusdt/orderbook?limit=1"
Copied!
Fetching only the orders within 0.5% of the top of the book:
1
curl "https://api.cryptowat.ch/markets/binance/btcusdt/orderbook?span=0.5"
Copied!
Fetching only enough orders to add up to 100 BTC on each side:
1
curl "https://api.cryptowat.ch/markets/binance/btcusdt/orderbook?depth=100"
Copied!
get
https://api.cryptowat.ch
/markets/:exchange/:pair/orderbook/liquidity
Order Book Liquidity
get
https://api.cryptowat.ch
/markets/:exchange/:pair/orderbook/calculator
Order Book Calculator
Example usage:
1
# Project cost to buy 50 BTC
2
curl --silent -G \
3
https://api.cryptowat.ch/markets/binance/btcusdt/orderbook/calculator \
4
-d 'amount=50' | jq ".result.buy.spend"
5
6
# Project average price received for selling 12.5 BTC
7
curl --silent -G \
8
https://api.cryptowat.ch/markets/binance/btcusdt/orderbook/calculator \
9
-d 'amount=12.5' | jq ".result.sell.avgPrice"
10
11
# Project average slippage, in basis points, for buying 150 BTC
12
curl --silent -G \
13
https://api.cryptowat.ch/markets/binance/btcusdt/orderbook/calculator \
14
-d 'amount=150' | jq ".result.buy.avgDeltaBps"
Copied!
Last modified 8mo ago